Merge pull request #10 from NHSDigital/odin-269-sonar-scan-fixes #8
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: odin-merge | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| jobs: | |
| scan: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout the calling repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: build-common | |
| uses: ./.github/actions/build-common | |
| - name: run tests | |
| shell: bash | |
| run: | | |
| make coverage-ci | |
| - name: convert sonar reports | |
| if: ${{ hashFiles('./reports/junit/*.xml') || hashFiles('./reports/coverage.xml') }} | |
| uses: ./.github/actions/sonar-reports | |
| - name: prepare sonar properties | |
| if: ${{ hashFiles('./sonar-project.properties') }} | |
| uses: ./.github/actions/sonar-properties | |
| - name: sonarqube scan | |
| uses: SonarSource/sonarqube-scan-action@8c71dc039c2dd71d3821e89a2b58ecc7fee6ced9 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| tag-version: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| steps: | |
| - name: checkout the calling repo | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: check for specific poetry version | |
| id: poetry-version | |
| shell: bash | |
| run: | | |
| version="latest" | |
| if [ -f .tool-versions ] && grep -Eq "^poetry .*" .tool-versions; then | |
| version="$(grep -E "^poetry .*" .tool-versions | cut -d ' ' -f2)" | |
| fi | |
| echo "version=${version}" >> "$GITHUB_OUTPUT" | |
| - name: install poetry | |
| uses: snok/install-poetry@v1 | |
| with: | |
| version: ${{ steps.poetry-version.outputs.version }} | |
| plugins: poetry-dynamic-versioning | |
| - name: increment patch version and replace major version | |
| shell: bash | |
| id: get-version | |
| run: | | |
| # Create semantic version tag: vN.N.N | |
| SEMANTIC_VERSION="v$(poetry version patch -s)" | |
| git tag "${SEMANTIC_VERSION}" | |
| git push origin "${SEMANTIC_VERSION}" | |
| # Delete existing major version tag if it already exists: vN | |
| MAJOR_VERSION="$(echo ${SEMANTIC_VERSION} | cut -d. -f1)" | |
| if [[ $(git tag --list ${MAJOR_VERSION}) != "" ]]; then | |
| git tag -d ${MAJOR_VERSION} | |
| git push origin :refs/tags/${MAJOR_VERSION} | |
| fi | |
| # Create major version tag | |
| git tag "${MAJOR_VERSION}" | |
| git push origin "${MAJOR_VERSION}" |