1+ name : Build and push DEV images to ghcr and run pytest on the images
2+
3+ on :
4+ # NOTE: for a release build of the images, see release.yaml.
5+ # The workflow_dispatch can be used for dev images
6+ # images are tagged with "latest-dev" and the commit hash
7+ # This workflow builds and publishes the images before running the tests
8+ # so you don't have to wait to put them on the dev cluster
9+ # For the release builds, we run tests before building the images.
10+ workflow_dispatch :
11+
12+ jobs :
13+ push-to-container-registry :
14+ if : github.repository == 'ScilifelabDataCentre/divbase'
15+ name : Build and push DEV images to ghcr
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : read
19+ packages : write
20+
21+ strategy :
22+ matrix :
23+ include :
24+ - dockerfile : fastapi.dockerfile
25+ image_name : divbase-fastapi
26+ - dockerfile : worker.dockerfile
27+ image_name : divbase-worker
28+
29+ steps :
30+ - name : Check out the repo
31+ uses : actions/checkout@v6
32+
33+ - name : Login to GitHub Container Registry
34+ uses : docker/login-action@v4
35+ with :
36+ registry : ghcr.io
37+ username : ${{ github.actor }}
38+ password : ${{ secrets.GITHUB_TOKEN }}
39+
40+ - name : Build and push Docker image
41+ uses : docker/build-push-action@v6
42+ with :
43+ push : true
44+ context : .
45+ file : ./docker/${{ matrix.dockerfile }}
46+ tags : |
47+ ghcr.io/scilifelabdatacentre/${{ matrix.image_name }}:${{ github.sha }}
48+ ghcr.io/scilifelabdatacentre/${{ matrix.image_name }}:latest-dev
49+
50+ run-pytest-on-newly-built-images :
51+ name : Run pytest on the newly built DEV images
52+ needs : push-to-container-registry
53+ runs-on : ubuntu-latest
54+ steps :
55+ - name : Check out the repo
56+ uses : actions/checkout@v6
57+
58+ - name : Install bcftools # some test set up data calling bcftools directly
59+ run : |
60+ sudo apt-get update
61+ sudo apt-get install autoconf automake make gcc perl zlib1g-dev libbz2-dev liblzma-dev libcurl4-gnutls-dev libssl-dev libperl-dev libgsl0-dev
62+ git clone --recurse-submodules https://github.com/samtools/htslib.git
63+ git clone https://github.com/samtools/bcftools.git
64+ cd bcftools
65+ make
66+ sudo make install
67+
68+ - name : Install uv
69+ uses : astral-sh/setup-uv@v7
70+ with :
71+ version : " 0.9.15"
72+ enable-cache : true
73+
74+ - name : Install the project
75+ run : |
76+ uv sync --locked --dev
77+ uv run playwright install chromium
78+
79+ - name : Pull new images built in the previous workflow run
80+ run : |
81+ docker pull ghcr.io/scilifelabdatacentre/divbase-fastapi:${{ github.sha }}
82+ docker pull ghcr.io/scilifelabdatacentre/divbase-worker:${{ github.sha }}
83+
84+ - name : Allow container to write to test fixtures # actions runner uid=1001, but container runs as 1000
85+ # So container does not have permissions to write to the mounted test fixtures, required by test_bcftools_pipe_cli_integration_with_eager_mode
86+ # volume mount made in docker/divbase_compose.tests.yaml
87+ run : chmod -R a+w tests/fixtures
88+
89+ - name : Run pytest including slow tests
90+ env :
91+ GITHUB_ACTIONS_RUNNER : " true"
92+ DIVBASE_FASTAPI_IMAGE : ghcr.io/scilifelabdatacentre/divbase-fastapi:${{ github.sha }}
93+ DIVBASE_WORKER_IMAGE : ghcr.io/scilifelabdatacentre/divbase-worker:${{ github.sha }}
94+ # use of env vars is to make click/typer think it is running in a terminal
95+ run : FORCE_TERMINAL=1 COLUMNS=1000 uv run pytest --run-slow
0 commit comments