Skip to content

Commit 65c95ce

Browse files
Copilotalpae
andcommitted
Sync workflow files to dev branch base before merging
Co-authored-by: alpae <1444726+alpae@users.noreply.github.com>
1 parent 147056d commit 65c95ce

2 files changed

Lines changed: 108 additions & 30 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 104 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,34 @@ on:
66
release:
77
type: [published]
88

9+
permissions:
10+
contents: read
11+
id-token: write
12+
913
env:
10-
TEST_TAG: dessimozlab/fastoma:test
14+
REGISTRY_IMAGE: dessimozlab/fastoma
1115

1216
jobs:
1317

1418
build:
1519

16-
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
include:
24+
- platform: linux/amd64
25+
runner: ubuntu-latest
26+
- platform: linux/arm64
27+
runner: ubuntu-24.04-arm
28+
29+
runs-on: ${{ matrix.runner }}
1730

1831
steps:
32+
- name: Prepare
33+
run: |
34+
platform=${{ matrix.platform }}
35+
echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
36+
1937
- name: Checkout
2038
uses: actions/checkout@v6
2139
with:
@@ -26,8 +44,7 @@ jobs:
2644
uses: docker/metadata-action@v5
2745
with:
2846
# list of Docker images to use as base name for tags
29-
images: |
30-
dessimozlab/fastoma
47+
images: ${{ env.REGISTRY_IMAGE }}
3148
# generate Docker tags based on the following events/attributes
3249
tags: |
3350
type=schedule
@@ -47,40 +64,99 @@ jobs:
4764
- name: Set up Docker Buildx
4865
uses: docker/setup-buildx-action@v3
4966

50-
- name: Build and export to docker for testing
67+
- name: Login to DockerHub
68+
uses: docker/login-action@v3
69+
with:
70+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
71+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
72+
73+
- name: Build and push by digest only
74+
id: build
5175
uses: docker/build-push-action@v6
5276
with:
5377
context: .
54-
load: true
55-
tags: ${{ env.TEST_TAG }}
78+
platforms: ${{ matrix.platform }}
79+
tags: ${{ env.REGISTRY_IMAGE }}
80+
labels: ${{ steps.meta.outputs.labels }}
81+
outputs: type=image,push-by-digest=true,name-canonical=true,push=true
82+
provenance: mode=max
83+
sbom: true
84+
85+
- name: Export digest
86+
run: |
87+
mkdir -p ${{ runner.temp }}/digests
88+
digest="${{ steps.build.outputs.digest }}"
89+
touch "${{ runner.temp }}/digests/${digest#sha256:}"
5690
57-
#- name: Test
58-
# run: |
59-
# docker run --rm -i -v $PWD/tests:/input -v $PWD/tests/:/reads -v $PWD/output:/out -v $PWD/run:/run ${{ env.TEST_TAG }} --tree --standalone_path /input/marker_genes --dna_reference /input/cds-marker_genes.fasta.gz --reads /reads/sample_1.fastq --output_path /out
60-
# if [ ! -f output/tree_sample_1.nwk ] ; then exit 1; fi
91+
- name: Upload digest
92+
uses: actions/upload-artifact@v7
93+
with:
94+
name: digests-${{ env.PLATFORM_PAIR }}
95+
path: ${{ runner.temp }}/digests/*
96+
if-no-files-found: error
97+
retention-days: 1
98+
99+
merge:
100+
runs-on: ubuntu-latest
101+
needs:
102+
- build
103+
steps:
104+
- name: Download digests
105+
uses: actions/download-artifact@v8
106+
with:
107+
path: ${{ runner.temp }}/digests
108+
pattern: digests-*
109+
merge-multiple: true
61110

62111
- name: Login to DockerHub
63112
uses: docker/login-action@v3
64113
with:
65114
username: ${{ secrets.DOCKER_HUB_USERNAME }}
66115
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
67116

68-
- name: Set platforms
69-
id: set_platforms
117+
- name: Set up Docker Buildx
118+
uses: docker/setup-buildx-action@v3
119+
120+
- name: Docker meta
121+
id: meta
122+
uses: docker/metadata-action@v5
123+
with:
124+
images: ${{ env.REGISTRY_IMAGE }}
125+
tags: |
126+
type=schedule
127+
type=ref,event=branch
128+
type=ref,event=pr
129+
type=semver,pattern={{version}}
130+
type=semver,pattern={{major}}.{{minor}}
131+
type=semver,pattern={{major}}
132+
type=sha
133+
labels: |
134+
org.opencontainers.image.source=${{ github.repository }}
135+
org.opencontainers.image.revision=${{ github.sha }}
136+
137+
- name: Create manifest list and push
138+
working-directory: ${{ runner.temp }}/digests
70139
run: |
71-
echo "github ref: ${GITHUB_REF}"
72-
if [[ "${GITHUB_REF##*/}" == "main" || "${GITHUB_REF##*/}" == "dev" || "${GITHUB_REF}" == "refs/tags/"* ]]; then
73-
echo "platforms=linux/amd64,linux/arm64" >> $GITHUB_OUTPUT
74-
else
75-
echo "platforms=linux/amd64" >> $GITHUB_OUTPUT
76-
fi
77-
78-
- name: Build and push
79-
uses: docker/build-push-action@v6
140+
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
141+
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' *)
142+
143+
- name: Inspect image
144+
run: |
145+
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }}
146+
147+
publish-doc:
148+
runs-on: ubuntu-latest
149+
needs:
150+
- merge
151+
152+
steps:
153+
- name: Checkout
154+
uses: actions/checkout@v6
155+
156+
- name: Update repo description
157+
uses: peter-evans/dockerhub-description@v5
80158
with:
81-
context: .
82-
platforms: ${{ steps.set_platforms.outputs.platforms }}
83-
push: true
84-
#${{ github.event_name != 'push' && github.event_name != 'pull_request' }}
85-
tags: ${{ steps.meta.outputs.tags }}
86-
labels: ${{ steps.meta.outputs.labels }}
159+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
160+
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
161+
repository: ${{ env.REGISTRY_IMAGE }}
162+
readme-filepath: ./README.md

.github/workflows/nf-test.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ on:
1212
env:
1313
NFT_DIFF: "pdiff"
1414
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2"
15-
NFT_VER: "0.9.2"
16-
NFT_WORKDIR: "${{ github.workspace }}/nf-test-work"
15+
NFT_VER: "0.9.4"
16+
NFT_WORKDIR: "/tmp/nft-test"
17+
NXF_WORK: "/tmp/nxf-work"
1718
NXF_ANSI_LOG: false
1819
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
1920
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
21+
NXF_CONDA_CACHEDIR: "/tmp/conda"
2022

2123
concurrency:
2224
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}"

0 commit comments

Comments
 (0)