|
@@ -4,12 +4,12 @@ on:
|
|
|
types: [labeled, synchronize]
|
|
|
|
|
|
jobs:
|
|
|
- run_network_tests:
|
|
|
- name: Network Integration Tests (pull request)
|
|
|
+ prepare_docker_images:
|
|
|
+ name: Prepare joystream/node docker image
|
|
|
if: contains(github.event.pull_request.labels.*.name, 'run-network-tests')
|
|
|
runs-on: ubuntu-latest
|
|
|
- env:
|
|
|
- JOYSTREAM_NODE_TAG: ${{ github.event.pull_request.base.ref }}
|
|
|
+ outputs:
|
|
|
+ runtime_code_shasum: ${{ steps.compute_shasum.outputs.shasum }}
|
|
|
steps:
|
|
|
- uses: actions/checkout@v1
|
|
|
- uses: actions/setup-node@v1
|
|
@@ -26,17 +26,69 @@ jobs:
|
|
|
FILES: |
|
|
|
Cargo.lock
|
|
|
Cargo.toml
|
|
|
+
|
|
|
+ - id: compute_shasum
|
|
|
+ name: Compute runtime code shasum
|
|
|
+ run: |
|
|
|
+ export RUNTIME_CODE_SHASUM=`tar -c runtime runtime-modules utils/chain-spec-builder | shasum | cut -d " " -f 1`
|
|
|
+ echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
|
|
|
+ if: env.GIT_DIFF
|
|
|
+
|
|
|
+ - name: Check if we have a pre-built image
|
|
|
+ continue-on-error: true
|
|
|
+ uses: actions/download-artifact@v2
|
|
|
+ with:
|
|
|
+ name: ${{ steps.compute_shasum.outputs.shasum }}-test
|
|
|
+ if: env.GIT_DIFF
|
|
|
+
|
|
|
+ - name: Build new image (if fetching artifact failed)
|
|
|
+ run: |
|
|
|
+ echo "${{ steps.compute_shasum.outputs.shasum }}" > shasum.txt
|
|
|
+ if: env.GIT_DIFF && ${{ failure() }}
|
|
|
+
|
|
|
+ - name: Upload new image
|
|
|
+ uses: actions/upload-artifact@v2
|
|
|
+ with:
|
|
|
+ name: ${{ steps.compute_shasum.outputs.shasum }}-test
|
|
|
+ path: shasum.txt
|
|
|
+ if: env.GIT_DIFF && ${{ success()) }}
|
|
|
+
|
|
|
+ network_tests_1:
|
|
|
+ name: Network Integration Tests (pull request)
|
|
|
+ needs: prepare_docker_images
|
|
|
+ runs-on: ubuntu-latest
|
|
|
+ steps:
|
|
|
+ - uses: actions/checkout@v1
|
|
|
+ - uses: actions/setup-node@v1
|
|
|
+ with:
|
|
|
+ node-version: '12.x'
|
|
|
+
|
|
|
+ - name: Download Pre-built artifact
|
|
|
+ uses: actions/download-artifact@v2
|
|
|
+ with:
|
|
|
+ name: ${{ needs.prepare_docker_images.outputs.runtime_code_shasum }}-test
|
|
|
+ if: ${{ needs.prepare_docker_images.outputs.runtime_code_shasum }}
|
|
|
+
|
|
|
+ - name: Install artifact
|
|
|
+ run: cat shasum.txt
|
|
|
+ if: ${{ needs.prepare_docker_images.outputs.runtime_code_shasum }}
|
|
|
+
|
|
|
+ - name: Pull joystream/node image for base branch from Dockerhub
|
|
|
+ run: |
|
|
|
+ export JOYSTREAM_NODE_TAG=${{ github.event.pull_request.base.ref }}
|
|
|
+ docker-compose pull
|
|
|
+ docker image tag joystream/node:${JOYSTREAM_NODE_TAG} joystream/node:latest
|
|
|
+ if: ${{ needs.prepare_docker_images.outputs.runtime_code_shasum }} == ''
|
|
|
+
|
|
|
- name: Install packages and dependencies
|
|
|
run: yarn install --frozen-lockfile
|
|
|
+
|
|
|
- name: Ensure tests are runnable
|
|
|
run: yarn workspace network-tests build
|
|
|
- - name: Build joystream/node Docker image from source
|
|
|
- run: docker-compose build
|
|
|
- if: env.GIT_DIFF
|
|
|
- - name: Pull joystream/node image from Dockerhub
|
|
|
- run: docker-compose pull
|
|
|
- if: env.GIT_DIFF == ''
|
|
|
+
|
|
|
- name: Start chain
|
|
|
- run: docker-compose up -d
|
|
|
+ run: docker-compose up -d --no-build
|
|
|
+
|
|
|
- name: Execute network tests
|
|
|
run: yarn workspace network-tests test
|
|
|
+
|