|
| 1 | +name: Run tests |
| 2 | + |
| 3 | +on: |
| 4 | + # Triggers the workflow on pull request events but only for the master branch |
| 5 | + pull_request: |
| 6 | + branches: [ master ] |
| 7 | + push: |
| 8 | + branches: [ master ] |
| 9 | + |
| 10 | + # Allows you to run this workflow manually from the Actions tab |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +env: |
| 14 | + SUITE_REPO: "NilFoundation/crypto3" |
| 15 | + LIB_NAME: "blueprint" |
| 16 | + CACHE_NAME: "blueprint-job-cache" |
| 17 | + TESTS_ARTIFACT_NAME: "test-results-mac" |
| 18 | + |
| 19 | +jobs: |
| 20 | + handle-syncwith: |
| 21 | + if: github.event_name == 'pull_request' |
| 22 | + name: Call Reusable SyncWith Handler |
| 23 | + uses: NilFoundation/ci-cd/.github/workflows/reusable-handle-syncwith.yml@v1 |
| 24 | + with: |
| 25 | + ci-cd-ref: 'v1' |
| 26 | + secrets: inherit |
| 27 | + |
| 28 | + build-and-test: |
| 29 | + needs: [ handle-syncwith ] |
| 30 | + name: "Build and test macOS" |
| 31 | + runs-on: [macos-14] |
| 32 | + strategy: |
| 33 | + fail-fast: false |
| 34 | + steps: |
| 35 | + # https://github.com/actions/checkout/issues/1552 |
| 36 | + - name: Clean up after previous checkout |
| 37 | + run: chmod +w -R ${GITHUB_WORKSPACE}; rm -rf ${GITHUB_WORKSPACE}/*; |
| 38 | + |
| 39 | + - name: Checkout Blueprint |
| 40 | + uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + fetch-depth: 0 |
| 43 | + submodules: recursive |
| 44 | + |
| 45 | + - name: Checkout submodules to specified refs |
| 46 | + if: inputs.submodules-refs != '' |
| 47 | + uses: NilFoundation/ci-cd/actions/recursive-checkout@v1.2.1 |
| 48 | + with: |
| 49 | + refs: ${{ inputs.submodules-refs }} |
| 50 | + paths: | |
| 51 | + ${{ github.workspace }}/** |
| 52 | + !${{ github.workspace }}/ |
| 53 | + !${{ github.workspace }}/**/.git/** |
| 54 | + |
| 55 | + # nix is taken from the cloud-init template, no need to install it. |
| 56 | + - name: Build and run tests |
| 57 | + run: | |
| 58 | + nix build -L .?submodules=1#checks.aarch64-darwin.$check_name |
| 59 | + results_dir="./results" |
| 60 | + mkdir -p "$results_dir" |
| 61 | + cp -r ./result/* "$results_dir/all-checks" |
| 62 | + rm -rf result |
| 63 | + - name: Publish Test Results |
| 64 | + uses: EnricoMi/publish-unit-test-result-action/linux@v2 |
| 65 | + with: |
| 66 | + check_name: "Mac Test Results" |
| 67 | + files: "results/**/*.xml" |
| 68 | + comment_mode: ${{ github.event.pull_request.head.repo.fork && 'off' || 'always' }} # Don't create PR comment from fork runs |
| 69 | + action_fail_on_inconclusive: true # fail, if no reports |
| 70 | + action_fail: true |
| 71 | + - name: 'Upload Artifacts' |
| 72 | + uses: actions/upload-artifact@v4 |
| 73 | + with: |
| 74 | + name: junit-test-results |
| 75 | + path: "results/**/*.xml" |
| 76 | + retention-days: 5 |
| 77 | + if-no-files-found: error |
| 78 | + overwrite: true |
0 commit comments