git.delta.rocks / unique-network / refs/commits / 300cebfbe22b

difftreelog

source

.github/workflows/build-test-master.yml4.4 KiBsourcehistory
1name: MASTER - Build & Test23# Controls when the action will run.4on:5 # Triggers the workflow on push or pull request events but only for the master branch6  pull_request:7    branches:8      - master9    types:10      - opened11      - reopened12      - synchronize #commit(s) pushed to the pull request13      - ready_for_review1415  # Allows you to run this workflow manually from the Actions tab16  workflow_dispatch:1718#Define Workflow variables19env:20  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2122# A workflow run is made up of one or more jobs that can run sequentially or in parallel23jobs:2425  master-build-and-test:26    # The type of runner that the job will run on27    runs-on: self-hosted-ci282930    name: ${{ matrix.network }} - Build and Test3132    continue-on-error: true         #Do not stop testing of matrix runs failed.3334    strategy:35      matrix:36        include:37          - network: "Opal"38            features: "opal-runtime"39          - network: "Quartz"40            features: "quartz-runtime"41          - network: "Unique"42            features: "unique-runtime"4344    steps:45      - name: Skip if pull request is in Draft46        # `if: github.event.pull_request.draft == true` should be kept here, at47        # the step level, rather than at the job level. The latter is not48        # recommended because when the PR is moved from "Draft" to "Ready to49        # review" the workflow will immediately be passing (since it was skipped),50        # even though it hasn't actually ran, since it takes a few seconds for51        # the workflow to start. This is also disclosed in:52        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1753        # That scenario would open an opportunity for the check to be bypassed:54        # 1. Get your PR approved55        # 2. Move it to Draft56        # 3. Push whatever commits you want57        # 4. Move it to "Ready for review"; now the workflow is passing (it was58        #    skipped) and "Check reviews" is also passing (it won't be updated59        #    until the workflow is finished)60        if: github.event.pull_request.draft == true61        run: exit 16263      - name: Clean Workspace64        uses: AutoModality/action-clean@v1.1.06566      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it67      - uses: actions/checkout@v368        with:69          ref: ${{ github.head_ref }}7071      - name: Read .env file72        uses: xom9ikk/dotenv@v1.0.27374      - name: Generate ENV related extend file for docker-compose75        uses: cuchi/jinja2-action@v1.2.076        with:77          template: .docker/docker-compose.tmp-master.j278          output_file: .docker/docker-compose.${{ matrix.network }}.yml79          variables: |80            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git81            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}82            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}83            FEATURE=${{ matrix.features }}84            BRANCH=${{ github.head_ref }}8586      - name: Show build configuration87        run: cat .docker/docker-compose.${{ matrix.network }}.yml8889      - name: Build the stack90        run: docker-compose -f ".docker/docker-compose-master.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build9192      - uses: actions/setup-node@v393        with:94          node-version: 169596      - name: Run tests97        run: |98          cd tests99          yarn install100          yarn add mochawesome101          echo "Ready to start tests"102          node scripts/readyness.js103          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}104        env:105          RPC_URL: http://127.0.0.1:9933/106107      - name: Test Report108        uses: phoenix-actions/test-reporting@v8109        id: test-report110        if: success() || failure()    # run this step even if previous step failed111        with:112          name: Tests ${{ matrix.network }}            # Name of the check run which will be created113          path: tests/mochawesome-report/test-*.json    # Path to test results114          reporter: mochawesome-json115          fail-on-error: 'false'116117      - name: Read output variables118        run: |119          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"120121      - name: Stop running containers122        if: always()                   # run this step always123        run: docker-compose -f ".docker/docker-compose-master.yml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down