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

Orion integration tests workflow #145

Draft
wants to merge 20 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
c1faa31
Trigger integration tests workflow
Lezek123 Jun 8, 2023
54cfd24
Syntax fixes in tests.yml
Lezek123 Jun 8, 2023
815361e
Fix typo
Lezek123 Jun 8, 2023
3ca596b
Replace repository-dispatch with workflow-dispatch
Lezek123 Jun 8, 2023
540d7c7
trigger-tests: Add initial "Pending" status
Lezek123 Jun 8, 2023
ff3af14
Add missing GITHUB_TOKEN
Lezek123 Jun 8, 2023
9d81af1
Allow integration tests tiggering on pull_request
Lezek123 Jun 9, 2023
ad18e47
trigger-tests workflow: fix env variable name bug and add build-docke…
Lezek123 Jun 9, 2023
bb1d70d
trigger-tests.yml: Remove invalid exit line
Lezek123 Jun 9, 2023
4b6781d
trigger-tests.yml: Add sleep to waiting script
Lezek123 Jun 9, 2023
bd1a678
Allow integration tests branch dynamic customization
Lezek123 Jun 10, 2023
788147e
Add missing parenthese
Lezek123 Jun 10, 2023
f61b5c5
Use pull_request.head.sha for pull requests (instead of github.sha)
Lezek123 Jun 10, 2023
6e269d1
Fix syntax in trigger-tests comment fetching step
Lezek123 Jun 12, 2023
65efeef
Add missing "-r" flag to jq
Lezek123 Jun 12, 2023
e7382dd
Fix handling of integration tests branch selection in case of many va…
Lezek123 Jun 12, 2023
8c72438
trigger-tests.yml: Switch to `actions/checkout` approach
Lezek123 Jun 13, 2023
ac06344
Fix env.INTEGRATION_TESTS_REPO => vars.INTEGRATION_TESTS_REPO
Lezek123 Jun 13, 2023
c596d7b
Fix loading Joystream node docker image
Lezek123 Jun 13, 2023
ca610a9
trigger-tests.yml -> integration-tests.yml rename + run only on push …
Lezek123 Jun 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/build-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build and save docker image

on: [push, pull_request]

env:
SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}

jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build Docker image
run: make build-docker
- name: Save Docker image
run: docker save joystream/orion:latest | gzip > orion.tar.gz
- name: Upload Docker image
uses: actions/upload-artifact@v3
with:
name: joystream-orion-docker-${{ env.SHA }}
path: orion.tar.gz
16 changes: 0 additions & 16 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,3 @@ jobs:
run: npm ci
- name: Run checks
run: npm run checks
docker:
name: Docker build check
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node-version: [16.x]
fail-fast: true
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v1
with:
node-version: ${{matrix.node-version}}
- name: Build docker image
run: make build-docker
107 changes: 107 additions & 0 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Run Orion integration tests

on:
push:
branches:
- 'master'
pull_request_target:

env:
INTEGRATION_TESTS_BRANCH: ${{ vars.INTEGRATION_TESTS_BRANCH }}
SHA: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.sha }}

jobs:
run-tests:
runs-on: ubuntu-latest
environment:
name: ${{ github.ref_name }}
steps:
- name: Wait until build-docker-image workflow finishes successfully
run: |
CONCLUSION="null"
while [[ "$CONCLUSION" == "null" ]]
do
CONCLUSION=$(
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/actions/workflows/build-docker-image.yml/runs?head_sha=${{ env.SHA }} \
| jq -r '.workflow_runs[0].conclusion'
)
echo "build-docker-image workflow conclusion: $CONCLUSION"
if [[ "$CONCLUSION" == "null" ]]
then
echo "Waiting for build-docker-image workflow to finish..."
sleep 30
fi
done
if [[ "$CONCLUSION" != "success" ]]
then
echo "build-docker-image workflow failed"
exit 1
fi
- name: Download Orion docker image
uses: dawidd6/action-download-artifact@v2
with:
commit: ${{ env.SHA }}
name: joystream-orion-docker-${{ env.SHA }}
workflow: build-docker-image.yml
- name: Load Orion docker image
run: docker load -i orion.tar.gz
- name: Fetch integration tests branch from PR comment if provided
if: github.event_name == 'pull_request_target'
run: |
BRANCH=$(
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
| jq -r '
[.[]
| select(
(.author_association = "OWNER") or
(.author_association = "MEMBER") or
(.author_association = "CONTRIBUTOR")
)
| select (.body | test("/set-integration-tests-branch +"))
| .body
][-1]' \
| cut -d ' ' -f 2
)
echo "INTEGRATION_TESTS_BRANCH=$BRANCH" >> $GITHUB_ENV
- name: Check-out the integration tests branch
uses: actions/checkout@v3
with:
repository: ${{ vars.INTEGRATION_TESTS_REPO }}
ref: ${{ env.INTEGRATION_TESTS_BRANCH }}
- name: Get SHA of the checked-out commit
run: |
SHA=$(git rev-parse HEAD)
echo "INTEGRATION_TESTS_COMMIT=$SHA" >> $GITHUB_ENV
- name: Download Joystream node docker image
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{ secrets.INTEGRATION_TESTS_TOKEN }}
commit: ${{ env.INTEGRATION_TESTS_COMMIT }}
name_is_regexp: true
name: '[0-9a-f]+-joystream-node-docker-image.tar.gz'
repo: ${{ vars.INTEGRATION_TESTS_REPO }}
workflow: run-network-tests.yml
- name: Load Joystream node docker image
run: |
DOCKER_IMAGE_DIR=$(ls | grep joystream-node-docker-image.tar.gz)
JOYSTREAM_RUNTIME_SHA=$(echo $DOCKER_IMAGE_DIR | cut -d '-' -f1)
docker load -i "$DOCKER_IMAGE_DIR/joystream-node-docker-image.tar.gz"
echo "JOYSTREAM_RUNTIME_SHA=$JOYSTREAM_RUNTIME_SHA" >> $GITHUB_ENV
- name: Install packages and dependencies
run: yarn build:packages
- name: Ensure tests are runnable
run: yarn workspace network-tests build
- name: Execute network tests
id: execute_network_tests
run: |
export RUNTIME=$JOYSTREAM_RUNTIME_SHA
export SKIP_QUERY_NODE_CHECKS=true
./tests/network-tests/run-tests.sh orion