Skip to content

Commit 6ecdb39

Browse files
committed
simplify CI and add ability for PRs without releasing
1 parent 425fc1c commit 6ecdb39

3 files changed

Lines changed: 53 additions & 78 deletions

File tree

Lines changed: 52 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
name: build
2-
1+
name: ci/cd
32
on:
3+
pull_request:
44
repository_dispatch:
55
types: [build]
66
workflow_dispatch:
7-
inputs:
8-
tag:
9-
description: 'Base container version tag'
10-
required: true
11-
default: 'null'
127

138
jobs:
149
build:
@@ -19,7 +14,9 @@ jobs:
1914
- linux/amd64
2015
- linux/arm64
2116
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-24.04' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
22-
name: ${{ matrix.platform }} workshop-build
17+
name: build ${{ matrix.platform }}
18+
outputs:
19+
tag: ${{ steps.envvars.outputs.tag }}
2320
steps:
2421
- name: checkout
2522
uses: actions/checkout@v5.0.0
@@ -29,6 +26,11 @@ jobs:
2926
run: |
3027
platform=${{ matrix.platform }}
3128
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
3234
3335
- name: Metadata
3436
id: meta
@@ -73,6 +75,7 @@ jobs:
7375

7476
merge:
7577
runs-on: ubuntu-24.04
78+
name: merge into multiarch manifest
7679
needs:
7780
- build
7881
steps:
@@ -100,8 +103,7 @@ jobs:
100103
uses: docker/metadata-action@v5.8.0
101104
with:
102105
images: ghcr.io/${{ github.repository }}
103-
tags: |
104-
dev
106+
tags: dev
105107

106108
- name: Create manifest list and push
107109
id: annotate
@@ -125,27 +127,50 @@ jobs:
125127
126128
- name: Inspect image
127129
run: |
128-
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:dev
130+
docker buildx imagetools inspect ghcr.io/${{ github.repository }}:${{ needs.build.outputs.tag }}
129131
130-
test:
131-
runs-on: ubuntu-24.04
132-
name: orchestrate tests
132+
tests:
133+
strategy:
134+
fail-fast: false
135+
matrix:
136+
platform:
137+
- linux/amd64
138+
- linux/arm64
139+
runs-on: ${{ matrix.platform == 'linux/amd64' && 'ubuntu-latest' || matrix.platform == 'linux/arm64' && 'ubuntu-24.04-arm' }}
140+
name: testing on ${{ matrix.platform }}
141+
timeout-minutes: 360
133142
needs:
143+
- build
134144
- merge
135145
steps:
136-
- name: tag
137-
id: version-tag
146+
147+
- name: Test notebooks
148+
shell: bash
138149
run: |
139-
if [ ${{ github.event.inputs.tag }} != 'null' ]; then
140-
echo "tag=${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
141-
else
142-
echo "tag=${{ github.event.client_payload.tag }}" >> $GITHUB_OUTPUT
143-
fi
150+
docker run -t ghcr.io/${{ github.repository }}:dev bash -c " \
151+
pip install pytest nbmake; \
152+
find . -name '*.ipynb' | pytest --nbmake --nbmake-timeout=3600; "
144153
145-
- name: Dispatch Tests
146-
uses: peter-evans/repository-dispatch@v3.0.0
154+
tags:
155+
runs-on: ubuntu-24.04
156+
if: github.event_name != 'pull_request'
157+
name: add tags
158+
needs:
159+
- build
160+
- tests
161+
steps:
162+
- name: Authenticate with GHCR
163+
id: auth
164+
uses: docker/login-action@v3.5.0
147165
with:
148-
token: ${{ secrets.BUILD_TOKEN }}
149-
repository: ${{ github.repository }}
150-
event-type: test
151-
client-payload: '{"tag": "${{ steps.version-tag.outputs.tag }}"}'
166+
registry: "ghcr.io"
167+
username: ${{github.actor}}
168+
password: ${{secrets.BUILD_TOKEN}}
169+
170+
- name: tag release versions
171+
shell: bash
172+
run: |
173+
docker buildx imagetools create \
174+
--tag ghcr.io/${{ github.repository }}:latest \
175+
--tag ghcr.io/${{ github.repository }}:${{ needs.build.outputs.tag }} \
176+
ghcr.io/${{ github.repository }}:dev

.github/workflows/test.yaml

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

README.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
CCPBioSim Structure Validation Workshop
22
=======================================
33

4-
[![build](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/build.yml)
5-
[![tests](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/test.yaml/badge.svg?branch=main)](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/test.yaml)
6-
[![latest](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fgithub.com%2Fjimboid%2Fbackage%2Fraw%2Findex%2Fjimboid%2Fbiosim-structure-validation-workshop%2Fbiosim-structure-validation-workshop.xml&query=xml%2Fversion%5B.%2Fnewest%5B.%3D%22true%22%5D%5D%2Ftags%5B.!%3D%22latest%22%5D%5B.!%3D%22dev%22%5D&logo=github&label=latest&color=purple)](https://github.com/jimboid/biosim-structure-validation-workshop)
7-
[![size](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fgithub.com%2Fjimboid%2Fbackage%2Fraw%2Findex%2Fjimboid%2Fbiosim-structure-validation-workshop%2Fbiosim-structure-validation-workshop.xml&query=xml%2Fsize&logo=github&label=size&color=orange)](https://github.com/jimboid/biosim-structure-validation-workshop)
8-
[![pulls](https://img.shields.io/badge/dynamic/xml?url=https%3A%2F%2Fgithub.com%2Fjimboid%2Fbackage%2Fraw%2Findex%2Fjimboid%2Fbiosim-structure-validation-workshop%2Fbiosim-structure-validation-workshop.xml&query=xml%2Fdownloads&logo=github&label=pulls&color=blue)](https://github.com/jimboid/biosim-structure-validation-workshop)
4+
[![build](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/jimboid/biosim-structure-validation-workshop/actions/workflows/build.yaml)
95

106
This container is derived from the CCPBioSim JupyterHub image. This container
117
adds the necessary software packages and notebook content to form a deployable

0 commit comments

Comments
 (0)