From a2ce0b3433c3ee57286a1ced083c17ef429dc0ab Mon Sep 17 00:00:00 2001 From: Florian PAUL Date: Mon, 16 Sep 2024 14:26:41 +0200 Subject: [PATCH] ci: check releases --- .github/workflows/check-all-releases.yml | 47 ++++++++++++++++++++++++ .github/workflows/check-release.yml | 46 +++++++++++++++++++++++ .github/workflows/it-tests.yml | 18 +++++++-- 3 files changed, 108 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/check-all-releases.yml create mode 100644 .github/workflows/check-release.yml diff --git a/.github/workflows/check-all-releases.yml b/.github/workflows/check-all-releases.yml new file mode 100644 index 0000000000..4b9c0b755a --- /dev/null +++ b/.github/workflows/check-all-releases.yml @@ -0,0 +1,47 @@ +name: Check all releases (latest patch of each minor version) + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * 6" + +permissions: + contents: read + issues: write + +env: + YARN_ENABLE_HARDENED_MODE: 0 + +jobs: + findTags: + runs-on: ubuntu-latest + outputs: + tags: ${{ steps.getTags.outputs.TAGS }} + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + fetch-depth: 0 + fetch-tags: true + - name: Get the latest patch of each minor version + run: | + TAGS=$(git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sort -V | awk -F. '{print $1"."$2}' | uniq | xargs -I {} sh -c 'git tag -l "{}.*" | sort -V | tail -n 1' | xargs -d'\n' -I {} echo '"{}"' | tr '\n' ',') + echo "TAGS=[$TAGS]" >> "$GITHUB_OUTPUT" + id: getTags + + checkRelease: + needs: findTags + strategy: + fail-fast: false + matrix: + #tag: ${{ fromJSON(needs.findTags.outputs.tags) }} + tag: [v10.4.9, v11.0.6] + uses: ./.github/workflows/check-release.yml + with: + ref: ${{ matrix.tag }} + + report: + runs-on: ubuntu-latest + needs: checkRelease + if: failure() + steps: + - run: echo TODO create issue diff --git a/.github/workflows/check-release.yml b/.github/workflows/check-release.yml new file mode 100644 index 0000000000..ad3f0e40e4 --- /dev/null +++ b/.github/workflows/check-release.yml @@ -0,0 +1,46 @@ +name: Check release + +on: + workflow_dispatch: + inputs: + ref: + type: string + required: true + description: The branch, tag or SHA to checkout. + workflow_call: + inputs: + ref: + type: string + default: '' + description: The branch, tag or SHA to checkout. + secrets: + NX_CLOUD_ACCESS_TOKEN: + required: false + description: Token to use Nx Cloud token + +env: + YARN_ENABLE_HARDENED_MODE: 0 + +jobs: + buildRelease: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.ref }} + - uses: ./tools/github-actions/setup + - uses: ./.github/actions/setup-java + with: + install-jdk: 'true' + - run: yarn build:swagger-gen + - run: yarn build + - uses: ./tools/github-actions/upload-build-output + with: + artifactName: 'dist-${{ inputs.ref }}' + + testRelease: + needs: [buildRelease] + uses: ./.github/workflows/it-tests.yml + with: + ref: ${{ inputs.ref }} + skipNxCache: true diff --git a/.github/workflows/it-tests.yml b/.github/workflows/it-tests.yml index fcf6829ca9..89cea043cd 100644 --- a/.github/workflows/it-tests.yml +++ b/.github/workflows/it-tests.yml @@ -8,6 +8,10 @@ on: default: false required: false description: Skip the nx cache + ref: + type: string + default: '' + description: The branch, tag or SHA to checkout. secrets: NX_CLOUD_ACCESS_TOKEN: required: false @@ -27,7 +31,11 @@ jobs: NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.ref }} - uses: ./tools/github-actions/download-build-output + with: + artifactName: ${{ inputs.ref && format('dist-{0}', inputs.ref) || 'dist' }} - uses: ./tools/github-actions/setup - name: Setup verdaccio once for all tests id: setup-verdaccio @@ -44,7 +52,7 @@ jobs: uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 with: name: verdaccio - path: verdaccio.zip + path: ${{ inputs.ref && format('verdaccio-{0}.zip', inputs.ref) || 'verdaccio.zip' }} - name: Stop verdaccio if: always() run: yarn verdaccio:stop @@ -64,7 +72,11 @@ jobs: PREPARE_TEST_ENV_TYPE: ${{ matrix.testEnvironment }} steps: - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + with: + ref: ${{ inputs.ref }} - uses: ./tools/github-actions/download-build-output + with: + artifactName: ${{ inputs.ref && format('dist-{0}', inputs.ref) || 'dist' }} - uses: ./tools/github-actions/setup - shell: bash run: | @@ -89,12 +101,12 @@ jobs: - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 name: Download verdaccio storage prepared in the previous job with: - name: verdaccio + name: ${{ inputs.ref && format('verdaccio-{0}', inputs.ref) || 'verdaccio' }} path: '.' - name: Setup verdaccio once for all tests id: setup-verdaccio run: | - unzip -q -n verdaccio.zip + unzip -q -n ${{ inputs.ref && format('verdaccio-{0}.zip', inputs.ref) || 'verdaccio.zip' }} if [ "$RUNNER_OS" == "Linux" ]; then chmod a+rwx -R ./.verdaccio/storage yarn verdaccio:start-persistent