Skip to content

Commit c9d7d08

Browse files
authored
Merge pull request #73 from almahmoud/devel
Update weekly builder GHA
2 parents 1276f0d + 48dda1c commit c9d7d08

File tree

9 files changed

+251
-178
lines changed

9 files changed

+251
-178
lines changed

.github/workflows/build_containers.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: Build container image for GHCR
22
on:
3-
push: {}
3+
push:
4+
branches:
5+
- devel
6+
- RELEASE_*
47
workflow_dispatch:
58
schedule:
69
- cron: '0 18 * * 5'
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
# This is a basic workflow to help you get started with Actions
2+
name: Full rocker & bioc build
3+
4+
# Controls when the action will run. Triggers the workflow on push or pull request
5+
# events but only for the master branch
6+
on:
7+
workflow_dispatch:
8+
inputs:
9+
rver:
10+
default: "devel"
11+
outname:
12+
default: "bioconductor_docker"
13+
schedule:
14+
- cron: '0 18 * * 5'
15+
16+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
17+
jobs:
18+
# This workflow contains a single job called "build"
19+
build:
20+
strategy:
21+
matrix:
22+
arch: [amd64, arm64]
23+
# The type of runner that the job will run on
24+
runs-on: ubuntu-latest
25+
26+
# Steps represent a sequence of tasks that will be executed as part of the job
27+
steps:
28+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
29+
- uses: actions/checkout@v3
30+
31+
- name: Free up space
32+
run: |
33+
sudo rm -rf /usr/share/dotnet
34+
sudo rm -rf /usr/local/lib/android
35+
sudo rm -rf /opt/ghc
36+
sudo rm -rf /opt/hostedtoolcache/*
37+
sudo rm -rf /usr/local/.ghcup
38+
sudo rm -rf /usr/lib/google-cloud-sdk
39+
sudo rm -rf /usr/lib/firefox
40+
sudo rm -rf /opt/microsoft/powershell
41+
sudo rm -rf /usr/lib/jvm
42+
sudo rm -rf /usr/local/graalvm
43+
sudo rm -rf /etc/skel/.rustup /home/runner/.rustup /home/runneradmin/.rustup
44+
sudo rm -rf /usr/lib/llvm-13
45+
sudo rm -rf /usr/local/julia1.8.5
46+
sudo rm -rf /opt/microsoft/msedge
47+
sudo rm -rf /usr/lib/llvm-14
48+
sudo rm -rf /opt/az
49+
50+
- name: Set up QEMU
51+
uses: docker/setup-qemu-action@v2
52+
with:
53+
platforms: arm64
54+
if: matrix.arch == 'arm64'
55+
56+
- name: Login to GHCR
57+
uses: docker/login-action@v2
58+
with:
59+
registry: ghcr.io
60+
username: ${{ github.actor }}
61+
password: ${{ secrets.GITHUB_TOKEN }}
62+
63+
- name: Login to Dockerhub
64+
uses: docker/login-action@v2
65+
with:
66+
username: ${{ secrets.DOCKER_USERNAME }}
67+
password: ${{ secrets.DOCKER_PASSWORD }}
68+
69+
- name: Extract metadata for container image
70+
id: meta
71+
uses: docker/metadata-action@v4
72+
with:
73+
images: ${{ github.repository_owner }}/${{ github.event.inputs.outname }}
74+
tags: |
75+
type=raw,value=${{ github.event.inputs.rver }}-${{ matrix.arch }}
76+
77+
- name: Set comma-separated list with all repository names
78+
id: images
79+
run: |
80+
IMG=${{ steps.meta.outputs.tags }}
81+
REPOLIST="docker.io/$IMG,ghcr.io/$IMG"
82+
echo ghcr=$(echo "ghcr.io/$IMG") >> $GITHUB_OUTPUT
83+
SUB="_docker"
84+
# Also add alternative without _docker when in name
85+
echo list=$(if [[ $REPOLIST == *$SUB* ]]; then echo "$REPOLIST,$(echo $REPOLIST | sed 's/_docker//g')"; else echo $REPOLIST; fi) >> $GITHUB_OUTPUT
86+
87+
## git clone rocker
88+
git clone --depth 1 https://github.com/rocker-org/rocker-versioned2
89+
sed -i 's#rocker/r-ver:${{ github.event.inputs.rver }}#ghcr.io/${{ github.repository_owner }}/rocker-r-ver:${{ github.event.inputs.rver }}-${{ matrix.arch }}#g' rocker-versioned2/dockerfiles/rstudio_${{ github.event.inputs.rver }}.Dockerfile
90+
sed -i 's#install_quarto.sh#install_quarto.sh || true#g' rocker-versioned2/dockerfiles/rstudio_${{ github.event.inputs.rver }}.Dockerfile
91+
92+
- name: Set up Docker Buildx
93+
uses: docker/setup-buildx-action@v2
94+
with:
95+
platforms: linux/${{ matrix.arch }}
96+
97+
- name: Build and load r-ver
98+
uses: docker/build-push-action@v3
99+
with:
100+
file: rocker-versioned2/dockerfiles/r-ver_${{ github.event.inputs.rver }}.Dockerfile
101+
context: rocker-versioned2
102+
push: true
103+
tags: ghcr.io/${{ github.repository_owner }}/rocker-r-ver:${{ github.event.inputs.rver }}-${{ matrix.arch }}
104+
platforms: linux/${{ matrix.arch }}
105+
106+
- name: Build and load rstudio
107+
uses: docker/build-push-action@v3
108+
with:
109+
file: rocker-versioned2/dockerfiles/rstudio_${{ github.event.inputs.rver }}.Dockerfile
110+
context: rocker-versioned2
111+
push: true
112+
tags: ghcr.io/${{ github.repository_owner }}/rocker-rstudio:${{ github.event.inputs.rver }}-${{ matrix.arch }}
113+
platforms: linux/${{ matrix.arch }}
114+
115+
- name: Build and push container image to all repos both arm64 and amd64
116+
uses: docker/build-push-action@v3
117+
with:
118+
build-args: |
119+
BASE_IMAGE=ghcr.io/${{ github.repository_owner }}/rocker-rstudio
120+
arm64_tag=${{ github.event.inputs.rver }}-${{ matrix.arch }}
121+
amd64_tag=${{ github.event.inputs.rver }}-${{ matrix.arch }}
122+
file: Dockerfile
123+
context: .
124+
push: true
125+
tags: ${{ steps.images.outputs.list }}
126+
labels: ${{ steps.meta.outputs.labels }}
127+
platforms: linux/${{ matrix.arch }}
128+
129+
test-built-containers:
130+
strategy:
131+
matrix:
132+
arch: [arm64, amd64]
133+
# The type of runner that the job will run on
134+
runs-on: ubuntu-latest
135+
needs: build
136+
steps:
137+
- name: Get image name
138+
id: image
139+
run: |
140+
IMG=$(echo "${{ github.repository_owner }}/${{ github.event.inputs.outname }}:${{ github.event.inputs.rver }}-${{ matrix.arch }}")
141+
echo name=$IMG >> $GITHUB_OUTPUT
142+
cat << EOF > test.Dockerfile
143+
FROM $IMG as test
144+
USER root
145+
RUN mkdir -p /tmp/bioc_test && \
146+
apt list --installed | tee /tmp/bioc_test/aptlist && \
147+
Rscript -e "BiocManager::install(c('SummarizedExperiment','usethis','data.table','igraph','GEOquery'))" 2>&1 | tee /tmp/bioc_test/packages_install && \
148+
Rscript -e "BiocManager::install('gert'); require('gert')" 2>&1 | tee /tmp/bioc_test/gert_install
149+
FROM scratch as export
150+
COPY --from=test /tmp/bioc_test /tmp
151+
EOF
152+
153+
- name: Set up QEMU
154+
uses: docker/setup-qemu-action@v2
155+
with:
156+
platforms: arm64
157+
if: matrix.arch == 'arm64'
158+
159+
- name: Set up Docker Buildx
160+
uses: docker/setup-buildx-action@v2
161+
with:
162+
platforms: linux/${{ matrix.arch }}
163+
164+
- name: Login to GHCR
165+
uses: docker/login-action@v2
166+
with:
167+
registry: ghcr.io
168+
username: ${{ github.actor }}
169+
password: ${{ secrets.GITHUB_TOKEN }}
170+
171+
- name: Test via build
172+
id: dockerbuild
173+
uses: docker/build-push-action@v4
174+
with:
175+
file: test.Dockerfile
176+
context: .
177+
push: false
178+
load: false
179+
outputs: type=tar,dest=/tmp/image.tar
180+
tags: ${{ steps.image.outputs.name }}
181+
182+
- run: |
183+
mkdir -p /tmp/contents
184+
cd /tmp/contents
185+
tar -xvf /tmp/image.tar
186+
sudo ls tmp/* | xargs -i bash -c "echo 'cat {}' && cat {}"
187+
188+
- name: Push patch bump
189+
uses: nick-fields/retry@v2
190+
with:
191+
timeout_minutes: 10
192+
max_attempts: 50
193+
shell: bash
194+
command: |
195+
set -x
196+
git config --global --add safe.directory "$GITHUB_WORKSPACE"
197+
git config user.name github-actions
198+
git config user.email github-actions@github.com
199+
git pull origin main || git reset --hard origin/main
200+
sed -r -i 's/(^ARG BIOCONDUCTOR_PATCH=)([0-9]+)$/echo "\1$((\2+1))"/ge' Dockerfile
201+
git add Dockerfile
202+
git commit -m "Bump BIOCONDUCTOR_PATCH"
203+
git push
204+

.github/workflows/image-scan.yml

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,26 @@ on:
55
schedule:
66
- cron: "0 0 * * *"
77
push:
8-
branches: master
8+
branches:
9+
- devel
10+
- RELEASE_*
911

1012
env:
1113

1214
IMAGE_NAME: bioconductor/bioconductor_docker
13-
DEVEL_TAG: devel
14-
RELEASE_TAG: RELEASE_3_14
15-
1615
jobs:
1716

18-
scan-devel:
17+
scan-images:
1918

2019
name: devel vulnerability scan
2120
runs-on: ubuntu-latest
2221

2322
steps:
24-
- uses: azure/container-scan@v0
25-
name: devel scan
26-
with:
27-
image-name: ${{ env.IMAGE_NAME }}:${{ env.DEVEL_TAG }}
23+
- name: Extract branch name
24+
id: branch
25+
run: echo "name=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT
2826

29-
scan-release:
30-
31-
name: release vulnerability scan
32-
runs-on: ubuntu-latest
33-
34-
steps:
3527
- uses: azure/container-scan@v0
36-
name: release scan
28+
name: devel scan
3729
with:
38-
image-name: ${{ env.IMAGE_NAME }}:${{ env.RELEASE_TAG }}
30+
image-name: ${{ env.IMAGE_NAME }}:${{ steps.branch.outputs.name }}

.github/workflows/test-images.yaml

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

.github/workflows/weekly-devel-builder.yml

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

.scripts/weekly_build.sh

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

0 commit comments

Comments
 (0)