Skip to content

Containers

Containers #667

Workflow file for this run

name: Containers
on:
workflow_dispatch:
inputs:
inpcont:
description: 'Build containers'
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
inpwhichcont:
description: 'Which containers to build, defaults to "all".'
required: false
default: 'all'
type: string
inpmani:
description: 'Update manifest'
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
inpweb:
description: 'Update website'
required: true
type: choice
options:
- 'yes'
- 'no'
default: 'yes'
schedule:
- cron: '55 5 * * *'
jobs:
# ------------------------------------------------------------------------
setup-matrix:
if: ${{ github.event.inputs.inpcont == '' || github.event.inputs.inpcont == 'yes' }}
runs-on: ubuntu-latest
outputs:
containers: ${{ steps.setup-matrix.outputs.containers }}
steps:
- uses: actions/checkout@v4
- name: Set up matrix of containers
id: setup-matrix
run: |
containers=$(python tests/get-containers.py ${{ github.event.inputs.inpwhichcont }})
echo "containers=$containers" >> $GITHUB_OUTPUT
# ------------------------------------------------------------------------
containers:
if: ${{ github.event.inputs.inpcont == '' || github.event.inputs.inpcont == 'yes' }}
needs: setup-matrix
strategy:
fail-fast: false
matrix:
container: ${{ fromJson(needs.setup-matrix.outputs.containers) }}
runs-on: ubuntu-latest
name: ${{ matrix.container }}
steps:
# needed for bigger Docker images, if there isn't enough space, then
# they build, but are not exported to Docker
- name: "Clean up"
run: |
sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/.ghcup \
/usr/local/share/boost \
$AGENT_TOOLSDIRECTORY $CONDA $VCPKG_INSTALLATION_ROOT \
$JAVA_HOME_8_X64 $JAVA_HOME_11_X64 $JAVA_HOME_17_X64 $JAVA_HOME_21_X64 \
$CHROMEWEBDRIVER $EDGEWEBDRIVER $GECKOWEBDRIVER $SELENIUM_JAR_PATH \
$ANDROID_HOME
sudo apt-get remove -y '^aspnetcore-.*' || echo "::warning::The command [sudo apt-get remove -y '^aspnetcore-.*'] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^dotnet-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^dotnet-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^llvm-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^llvm-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y 'php.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y 'php.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^mongodb-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mongodb-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y '^mysql-.*' --fix-missing || echo "::warning::The command [sudo apt-get remove -y '^mysql-.*' --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing || echo "::warning::The command [sudo apt-get remove -y azure-cli google-chrome-stable firefox powershell mono-devel libgl1-mesa-dri --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y google-cloud-sdk --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-sdk --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get remove -y google-cloud-cli --fix-missing || echo "::debug::The command [sudo apt-get remove -y google-cloud-cli --fix-missing] failed to complete successfully. Proceeding..."
sudo apt-get autoremove -y || echo "::warning::The command [sudo apt-get autoremove -y] failed to complete successfully. Proceeding..."
sudo apt-get clean || echo "::warning::The command [sudo apt-get clean] failed to complete successfully. Proceeding..."
df -h /
docker buildx du
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
provenance: false
context: containers/${{ matrix.container }}
load: true
tags: |
rhub/test:test
- name: Test
run: |
docker run rhub/test:test R --version
- name: Push
uses: docker/build-push-action@v5
with:
platforms: linux/amd64
provenance: false
context: containers/${{ matrix.container }}
push: true
outputs:
tags: |
rhub/${{ matrix.container }}:latest
ghcr.io/r-hub/containers/${{ matrix.container }}:latest
# ------------------------------------------------------------------------
website:
if: ${{ (github.event.inputs.inpweb == '' || github.event.inputs.inpweb == 'yes') && always() }}
runs-on: ubuntu-latest
needs: containers
name: Update website
# Rule out parallel updates.
concurrency:
group: website
steps:
- uses: actions/checkout@v4
- name: Install quarto
uses: quarto-dev/quarto-actions/setup@v2
- name: Install R
uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true
- name: Install R packages
uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::pkgload
working-directory: website
- name: Build manifest
run: cd website && Rscript update-manifest.R
env:
UPDATE_MANIFEST: ${{ github.event.inputs.inpmani }}
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
- uses: quarto-dev/quarto-actions/publish@v2
with:
path: website
target: gh-pages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}