123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- name: run-network-tests-pull-request
- on:
- pull_request:
- types: [labeled, synchronize]
- jobs:
- prepare_artifacts:
- name: Prepare joystream/node docker image
- if: contains(github.event.pull_request.labels.*.name, 'run-network-tests')
- runs-on: ubuntu-latest
- outputs:
- use_artifact: ${{ steps.final.outputs.artifact_name }}
- steps:
- - uses: actions/checkout@v1
- - uses: actions/setup-node@v1
- with:
- node-version: '12.x'
- - uses: technote-space/get-diff-action@v3
- with:
- PREFIX_FILTER: |
- node
- runtime-modules
- utils/chain-spec-builder
- SUFFIX_FILTER: |
- .rs
- 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 }}-joystream-node-docker-image.tar.gz
- if: env.GIT_DIFF
- - name: Build new joystream/node image
- run: |
- docker-compose build
- docker save --output joystream-node-docker-image.tar joystream/node
- gzip joystream-node-docker-image.tar
- echo "::set-env name=DO_UPLOAD::true"
- if: env.GIT_DIFF && ${{ failure() }}
- - name: Upload new joystream/node image
- uses: actions/upload-artifact@v2
- with:
- name: ${{ steps.compute_shasum.outputs.shasum }}-joystream-node-docker-image.tar.gz
- path: joystream-node-docker-image.tar.gz
- if: env.DO_UPLOAD
-
-
- - id: final
- name: Set final output
- run: echo "::set-output name=shasum::${{ steps.compute_shasum.outputs.shasum }}"
- if: env.GIT_DIFF
- network_tests_1:
- name: Network Integration Tests (pull request)
- needs: prepare_artifacts
- 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_artifacts.outputs.artifact_name }}
- if: ${{ needs.prepare_artifacts.outputs.artifact_name }}
- - name: Install artifact
- run: |
- docker load --input joystream-node-docker-image.tar.gz
- docker images
- if: ${{ needs.prepare_artifacts.outputs.artifact_name }}
- - name: Pull joystream/node image for base branch from Dockerhub
- continue-on-error: true
- 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_artifacts.outputs.artifact_name == null
-
-
-
- - name: Build joystream/node from source
- run: |
- if ! docker inspect joystream/node:latest > /dev/null 2>&1;
- then
- docker-compose build
- fi
- if: needs.prepare_docker_images.outputs.runtime_code_shasum == null
- - name: Install packages and dependencies
- run: yarn install --frozen-lockfile
- - name: Ensure tests are runnable
- run: yarn workspace network-tests build
- - name: Start chain
- run: docker-compose up -d
- - name: Execute network tests
- run: yarn workspace network-tests test
-
|