Skip to content

Commit

Permalink
ci: check releases
Browse files Browse the repository at this point in the history
  • Loading branch information
fpaul-1A committed Sep 17, 2024
1 parent dc027b9 commit e7ff607
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .github/check-release-issue-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
title: Some releases are failing the tests
labels: bug
---
On {{ date | date('D MMM YYYY') }} some releases failed the automated tests. Check the [action result]({{ env.RUN_URL }}).
57 changes: 57 additions & 0 deletions .github/workflows/check-all-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Check all releases (latest patch of each minor version for the last 3 majors)

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 for the last 3 majors
run: |
SUPPORTED_MAJORS=$(git tag -l | sort -V | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | awk -F. '{print $1}' | uniq | tail -n 3 | tr '\n' '|')
echo "Supported majors: $SUPPORTED_MAJORS"
ALL_MINOR_TAGS=$(git tag -l | grep -E "^($SUPPORTED_MAJORS)\." | 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 "Found minor versions: $ALL_MINOR_TAGS"
echo "TAGS=[$ALL_MINOR_TAGS]" >> "$GITHUB_OUTPUT"
id: getTags

checkRelease:
needs: findTags
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.findTags.outputs.tags) }}
uses: ./.github/workflows/check-release.yml
with:
ref: ${{ matrix.tag }}

report:
runs-on: ubuntu-latest
needs: checkRelease
if: failure()
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Create an issue
uses: JasonEtco/create-an-issue@1b14a70e4d8dc185e5cc76d3bec9eab20257b2c5 # v2.9.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUN_URL: ${{ format('https://github.com/{0}/actions/runs/{1}/attempts/{2}', github.repository, github.run_id, github.run_attempt || 1) }}
with:
filename: .github/check-release-issue-template.md
update_existing: true
46 changes: 46 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -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
21 changes: 17 additions & 4 deletions .github/workflows/it-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -43,7 +51,7 @@ jobs:
- name: Publish verdaccio storage
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: verdaccio
name: ${{ inputs.ref && format('verdaccio-{0}', inputs.ref) || 'verdaccio' }}
path: verdaccio.zip
- name: Stop verdaccio
if: always()
Expand All @@ -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: |
Expand All @@ -77,6 +89,7 @@ jobs:
run: echo "currentMonth=$(date +'%Y-%m')" >> $GITHUB_ENV
shell: bash
- name: Cache test-app yarn
if: inputs.ref == ''
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: |
Expand All @@ -89,7 +102,7 @@ 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
Expand Down Expand Up @@ -122,13 +135,13 @@ jobs:
if: failure() && steps.it-tests.conclusion == 'failure'
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: it-tests-${{ matrix.os }}-${{ matrix.packageManager }}
name: it-tests-${{ matrix.os }}-${{ matrix.packageManager }}-${{ inputs.ref }}
path: it-tests.zip
- name: Publish tests reports
if: always()
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: it-reports-${{ matrix.os }}-${{ matrix.packageManager }}
name: it-reports-${{ matrix.os }}-${{ matrix.packageManager }}-${{ inputs.ref }}
path: 'packages/**/dist-test/it-report.xml'
- name: Stop verdaccio
if: always() && runner.os == 'Linux'
Expand Down

0 comments on commit e7ff607

Please sign in to comment.