From 63ecf39d8b25588dc5fc80c1fc981ecab687c217 Mon Sep 17 00:00:00 2001 From: SotaTek-DuyLe <75770191+SotaTek-DuyLe@users.noreply.github.com> Date: Thu, 11 Jul 2024 19:46:40 +0700 Subject: [PATCH] feat: adds time-triggered GitHub action to run ci nightly (#601) * feat: add time triggered with setting nightly equals true * fix: updated example test * Create nightly-ci.yml * fix: name and cron * fix: cron * fix: cron * fix: nightly * fix: revert ci.yml, create nightly-ci * fix: cron value * feat: add cron for testing purpose * fix: remove example_test.py --------- Co-authored-by: SotaTek-DuyLe Co-authored-by: Oleksandr Prokhorenko Co-authored-by: Dee --- .github/workflows/nightly-ci.yml | 103 +++++++++++++++++++++++++++++++ catalyst-gateway/Earthfile | 4 ++ 2 files changed, 107 insertions(+) create mode 100644 .github/workflows/nightly-ci.yml diff --git a/.github/workflows/nightly-ci.yml b/.github/workflows/nightly-ci.yml new file mode 100644 index 00000000000..61779383f95 --- /dev/null +++ b/.github/workflows/nightly-ci.yml @@ -0,0 +1,103 @@ +name: CI nightly + +on: + schedule: + - cron: '0 0 * * *' # Runs every day at 00:00 + - cron: '0 * * * *' # Run every hour, for testing purpose + +permissions: + id-token: write + contents: write + packages: write + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +env: + REPORT_EXT: .junit-report.xml + ALLURE_REPORT_PATH: nightly-allure-report + +jobs: + ci_nightly: + uses: input-output-hk/catalyst-ci/.github/workflows/ci.yml@master + with: + aws_ecr_registry: 332405224602.dkr.ecr.eu-central-1.amazonaws.com + aws_role_arn: arn:aws:iam::332405224602:role/ci + aws_region: eu-central-1 + nightly: true + secrets: + dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }} + dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }} + earthly_runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }} + earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }} + + generate-test-reports: + name: Generate test reports + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup CI + uses: input-output-hk/catalyst-ci/actions/setup@master + with: + aws_role_arn: ${{ env.AWS_ROLE_ARN }} + aws_region: ${{ env.AWS_REGION }} + earthly_runner_secret: ${{ secrets.EARTHLY_RUNNER_SECRET }} + + - name: Get catalyst gateway unit test report + uses: input-output-hk/catalyst-ci/actions/run@master + if: always() + continue-on-error: true + with: + earthfile: ./catalyst-gateway/ + flags: + targets: nightly + target_flags: + runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }} + artifact: "false" + + - name: Collect and upload test reports + uses: actions/upload-artifact@v4 + if: always() + with: + path: '**/*${{ env.REPORT_EXT }}' + if-no-files-found: error + retention-days: 1 + + generate-allure-report: + name: Generate allure report + runs-on: ubuntu-latest + needs: [generate-test-reports] + steps: + - uses: actions/checkout@v4 + + - uses: actions/download-artifact@v4 + + - name: Setup Allure report + run: | + mkdir -p ${{ env.ALLURE_REPORT_PATH }} + shopt -s globstar + cp **/*${{ env.REPORT_EXT }} ${{ env.ALLURE_REPORT_PATH }} + ls ${{ env.ALLURE_REPORT_PATH }} + + - name: Checkout gh-pages + uses: actions/checkout@v4 + with: + ref: gh-pages + path: gh-pages-dir + + - name: Build Allure report + uses: mgrybyk/allure-report-branch-action@v1 + id: allure + with: + report_id: 'test-report' + gh_pages: 'gh-pages-dir' + report_dir: ${{ env.ALLURE_REPORT_PATH }} + + - name: Git push to gh-pages + uses: mgrybyk/git-commit-pull-push-action@v1 + with: + repository: gh-pages-dir + branch: gh-pages + pull_args: --rebase -X ours \ No newline at end of file diff --git a/catalyst-gateway/Earthfile b/catalyst-gateway/Earthfile index a67645339d1..1123e284742 100644 --- a/catalyst-gateway/Earthfile +++ b/catalyst-gateway/Earthfile @@ -49,6 +49,10 @@ build: SAVE ARTIFACT target/doc doc SAVE ARTIFACT target/release/cat-gateway cat-gateway +# build : Build the catalyst-gateway service. Used for nightly setup +nightly: + BUILD +build + # all-hosts-build : Test which runs check with all supported host tooling. Needs qemu or rosetta to run. # Only used to validate tooling is working across host toolsets. all-hosts-build: