Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 75 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
name: Build

on:
repository_dispatch:
types: [run_test_suite]
push:
pull_request:
schedule:
Expand All @@ -10,18 +12,89 @@ on:
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
Comment thread
jburel marked this conversation as resolved.
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"
]
}'
31 changes: 31 additions & 0 deletions configure_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import sys

import yaml

# Change the value of the skip flag depending on the repository used
# repository. Supported value:
# "bioformats2raw": do not skip the tests using bioformats2raw script
# "ome_zarr": do not skip the tests using ome-zarr-py
# "omero_ms_zarr": : do not skip the tests using omero-ms-zarr


def main() -> None:
argv = sys.argv[1:]
value = argv[0]
with open("sources.yml") as f:
doc = yaml.safe_load(f)
for k in doc:
k["skip"] = True
if "script" in k:
if k["script"].startswith(value):
k["skip"] = False
else:
if value == "ome_zarr":
k["skip"] = False

with open("sources.yml", "w") as f:
yaml.dump(doc, f, default_flow_style=False, sort_keys=False)


if __name__ == "__main__":
main()
6 changes: 3 additions & 3 deletions scripts/bioformats2raw_fake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -e
set -u
image_name=ome_zarr_suite_bf2raw
git clone git://github.com/glencoesoftware/bioformats2raw 1>&2
cd bioformats2raw
image_name=ome-zarr-suite-bf2raw
test -e $image_name || git clone git://github.com/glencoesoftware/bioformats2raw $image_name 1>&2
cd $image_name
docker build -t ${image_name} . 1>&2
cd ..
echo $PWD 1>&2
Expand Down
10 changes: 10 additions & 0 deletions sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,47 @@

- name: create
script: ome_zarr_create
skip: False

- name: localfake1
path: data/64x64-fake-v0.1/0
skip: False

- name: localfake2
path: data/64x64-fake-v0.2/0
skip: False

- name: localfake3
path: data/64x64-fake-v0.3/0
skip: False

- name: remotefake1
path: https://s3.embassy.ebi.ac.uk/idr/zarr/test-data/64x64-fake-v0.1/0
skip: False

- name: remotefake2
path: https://s3.embassy.ebi.ac.uk/idr/zarr/test-data/64x64-fake-v0.2/0
skip: False

- name: idr6001240
path: https://s3.embassy.ebi.ac.uk/idr/zarr/v0.1/6001240.zarr
skip: False

- name: bf2rawraw
script: bioformats2raw_fake
args:
- "--compression=raw"
- "--nested=true"
skip: False

- name: bf2rawcompressed
script: bioformats2raw_fake
args:
- "--compression=blosc"
- "--nested=true"
skip: False

- name: omeromszarr
script: omero_ms_zarr_fake
connection: http://localhost:8080/image/1.zarr/
skip: False