Skip to content

Nightly pipeline short session e2e tests #84

Nightly pipeline short session e2e tests

Nightly pipeline short session e2e tests #84

---
name: Nightly pipeline short session e2e tests
on:
workflow_dispatch:
schedule:
- cron: '00 23 * * *'
concurrency:
group: "${{ github.ref }}-${{ github.workflow }}"
cancel-in-progress: true
jobs:
check-vars-and-secrets:
name: Check vars and secrets
uses: ./.github/workflows/_check-vars-and-secrets.yml
secrets: inherit
build-e2e-client-image:
needs: [check-vars-and-secrets]
name: Build production node and e2e client docker image
uses: ./.github/workflows/_build-production-node-and-e2e-client-image.yml
with:
build-e2e-client: true
get-e2e-test-case-names:
name: Get e2e test case names
runs-on: ubuntu-20.04
needs: [build-e2e-client-image]
outputs:
testcases: ${{ steps.get-testcases.outputs.testcases }}
steps:
- name: Download artifact with the test suite image
uses: actions/download-artifact@v2
with:
name: aleph-e2e-client
- name: Load test suite docker image
shell: bash
run: docker load -i aleph-e2e-client.tar
- name: Get testcases
shell: bash
id: get-testcases
run: |
testcases=$(docker run --entrypoint aleph-e2e-client aleph-e2e-client:latest \
`# basically cargo test --list under the hood` \
--list | \
`# filter by testcases (not benches)` \
grep "test::" | \
`# remote test:: prefix` \
sed -e 's/test:://g' | \
`# for now limit testcases one testcase` \
grep 'finalization::finalization' | \
`# first column is testcase name` \
awk '{print $1;}' | \
`# add "" quotes` \
sed -e 's/:$/"/g' -e 's/^/"/g' | \
`# swap newlines with command and a space` \
tr '\n' ', ' | \
`# but remove last trailing comma so it is valid JSON array` \
sed 's/.$//')
echo "testcases=[$testcases]" >> $GITHUB_OUTPUT
build-test-node-and-runtime:
name: Build test node and runtime
needs: [check-vars-and-secrets]
uses: ./.github/workflows/_build-test-node-and-runtime.yml
secrets: inherit
# this job is required for bootstrapping featurenet
store-test-node-and-runtime:
name: Store test node and runtime in Devnet bucket
runs-on: ubuntu-20.04
needs: [build-test-node-and-runtime]
steps:
- name: Checkout aleph-node source code
uses: actions/checkout@v4
- name: Store test node and runtime
uses: ./.github/actions/store-node-and-runtime
with:
profile: test
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
aws-bucket: ${{ secrets.CI_DEVNET_S3BUCKET_NAME }}
push-featurenet-node-image-to-ecr:
needs: [build-test-node-and-runtime]
name: Build and push PR test docker image to ECR
uses: ./.github/workflows/_build-and-push-pull-request-image-to-featurenets.yml
secrets: inherit
runs-e2e-test-on-fe:
needs:
- push-featurenet-node-image-to-ecr
- build-e2e-client-image
- store-test-node-and-runtime
- get-e2e-test-case-names
name: e2e
runs-on: [self-hosted, Linux, X64, small]
strategy:
fail-fast: false
max-parallel: 3
matrix:
testcase: ${{ fromJSON(needs.get-e2e-test-case-names.outputs.testcases) }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Call action get-ref-properties
id: get-ref-properties
uses: Cardinal-Cryptography/github-actions/get-ref-properties@v2
- name: Get fe name
id: get-final-featurenet-name
shell: bash
env:
# yamllint disable rule:line-length
APP_NAME: ${{ format('{0}-{1}', github.run_id, matrix.testcase) }}
run: |
final_featurename_local=${{ env.APP_NAME }}
echo "final-featurenet-name=$(printf $final_featurename_local | sed 's|::|-|g' | sed 's|_|-|g')" >> $GITHUB_OUTPUT
# yamllint enable rule:line-length
- name: Create featurenet from scratch
uses: Cardinal-Cryptography/github-actions/create-featurenet@v2
id: create-featurenet
with:
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
repo-featurenets-name: ${{ secrets.REPO_OPS_FEATURENETS_NAME }}
repo-featurenet-template-name: ${{ secrets.REPO_FEATURENET_TEMPLATE_NAME }}
argo-host: ${{ secrets.ARGOCD_DEVNET_HOST }}
ecr-public-registry: ${{ vars.ECR_PUBLIC_REGISTRY }}
featurenet-keys-s3bucket-name: ${{ secrets.FEATURENET_KEYS_S3BUCKET_NAME }}
expiration: '3h'
featurenet-name: ${{ steps.get-final-featurenet-name.outputs.final-featurenet-name }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
wait-for-finalized-heads: "true"
- name: Download artifact with the test suite image
uses: actions/download-artifact@v2
with:
name: aleph-e2e-client
- name: Load test suite docker image
shell: bash
run: docker load -i aleph-e2e-client.tar
- name: Run ${{ matrix.testcase }} e2e test
shell: bash
# yamllint disable rule:line-length
run: |
docker run --network host \
-e NODE_URL="wss://${{ steps.create-featurenet.outputs.ws-hostname }}:443" \
-e TEST_CASES="${{ matrix.testcase }}" \
-e RUST_LOG=info \
aleph-e2e-client:latest
timeout-minutes: 15
# yamllint enable rule:line-length
- name: Delete old featurenet app and data
uses: Cardinal-Cryptography/github-actions/delete-featurenet@v2
with:
gh-ci-token: ${{ secrets.CI_GH_TOKEN }}
aws-access-key-id: ${{ secrets.AWS_DEVNET_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_DEVNET_SECRET_ACCESS_KEY }}
ecr-public-registry: ${{ vars.ECR_PUBLIC_REGISTRY }}
argo-sync-user-token: ${{ secrets.ARGO_SYNC_USER_TOKEN }}
repo-featurenets-name: ${{ secrets.REPO_OPS_FEATURENETS_NAME }}
repo-featurenet-template-name: ${{ secrets.REPO_FEATURENET_TEMPLATE_NAME }}
argo-host: ${{ secrets.ARGOCD_DEVNET_HOST }}
featurenet-keys-s3bucket-name: ${{ secrets.FEATURENET_KEYS_S3BUCKET_NAME }}
featurenet-name: ${{ steps.get-final-featurenet-name.outputs.final-featurenet-name }}
git-commit-author: ${{ secrets.AUTOCOMMIT_AUTHOR }}
git-commit-email: ${{ secrets.AUTOCOMMIT_EMAIL }}
slack-notification:
name: Slack notification
runs-on: ubuntu-20.04
needs: [runs-e2e-test-on-fe]
if: ${{ !cancelled() }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Send Slack message
uses: ./.github/actions/slack-notification
with:
notify-on: "always"
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_NIGHTLY_PIPELINE }}