git.delta.rocks / unique-network / refs/commits / b1ec0e65b012

difftreelog

source

.github/workflows/node_build_test.yml4.4 KiBsourcehistory
1name: Develop - 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      - develop9    types:10      - opened11      - reopened12      - synchronize   #commit(s) pushed to the pull request1314  # Allows you to run this workflow manually from the Actions tab15  workflow_dispatch:1617#Define Workflow variables18env:19  REPO_URL: ${{ github.server_url }}/${{ github.repository }}2021# A workflow run is made up of one or more jobs that can run sequentially or in parallel22jobs:23  dev_build_test:24    # The type of runner that the job will run on25    runs-on: self-hosted-ci2627    name: Build Container, Spin it Up an test2829    continue-on-error: true         #Do not stop testing of matrix runs failed.  As it decided during PR review - it required 50/50& Let's check it with false.3031    strategy:32      matrix:33        include:34          - network: "Opal"35            features: "--features=opal-runtime"36          - network: "Quartz"37            features: "--features=quartz-runtime"38          - network: "Unique"39            features: "--features=unique-runtime"4041    steps:42      - name: Skip if pull request is in Draft43        # `if: github.event.pull_request.draft == true` should be kept here, at44        # the step level, rather than at the job level. The latter is not45        # recommended because when the PR is moved from "Draft" to "Ready to46        # review" the workflow will immediately be passing (since it was skipped),47        # even though it hasn't actually ran, since it takes a few seconds for48        # the workflow to start. This is also disclosed in:49        # https://github.community/t/dont-run-actions-on-draft-pull-requests/16817/1750        # That scenario would open an opportunity for the check to be bypassed:51        # 1. Get your PR approved52        # 2. Move it to Draft53        # 3. Push whatever commits you want54        # 4. Move it to "Ready for review"; now the workflow is passing (it was55        #    skipped) and "Check reviews" is also passing (it won't be updated56        #    until the workflow is finished)57        if: github.event.pull_request.draft == true58        run: exit 15960      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it61      - uses: actions/checkout@v362        with:63          ref: ${{ github.head_ref }}  #Checking out head commit6465      - name: Read .env file66        uses: xom9ikk/dotenv@v1.0.26768      - name: Generate ENV related extend file for docker-compose69        uses: cuchi/jinja2-action@v1.2.070        with:71          template: .docker/docker-compose.tmp.j272          output_file: .docker/docker-compose.${{ matrix.network }}.yml73          variables: |74            REPO_URL=${{ github.server_url }}/${{ github.repository }}.git75            RUST_TOOLCHAIN=${{ env.RUST_TOOLCHAIN }}76            POLKADOT_BUILD_BRANCH=${{ env.POLKADOT_BUILD_BRANCH }}77            FEATURE='${{ matrix.features }}'78            BRANCH=${{ github.head_ref }}7980      - name: Show build configuration81        run: cat .docker/docker-compose.${{ matrix.network }}.yml8283      - name: Build the stack84        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" up -d --build8586      - uses: actions/setup-node@v387        with:88          node-version: 168990      - name: Run tests91        run: |92          cd tests93          yarn install94          yarn add mochawesome95          echo "Ready to start tests"96          node scripts/readyness.js97          NOW=$(date +%s) && yarn test --reporter mochawesome --reporter-options reportFilename=test-${NOW}98        env:99          RPC_URL: http://127.0.0.1:9933/100101      - name: Test Report102        uses: phoenix-actions/test-reporting@v8103        if: success() || failure()    # run this step even if previous step failed104        with:105          name: Tests ${{ matrix.network }}            # Name of the check run which will be created106          path: tests/mochawesome-report/test-*.json    # Path to test results107          reporter: mochawesome-json108          fail-on-error: 'false'109110      - name: Read output variables111        run: |112          echo "url is ${{ steps.test-report.outputs.runHtmlUrl }}"113114      - name: Stop running containers115        if: always()                   # run this step always116        run: docker-compose -f ".docker/docker-compose-dev.yaml" -f ".docker/docker-compose.${{ matrix.network }}.yml" down