|
2 | 2 | name: Build |
3 | 3 |
|
4 | 4 | on: |
| 5 | + repository_dispatch: |
| 6 | + types: [run_test_suite] |
5 | 7 | push: |
6 | 8 | pull_request: |
7 | 9 | schedule: |
|
10 | 12 | jobs: |
11 | 13 | build: |
12 | 14 | runs-on: ubuntu-latest |
| 15 | + env: |
| 16 | + ms_suite: omero-ms-zarr-suite |
| 17 | + bf_suite: ome-zarr-bf2raw-suite |
| 18 | + zarr_suite: ome-zarr-py-suite |
13 | 19 | steps: |
14 | | - |
15 | 20 | - uses: actions/checkout@v2 |
16 | | - |
17 | 21 | - name: Setup miniconda |
18 | 22 | uses: conda-incubator/setup-miniconda@v2 |
19 | 23 | with: |
20 | 24 | auto-update-conda: true |
21 | 25 | channels: conda-forge,ome |
22 | 26 | environment-file: environment.yml |
23 | 27 | python-version: 3.9 |
| 28 | + - name: Set testing environment |
| 29 | + if: github.event.action == 'run_test_suite' |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + # Set the parameters to be used in the response |
| 33 | + repo=${{ github.event.client_payload.repo }} |
| 34 | + owner=${{ github.event.client_payload.owner }} |
| 35 | + ref=${{ github.event.client_payload.ref }} |
| 36 | + sha=${{ github.event.client_payload.sha }} |
| 37 | + number=${{ github.event.client_payload.number }} |
| 38 | + repo_name=${repo#"$owner"} |
| 39 | + repo_name=${repo_name#"/"} |
| 40 | + echo "client_repo="$repo >> $GITHUB_ENV |
| 41 | + echo "client_repo_name="$repo_name >> $GITHUB_ENV |
| 42 | + echo "client_owner="$owner >> $GITHUB_ENV |
| 43 | + echo "client_ref="$ref >> $GITHUB_ENV |
| 44 | + echo "client_sha="$sha >> $GITHUB_ENV |
| 45 | + echo "client_number="$number >> $GITHUB_ENV |
24 | 46 |
|
| 47 | + # Checkout the sha from the specified repository. |
| 48 | + # Only run the tests matching the specified repository. |
| 49 | + if [[ $repo =~ 'omero-ms-zarr' ]]; then |
| 50 | + git clone git://github.com/$repo ${{env.ms_suite}} |
| 51 | + cd ${{env.ms_suite}} |
| 52 | + git checkout ${{ github.event.client_payload.sha }} |
| 53 | + cd .. |
| 54 | + python configure_test.py omero_ms_zarr |
| 55 | + elif [[ $repo =~ 'bioformats2raw' ]]; then |
| 56 | + git clone git://github.com/$repo ${{env.bf_suite}} |
| 57 | + cd ${{env.bf_suite}} |
| 58 | + git checkout ${{ github.event.client_payload.sha }} |
| 59 | + cd .. |
| 60 | + python configure_test.py bioformats2raw |
| 61 | + elif [[ $repo =~ 'ome-zarr-py' ]]; then |
| 62 | + conda activate test |
| 63 | + git clone git://github.com/$repo ${{env.zarr_suite}} |
| 64 | + cd ${{env.zarr_suite}} |
| 65 | + git checkout ${{ github.event.client_payload.sha }} |
| 66 | + pip install -e . |
| 67 | + cd .. |
| 68 | + conda deactivate |
| 69 | + python configure_test.py ome_zarr |
| 70 | + fi |
25 | 71 | - name: Run pytest |
26 | 72 | shell: bash -l {0} |
27 | 73 | run: pytest -vxk "not omero" |
| 74 | + # yamllint disable rule:line-length |
| 75 | + - name: Notify job status on PR |
| 76 | + if: always() && github.event.action == 'run_test_suite' |
| 77 | + uses: actions/github-script@v3 |
| 78 | + with: |
| 79 | + github-token: ${{secrets.API_TOKEN_GITHUB}} |
| 80 | + script: | |
| 81 | + github.issues.createComment({ |
| 82 | + issue_number: "${{env.client_number}}", |
| 83 | + owner: "${{env.client_owner}}", |
| 84 | + repo: "${{env.client_repo_name}}", |
| 85 | + body: 'https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}: ${{ job.status }}' |
| 86 | + }) |
| 87 | + - name: Create issue |
| 88 | + if: failure() && github.event.action == 'run_test_suite' |
| 89 | + run: | |
| 90 | + curl -X "POST" "https://api.github.com/repos/ome/${{env.client_repo_name}}/issues?state=all" \ |
| 91 | + -H "Cookie: logged_in=no" \ |
| 92 | + -H "Authorization: token ${{secrets.API_TOKEN_GITHUB}}" \ |
| 93 | + -H "Content-Type: text/plain; charset=utf-8" \ |
| 94 | + -d $'{ |
| 95 | + "title": "Test suite failure for PR #${{env.client_number}}", |
| 96 | + "body": "Test suite status: ${{ job.status }} see https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}", |
| 97 | + "labels": [ |
| 98 | + "bug" |
| 99 | + ] |
| 100 | + }' |
0 commit comments