Use latest ubuntu #313
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: ci | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
# Job to run change detection | |
changes: | |
runs-on: ubuntu-latest | |
outputs: | |
# Expose matched filters as job 'images' output variable | |
images: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: dorny/paths-filter@v2 | |
id: filter | |
with: | |
# Use context to get the branch where commits were pushed. | |
# If there is only one long-lived branch (e.g. master), | |
# you can specify it directly. | |
# If it's not configured, the repository default branch is used. | |
base: ${{ github.ref }} | |
filters: | | |
aws-cli: 'aws-cli/*' | |
bats: 'bats/**' | |
black: 'black/**' | |
bootstrap/cinc-auditor: 'bootstrap/cinc-auditor/**' | |
bootstrap/dasel: 'bootstrap/dasel/**' | |
bootstrap/hadolint: 'bootstrap/hadolint/**' | |
buildpack-deps/ubuntu/focal/curl: 'buildpack-deps/ubuntu/focal/curl/**' | |
buildpack-deps/ubuntu/focal/scm: 'buildpack-deps/ubuntu/focal/scm/**' | |
buildpack-deps/ubuntu/focal: 'buildpack-deps/ubuntu/focal/*' | |
buildpack-deps/ubuntu/jammy/curl: 'buildpack-deps/ubuntu/jammy/curl/**' | |
buildpack-deps/ubuntu/jammy/scm: 'buildpack-deps/ubuntu/jammy/scm/**' | |
buildpack-deps/ubuntu/jammy: 'buildpack-deps/ubuntu/jammy/*' | |
cinc/cinc: 'cinc/cinc/**' | |
doctl: 'doctl/**' | |
dokken/centos-7: 'dokken/centos-7/**' | |
dokken/centos-stream-9: 'dokken/centos-stream-9/**' | |
dokken/oraclelinux-7: 'dokken/oraclelinux-7/**' | |
dokken/oraclelinux-8: 'dokken/oraclelinux-8/**' | |
dokken/oraclelinux-9: 'dokken/oraclelinux-9/**' | |
dokken/ubuntu-20.04: 'dokken/ubuntu-20.04/**' | |
dokken/ubuntu-22.04: 'dokken/ubuntu-22.04/**' | |
flake8: 'flake8/**' | |
golang/1.19/jammy: 'golang/1.19/jammy/**' | |
jupyter/docker-stacks-foundation: 'jupyter/docker-stacks-foundation/**' | |
jupyter/base-notebook: 'jupyter/base-notebook/**' | |
jupyter/minimal-notebook: 'jupyter/minimal-notebook/**' | |
jupyter/scipy-notebook: 'jupyter/scipy-notebook/**' | |
jupyter/datascience-notebook: 'jupyter/datasciene-notebook/**' | |
markdownlint: 'markdownlint/**' | |
meshcmd: 'meshcmd/**' | |
ruby/3.1/jammy: 'ruby/3.1/jammy/**' | |
ruby/3.1/slim-jammy: 'ruby/3.1/slim-jammy/**' | |
shellcheck: 'shellcheck/**' | |
perl/5.032.001-main-jammy: 'perl/5.032.001-main-jammy/**' | |
pulumi/pulumi-base: 'pulumi/pulumi-base/**' | |
pulumi/pulumi-python: 'pulumi/pulumi-python/**' | |
python/3.10/jammy: 'python/3.10/jammy/**' | |
python/3.11/jammy: 'python/3.11/jammy/**' | |
rust/1.64.0/focal: 'rust/1.64.0/focal/*' | |
rust/1.64.0/focal/slim: 'rust/1.64.0/focal/slim/**' | |
texlive/base: 'texlive/base/**' | |
texlive/latest: 'texlive/latest/**' | |
# Job to build and test each of the modified images | |
build: | |
needs: changes | |
strategy: | |
matrix: | |
# Parse JSON array containing names of all filters matching any of changed files | |
# e.g. ['image1', 'image2'] if both image folders contains changes | |
image: ${{ fromJSON(needs.changes.outputs.images) }} | |
if: ${{ needs.changes.outputs.images != '[]' && needs.changes.outputs.images != '' }} | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ${{ matrix.image }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Check the Containerfile with hadolint | |
run: | | |
$(git rev-parse --show-toplevel)/bin/lint.sh | |
- name: Install QEMU static binaries | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Set the tags | |
id: tags | |
run: | | |
echo "tags=$($(git rev-parse --show-toplevel)/bin/list-tags.sh -c)" >> $GITHUB_ENV | |
- name: Build locally for testing | |
uses: docker/build-push-action@v3 | |
with: | |
load: true | |
context: ${{ matrix.image }} | |
file: ${{ matrix.image }}/Containerfile | |
tags: ${{ env.tags }} | |
- name: Run tests on the cinc/cinc image with cinc-auditor | |
if: matrix.image == 'cinc/cinc' | |
run: | | |
$(git rev-parse --show-toplevel)/bin/test.sh "$( $(git rev-parse --show-toplevel)/bin/list-tags.sh | head -n 1 )" "/bin/sh" | |
- name: Run tests on the image with cinc-auditor | |
if: matrix.image != 'cinc/cinc' | |
run: | | |
$(git rev-parse --show-toplevel)/bin/test.sh | |
- name: Set the platforms | |
if: github.event_name == 'push' | |
id: platforms | |
run: | | |
echo "platforms=$($(git rev-parse --show-toplevel)/bin/list-platforms.sh -c)" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
if: github.event_name == 'push' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
password: ${{ secrets.CONTAINER_REGISTRY_PASSWORD }} | |
- name: Build and push | |
if: github.event_name == 'push' | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
context: ${{ matrix.image }} | |
file: ${{ matrix.image }}/Containerfile | |
platforms: ${{ env.platforms }} | |
tags: ${{ env.tags }} | |
- name: Set the image name | |
if: github.event_name == 'push' | |
id: image_name | |
run: | | |
echo "image_name=$($(git rev-parse --show-toplevel)/bin/image-name.sh)" >> $GITHUB_ENV | |
- name: Set the image description | |
if: github.event_name == 'push' | |
id: image_description | |
run: | | |
echo "image_description=$($(git rev-parse --show-toplevel)/bin/image-description.sh)" >> $GITHUB_ENV | |
- name: Set the image readme | |
if: github.event_name == 'push' | |
id: image_readme | |
run: | | |
echo "image_readme=$($(git rev-parse --show-toplevel)/bin/image-readme.sh)" >> $GITHUB_ENV | |
- name: Update Docker Hub Description | |
if: github.event_name == 'push' | |
uses: peter-evans/dockerhub-description@v3 | |
with: | |
username: ${{ secrets.CONTAINER_REGISTRY_USERNAME }} | |
password: ${{ secrets.CONTAINER_DESCRIPTION_PASSWORD }} | |
short-description: ${{ env.image_description }} | |
repository: boxcutter/${{ env.image_name }} | |
readme-filepath: ${{ env.image_readme }} |