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

feat: adds time-triggered GitHub action to run ci nightly #601

Merged
merged 21 commits into from
Jul 11, 2024
Merged
Changes from 17 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
148 changes: 148 additions & 0 deletions .github/workflows/nightly-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
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: build
target_flags:
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "false"

kukkok3 marked this conversation as resolved.
Show resolved Hide resolved
- name: Get schemathesis test report
kukkok3 marked this conversation as resolved.
Show resolved Hide resolved
uses: input-output-hk/catalyst-ci/actions/run@master
if: always()
continue-on-error: true
with:
earthfile: ./catalyst-gateway/tests/schemathesis_tests
flags: --allow-privileged
targets: test-fuzzer-api
target_flags:
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "false"

- name: Get flutter unit test report
uses: input-output-hk/catalyst-ci/actions/run@master
if: always()
continue-on-error: true
with:
earthfile: ./catalyst_voices/
flags:
targets: test-unit
target_flags:
runner_address: ${{ secrets.EARTHLY_SATELLITE_ADDRESS }}
artifact: "false"

- name: Get backend python test report
uses: input-output-hk/catalyst-ci/actions/run@master
if: always()
continue-on-error: true
with:
earthfile: ./catalyst-gateway/tests/api_tests/
flags: --allow-privileged
targets: test
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

- name: Comment PR with Allure report link
kukkok3 marked this conversation as resolved.
Show resolved Hide resolved
if: ${{ always() && github.event_name == 'pull_request' && steps.allure.outputs.report_url }}
uses: thollander/actions-comment-pull-request@v2
with:
message: |
${{ steps.allure.outputs.test_result_icon }} [Test Report](${{ steps.allure.outputs.report_url }}) | ${\color{lightgreen}Pass: ${{ steps.allure.outputs.test_result_passed }}/${{ steps.allure.outputs.test_result_total }}}$ | ${\color{red}Fail: ${{ steps.allure.outputs.test_result_failed }}/${{ steps.allure.outputs.test_result_total }}}$ |
comment_tag: allure_report
mode: upsert
Loading