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