Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[draft] ci: check releases #2170

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}).
67 changes: 67 additions & 0 deletions .github/workflows/check-all-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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

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: |
# Extract all releases
RELEASE_TAG_PATTERN="^v[0-9]+\.[0-9]+\.[0-9]+$"
ALL_RELEASES=$(git tag -l | sort -V | grep -E $RELEASE_TAG_PATTERN)
SUPPORTED_MAJORS=$(echo $ALL_RELEASES | tr ' ' '\n' | awk -F. '{print $1}' | uniq | tail -n 3)
ALL_SUPPORTED_RELEASES=$(echo $ALL_RELEASES | tr ' ' '\n' | grep -E "^($(echo $SUPPORTED_MAJORS | tr ' ' '|'))\.")
echo "Supported releases: $ALL_SUPPORTED_RELEASES"

# Filter per major
LATEST_MINOR_OF_EACH_MAJOR=$(echo $ALL_SUPPORTED_RELEASES | tr ' ' '\n' | awk -F. '{print $1}' | uniq | xargs -I {} sh -c "echo '$ALL_SUPPORTED_RELEASES' | grep -E '^{}.*' | tail -n 1")
echo "Found latest minor of each major versions: $LATEST_MINOR_OF_EACH_MAJOR"

# Filter per minor
LATEST_PATCH_OF_EACH_MINOR=$(echo $ALL_SUPPORTED_RELEASES | tr ' ' '\n' | awk -F. '{print $1 "." $2}' | uniq | xargs -I {} sh -c "echo '$ALL_SUPPORTED_RELEASES' | grep -E '^{}.*' | tail -n 1")
echo "Found latest patch of each minor versions: $LATEST_PATCH_OF_EACH_MINOR"

# Export output in JSON format
TAGS=$(echo $LATEST_MINOR_OF_EACH_MAJOR | tr ' ' '\n' | awk '{print "\"" $0 "\""}' | tr '\n' ',')
echo "TAGS=[$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
43 changes: 43 additions & 0 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as we have some instability on it-tests
should we add 1 or 2 retry on this step before it opens an issue ?

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
Loading