Bump crazy-max/ghaction-docker-meta from 5.0.0 to 5.3.0 #74
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build-and-test | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- '*' | |
pull_request: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Docker meta | |
id: docker_meta | |
uses: crazy-max/ghaction-docker-meta@v5.3.0 | |
with: | |
images: imteksim/jupyterlab-surfacetopography | |
tags: | | |
type=raw,value=latest | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=raw,value=sha-${{ github.sha }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up docker buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Cache docker layers | |
uses: actions/cache@v3.3.2 | |
env: | |
cache-name: cache-docker-layers | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ env.cache-name }} | |
restore-keys: | | |
${{ runner.os }}-buildx-${{ env.cache-name }} | |
# build image locally, push to dockerhub if tagged | |
- name: Build | |
uses: docker/build-push-action@v5 | |
with: | |
context: ./docker | |
file: ./docker/jupyterlab-SurfaceTopography/Dockerfile | |
platforms: linux/amd64 | |
tags: ${{ steps.docker_meta.outputs.tags }} | |
labels: ${{ steps.docker_meta.outputs.labels }} | |
outputs: type=docker, dest=/tmp/image.tar | |
cache-from: type=local,src=/tmp/.buildx-cache | |
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
# This ugly bit is necessary if you don't want your cache to grow forever | |
# till it hits GitHub's limit of 5GB. | |
# Temp fix | |
# https://github.com/docker/build-push-action/issues/252 | |
# https://github.com/moby/buildkit/issues/1896 | |
- name: Move cache | |
run: | | |
rm -rf /tmp/.buildx-cache | |
mv /tmp/.buildx-cache-new /tmp/.buildx-cache | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
- name: Load current image | |
run: | | |
# the following line allows testing locally with act (https://github.com/nektos/act), | |
# i.e. by running | |
# act -W .github/workflows/test.yml --bind | |
# from within this repository's root directory (see README for more information). | |
sudo chown runner:docker /var/run/docker.sock | |
# see https://github.com/nektos/act/issues/724#issuecomment-855390956 | |
# show docker info | |
docker info | |
docker load --input /tmp/image.tar | |
docker image ls -a | |
- name: Test container | |
run: | | |
echo "### jupyter kernelspec list ###" | |
docker run imteksim/jupyterlab-surfacetopography start.sh jupyter kernelspec list | |
echo "### default environment ###" | |
docker run -v $(pwd):/home/jovyan/work imteksim/jupyterlab-surfacetopography start.sh python /home/jovyan/work/maintenance/list_installed_packages.py | |
echo "### jupytext py to ipynb to stdout ###" | |
docker run -v $(pwd):/home/jovyan/work imteksim/jupyterlab-surfacetopography \ | |
start.sh jupytext --to ipynb --set-kernel surfacetopography \ | |
--execute /home/jovyan/work/maintenance/list_installed_packages.py --output - | |
# only store image as artifact when tagged | |
- name: Upload container image as artifact | |
if: >- | |
github.event_name == 'push' && | |
startsWith(github.ref, 'refs/tags') | |
uses: actions/upload-artifact@v3 | |
with: | |
name: jupyterlab-SurfaceTopography-${{github.ref_name}} | |
path: /tmp/image.tar |