Skip to content

Commit f654a97

Browse files
authored
Merge pull request #79 from ScilifelabDataCentre/gh-actions-release-strat
One GH action for making a new release
2 parents e066525 + 1d6e035 commit f654a97

14 files changed

Lines changed: 288 additions & 191 deletions

File tree

.github/workflows/publish-to-pypi.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/publish-to-test-pypi.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish divbase-lib and divbase-cli packages to Test PyPI
22
on:
33
workflow_dispatch:
4-
4+
55
jobs:
66
build-divbase-lib-and-cli:
77
uses: ./.github/workflows/build-pypi-packages.yaml
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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

.github/workflows/publish_docs.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Build and deploy the divbase documentation website
22
on:
3-
release:
4-
types: [published]
3+
# NOTE: A new release will auto publish a new version of the docs, see release.yaml.
54
workflow_dispatch:
65

76
permissions:
@@ -23,11 +22,5 @@ jobs:
2322
- name: Install the project
2423
run: uv sync --locked --dev
2524

26-
- name: Cache mkdocs deps
27-
uses: actions/cache@v5
28-
with:
29-
key: ${{ github.ref }}
30-
path: .cache
31-
3225
- name: Deploy documentation
3326
run: uv run mkdocs gh-deploy --force

.github/workflows/publish_images.yaml

Lines changed: 0 additions & 64 deletions
This file was deleted.

.github/workflows/pytest-on-image-build.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)