Merge pull request #194 from NHSDigital/mesh-2092-dependabot-combined #82
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: merge-develop | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'NHSDigital/nhs-aws-helpers' && !contains(github.event.head_commit.message, 'tag release version:') | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: setup python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: setup poetry | |
| uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 | |
| with: | |
| poetry-version: 2.1.4 | |
| - name: add poetry plugins | |
| run: | | |
| poetry self add "poetry-dynamic-versioning[plugin]" | |
| - name: cache virtualenv | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| .venv | |
| key: ${{ runner.os }}-poetry-v2-py3.9-${{ hashFiles('./poetry.lock') }} | |
| - name: git reset | |
| run: git reset --hard | |
| - name: install dependencies | |
| run: make install-ci | |
| - name: start localstack | |
| run: make up | |
| - name: code coverage | |
| run: make coverage-ci | |
| - name: code coverage report | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: orgoro/coverage@7dbd48c7f7ed09df337ff40058340c85bc93cb3d | |
| with: | |
| coverageFile: reports/coverage.xml | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| thresholdAll: 0.65 | |
| - name: setup java | |
| if: github.actor != 'dependabot[bot]' && (success() || failure()) | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: "corretto" | |
| java-version: "17" | |
| - name: provision sonar-scanner | |
| if: github.actor != 'dependabot[bot]' && (success() || failure()) | |
| run: | | |
| export SONAR_VERSION="4.7.0.2747" | |
| wget -q --max-redirect=0 "https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${SONAR_VERSION}.zip" -O sonar-scanner.zip | |
| unzip -q ./sonar-scanner.zip | |
| mv ./sonar-scanner-${SONAR_VERSION} ./sonar-scanner | |
| scripts/sonar_tests.py | |
| - name: run sonar scan | |
| if: github.actor != 'dependabot[bot]' && (success() || failure()) | |
| run: | | |
| PATH="$PWD/sonar-scanner/bin:$PATH" | |
| sonar-scanner | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| - name: publish junit reports | |
| if: success() || failure() | |
| uses: mikepenz/action-junit-report@e08919a3b1fb83a78393dfb775a9c37f17d8eea6 | |
| with: | |
| check_name: junit reports | |
| report_paths: reports/junit/*.xml | |
| - name: stop docker containers | |
| if: success() || failure() | |
| run: make down | |
| publish: | |
| runs-on: ubuntu-latest | |
| if: github.repository == 'NHSDigital/nhs-aws-helpers' && github.actor != 'dependabot[bot]' && !contains(github.event.head_commit.message, 'tag release version:') | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: clean | |
| run: | | |
| git clean -fdx | |
| find . -type f | xargs chmod g+w | |
| - name: setup python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version-file: "pyproject.toml" | |
| - name: setup poetry | |
| uses: abatilo/actions-poetry@3765cf608f2d4a72178a9fc5b918668e542b89b1 | |
| with: | |
| poetry-version: 2.1.4 | |
| - name: add poetry plugins | |
| run: | | |
| poetry self add "poetry-dynamic-versioning[plugin]" | |
| - name: poetry build | |
| run: | | |
| version="v$(poetry version patch | rev | cut -d' ' -f1 | rev)" | |
| echo "RELEASE_VERSION=$version" >> $GITHUB_ENV | |
| git tag $version | |
| poetry build | |
| echo "WHEEL=$(find dist -type f -name '*.whl' | xargs basename)" >> $GITHUB_ENV | |
| echo "SDIST=$(find dist -type f -name '*.tar.gz' | xargs basename)" >> $GITHUB_ENV | |
| - name: create release | |
| id: create_release | |
| uses: actions/create-release@v1 | |
| continue-on-error: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ env.RELEASE_VERSION }} | |
| release_name: ${{ env.RELEASE_VERSION }} | |
| - name: poetry config | |
| run: | | |
| poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} | |
| - name: poetry publish | |
| run: poetry publish | |
| - name: upload wheel | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist/${{ env.WHEEL }} | |
| asset_name: ${{ env.WHEEL }} | |
| asset_content_type: application/zip | |
| - name: upload sdist | |
| uses: actions/upload-release-asset@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| upload_url: ${{ steps.create_release.outputs.upload_url }} | |
| asset_path: ./dist/${{ env.SDIST }} | |
| asset_name: ${{ env.SDIST }} | |
| asset_content_type: application/gzip |