Skip to content

Commit 9adcb1f

Browse files
authored
Merge pull request #7 from CCPBioSim/ci-update
Update build.yaml
2 parents eb908aa + bc0dbc3 commit 9adcb1f

3 files changed

Lines changed: 45 additions & 17 deletions

File tree

.github/workflows/build.yaml

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,19 @@ jobs:
1313
matrix:
1414
platform:
1515
- linux/amd64
16-
#- linux/arm64
16+
# - linux/arm64
1717
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
1818
name: build ${{ matrix.platform }}
1919
outputs:
2020
tag: ${{ steps.envvars.outputs.tag }}
2121
steps:
22+
23+
- name: "node-cleanup"
24+
run: |
25+
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache/CodeQL
26+
sudo docker image prune --all --force
27+
sudo docker builder prune -a
28+
2229
- name: checkout
2330
uses: actions/checkout@v5.0.0
2431

@@ -39,19 +46,39 @@ jobs:
3946
with:
4047
images: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
4148

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+
if: github.event_name == 'pull_request'
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=docker,push-by-digest=true,name-canonical=true,push=true
62+
63+
- name: Run tests
64+
if: github.event_name == 'pull_request'
65+
shell: bash
66+
run: |
67+
docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}:latest bash -c " \
68+
pip install pytest nbmake; \
69+
find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
70+
4271
- name: Authenticate with GHCR
72+
if: github.event_name != 'pull_request'
4373
id: auth
4474
uses: docker/login-action@v3.6.0
4575
with:
4676
registry: ghcr.io
4777
username: ${{ github.repository_owner }}
4878
password: ${{ secrets.BUILD_TOKEN }}
4979

50-
- name: Set up Docker Buildx
51-
id: buildx
52-
uses: docker/setup-buildx-action@v3.11.1
53-
5480
- name: Build and push by digest
81+
if: github.event_name != 'pull_request'
5582
id: build
5683
uses: docker/build-push-action@v6.18.0
5784
with:
@@ -61,20 +88,23 @@ jobs:
6188
tags: ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}
6289
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
6390

64-
#- name: Test notebooks
65-
# shell: bash
66-
# run: |
67-
# docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
68-
# pip install pytest nbmake; \
69-
# find ./notebooks -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600;"
91+
- name: Run tests
92+
if: github.event_name != 'pull_request'
93+
shell: bash
94+
run: |
95+
docker run -t ghcr.io/${{ vars.ORG_REPO }}/${{ github.event.repository.name }}@${{ steps.build.outputs.digest }} bash -c " \
96+
pip install pytest nbmake; \
97+
find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
7098
7199
- name: Export digest
100+
if: github.event_name != 'pull_request'
72101
run: |
73102
mkdir -p ${{ runner.temp }}/digests
74103
digest="${{ steps.build.outputs.digest }}"
75104
touch "${{ runner.temp }}/digests/${digest#sha256:}"
76105
77106
- name: Upload digest
107+
if: github.event_name != 'pull_request'
78108
uses: actions/upload-artifact@v5.0.0
79109
with:
80110
name: digests-${{ env.PLATFORM_PAIR }}

Setup_DNA-simulation.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -634,9 +634,9 @@
634634
"metadata": {
635635
"anaconda-cloud": {},
636636
"kernelspec": {
637-
"display_name": "htmd",
637+
"display_name": "Python 3 (ipykernel)",
638638
"language": "python",
639-
"name": "htmd"
639+
"name": "python3"
640640
},
641641
"language_info": {
642642
"codemirror_mode": {

docker/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ RUN conda install -c acellera -c conda-forge ambertools htmd matplotlib mdtraj n
1313

1414
# Get workshop files and move them to jovyan directory.
1515
COPY --chown=1000:100 . .
16-
RUN rm -rf requirements.txt LICENSE README.md docker .git .github
16+
RUN rm -rf requirements.txt LICENSE README.md docker .git .github tested_files
1717

1818
RUN wget https://www.hecbiosim.ac.uk/file-store/tw2025-dna-workshop/01_Prod-0.nc && \
19-
wget https://www.hecbiosim.ac.uk/file-store/tw2025-dna-workshop/01_Prod-2.nc && \
20-
cp 01_Prod-0.nc data/ && \
21-
mv 01_Prod-0.nc 01_Prod-2.nc tested_files/
19+
mv 01_Prod-0.nc data/
2220

2321
# Copy updated lab workspace
2422
COPY --chown=1000:100 docker/default-37a8.jupyterlab-workspace /home/jovyan/.jupyter/lab/workspaces/default-37a8.jupyterlab-workspace

0 commit comments

Comments
 (0)