Skip to content

Commit c310bda

Browse files
committed
migrate CI workflow to repo
1 parent fdec5b9 commit c310bda

6 files changed

Lines changed: 256 additions & 2 deletions

File tree

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
# Check for updates to GitHub Actions every day
12+
interval: "daily"
13+
time: "09:00"
14+
timezone: "UTC"
15+
assignees:
16+
- "jimboid"

.github/workflows/build.yaml

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: ci/cd
2+
on:
3+
pull_request:
4+
repository_dispatch:
5+
types: [build]
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
platform:
14+
- linux/amd64
15+
- linux/arm64
16+
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
17+
name: build ${{ matrix.platform }}
18+
outputs:
19+
tag: ${{ steps.envvars.outputs.tag }}
20+
steps:
21+
- name: checkout
22+
uses: actions/checkout@v5.0.0
23+
24+
- name: Prepare env
25+
id: envvars
26+
run: |
27+
platform=${{ matrix.platform }}
28+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
29+
if [ ${{ github.event.client_payload.tag }} != 'null' ]; then
30+
echo "tag=${{ github.event.client_payload.tag }}" >> $GITHUB_OUTPUT
31+
else
32+
echo "tag=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT
33+
fi
34+
35+
- name: Metadata
36+
id: meta
37+
uses: docker/metadata-action@v5.8.0
38+
with:
39+
images: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
40+
41+
- name: Authenticate with GHCR
42+
id: auth
43+
uses: docker/login-action@v3.5.0
44+
with:
45+
registry: ghcr.io
46+
username: ${{github.actor}}
47+
password: ${{secrets.BUILD_TOKEN}}
48+
49+
- name: Set up Docker Buildx
50+
id: buildx
51+
uses: docker/setup-buildx-action@v3.11.1
52+
53+
- name: Build and push by digest
54+
id: build
55+
uses: docker/build-push-action@v6.18.0
56+
with:
57+
file: ./docker/Dockerfile
58+
platforms: ${{ matrix.platform }}
59+
labels: ${{ steps.meta.outputs.labels }}
60+
tags: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
61+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
62+
63+
- name: Export digest
64+
run: |
65+
mkdir -p ${{ runner.temp }}/digests
66+
digest="${{ steps.build.outputs.digest }}"
67+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
68+
69+
- name: Upload digest
70+
uses: actions/upload-artifact@v4.6.2
71+
with:
72+
name: digests-${{ env.PLATFORM_PAIR }}
73+
path: ${{ runner.temp }}/digests/*
74+
if-no-files-found: error
75+
retention-days: 1
76+
77+
merge:
78+
runs-on: ubuntu-24.04
79+
name: merge into multiarch manifest
80+
needs:
81+
- build
82+
steps:
83+
- name: Download digests
84+
uses: actions/download-artifact@v5.0.0
85+
with:
86+
path: ${{ runner.temp }}/digests
87+
pattern: digests-*
88+
merge-multiple: true
89+
90+
- name: Authenticate with GHCR
91+
id: auth
92+
uses: docker/login-action@v3.5.0
93+
with:
94+
registry: ghcr.io
95+
username: ${{github.actor}}
96+
password: ${{secrets.BUILD_TOKEN}}
97+
98+
- name: Set up Docker Buildx
99+
id: buildx
100+
uses: docker/setup-buildx-action@v3.11.1
101+
102+
- name: Metadata
103+
id: meta
104+
uses: docker/metadata-action@v5.8.0
105+
with:
106+
images: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
107+
tags: dev
108+
109+
- name: Create manifest list and push
110+
id: annotate
111+
continue-on-error: true
112+
working-directory: ${{ runner.temp }}/digests
113+
run: |
114+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
115+
--annotation='index:org.opencontainers.image.description=${{ github.event.repository.description }}' \
116+
--annotation='index:org.opencontainers.image.licenses=MIT' \
117+
--annotation='index:org.opencontainers.image.created=${{ steps.timestamp.outputs.timestamp }}' \
118+
--annotation='index:org.opencontainers.image.url=${{ github.event.repository.url }}' \
119+
--annotation='index:org.opencontainers.image.source=${{ github.event.repository.url }}' \
120+
$(printf 'ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@sha256:%s ' *)
121+
122+
- name: Create manifest list and push without annotations
123+
if: steps.annotate.outcome == 'failure'
124+
working-directory: ${{ runner.temp }}/digests
125+
run: |
126+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
127+
$(printf 'ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@sha256:%s ' *)
128+
129+
- name: Inspect image
130+
run: |
131+
docker buildx imagetools inspect ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:dev
132+
133+
tests:
134+
strategy:
135+
fail-fast: false
136+
matrix:
137+
platform:
138+
- linux/amd64
139+
- linux/arm64
140+
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
141+
name: testing on ${{ matrix.platform }}
142+
timeout-minutes: 360
143+
needs:
144+
- build
145+
- merge
146+
steps:
147+
148+
- name: Test notebooks
149+
shell: bash
150+
run: |
151+
docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:dev bash -c " \
152+
pip install pytest nbmake; \
153+
find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;"
154+
155+
tags:
156+
runs-on: ubuntu-24.04
157+
if: github.event_name != 'pull_request'
158+
name: add tags
159+
needs:
160+
- build
161+
- tests
162+
steps:
163+
- name: Authenticate with GHCR
164+
id: auth
165+
uses: docker/login-action@v3.5.0
166+
with:
167+
registry: "ghcr.io"
168+
username: ${{github.actor}}
169+
password: ${{secrets.BUILD_TOKEN}}
170+
171+
- name: tag release versions
172+
shell: bash
173+
run: |
174+
docker buildx imagetools create \
175+
--tag ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest \
176+
--tag ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:${{ needs.build.outputs.tag }} \
177+
ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:dev
178+
179+
- name: Post version update to dash
180+
uses: peter-evans/repository-dispatch@v3.0.0
181+
with:
182+
token: ${{ secrets.BUILD_TOKEN }}
183+
repository: jimboid/biosim-workshops-dash
184+
event-type: build
185+
client-payload: '{"repo": "${{ github.event.repository.name }}", "tag": "${{ needs.build.outputs.tag }}"}'

README.md

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# docking-workflow
1+
# CCPBioSim Docking Workshop
2+
3+
[![build](https://github.com/ccpbiosim/docking-workshop/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/ccpbiosim/docking-workshop/actions/workflows/build.yaml)
24

35
This is a repository for a set of Jupyter notebooks to create a workflow for docking ligands to multiple protein receptors and analysing the results.
46

@@ -10,10 +12,27 @@ Dependencies:
1012
5. OpenBabel with Python bindings
1113
6. OpenDrugDiscovery
1214

13-
If you are using the prepared virtual machine, all the requirements are installed except ChimeraX.
15+
If you are using the prepared docker container, all the requirements are installed except ChimeraX.
1416

1517
To install ChimeraX, go to https://www.rbvi.ucsf.edu/chimerax/download.html and download the correct version for your operating system (you will need to click on other releases to find the linux version) and follow the instructions in the notes column on the website. This is for personal non-commercial use.
1618

1719
If results are published, please cite all of the software that you used.
1820
https://vina.scripps.edu/manual/#citation
1921
https://www.rbvi.ucsf.edu/chimerax/docs/credits.html
22+
23+
## Docker
24+
25+
This container is derived from the CCPBioSim JupyterHub image. This container
26+
adds the necessary software packages and notebook content to form a deployable
27+
course container. The source content for this course can be found at
28+
https://github.com/CCPBioSim/docking-workflow
29+
30+
## How to Use
31+
32+
In our containers we are using the JupyterHub default port 8888, so you should
33+
forward this port when deploying locally::
34+
35+
docker run -p 8888:8888 ghcr.io/jimboid/biosim-docking-workshop:latest
36+
37+
38+

docker/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Start with BioSim base image.
2+
ARG BASE_IMAGE=latest
3+
FROM ghcr.io/ccpbiosim/jupyterhub-base:$BASE_IMAGE
4+
5+
LABEL maintainer="James Gebbie-Rayet <james.gebbie@stfc.ac.uk>"
6+
LABEL org.opencontainers.image.source=https://github.com/ccpbiosim/docking-workshop
7+
LABEL org.opencontainers.image.description="A container environment for the ccpbiosim workshop on docking."
8+
LABEL org.opencontainers.image.licenses=MIT
9+
10+
ARG TARGETPLATFORM
11+
12+
# Switch to jovyan user.
13+
USER $NB_USER
14+
WORKDIR $HOME
15+
16+
# Install workshop deps
17+
RUN conda install oddt::oddt -y
18+
RUN conda install termcolor matplotlib seaborn pandas openbabel vina
19+
20+
# Get workshop files and move them to jovyan directory.
21+
COPY --chown=1000:100 . .
22+
RUN rm -r chimerax_commands.cxc LICENSE README.md docking_with_rescoring docker .git .github
23+
24+
# Copy lab workspace
25+
COPY --chown=1000:100 docker/default-37a8.jupyterlab-workspace /home/jovyan/.jupyter/lab/workspaces/default-37a8.jupyterlab-workspace
26+
27+
# UNCOMMENT THIS LINE FOR REMOTE DEPLOYMENT
28+
COPY docker/jupyter_notebook_config.py /etc/jupyter/
29+
30+
# Always finish with non-root user as a precaution.
31+
USER $NB_USER
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"data":{"layout-restorer:data":{"main":{"dock":{"type":"tab-area","currentIndex":0,"widgets":["notebook:simple_docking/MTH_Docking_Part1_Prepare_2.0.ipynb"]},"current":"notebook:simple_docking/MTH_Docking_Part1_Prepare_2.0.ipynb"},"left":{"collapsed":false,"current":"filebrowser","widgets":["filebrowser","running-sessions","@jupyterlab/toc:plugin","extensionmanager.main-view"]},"right":{"collapsed":true,"widgets":["jp-property-inspector"]}},"notebook:simple_docking/MTH_Docking_Part1_Prepare_2.0.ipynb":{"data":{"path":"simple_docking/MTH_Docking_Part1_Prepare_2.0.ipynb","factory":"Notebook"}}},"metadata":{"id":"default"}}

docker/jupyter_notebook_config.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
c.JupyterHub.authenticator_class = 'tmpauthenticator.TmpAuthenticator'

0 commit comments

Comments
 (0)