Skip to content

Build(deps): Bump actions/cache from 3 to 4 #138

Build(deps): Bump actions/cache from 3 to 4

Build(deps): Bump actions/cache from 3 to 4 #138

Workflow file for this run

name: Test Action
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches: trunk
paths:
- '.env'
- 'docker-compose.yml'
- '**test.yml'
pull_request:
branches: trunk
paths:
- '.env'
- 'docker-compose.yml'
- 'Dockerfile'
- 'entrypoint.sh'
- '**test.yml'
env:
VERSION: container-test
jobs:
test-rmw:
runs-on: ubuntu-latest
env:
REGISTRY_IMAGE: andy5995/linuxdeploy:v3-focal
DOCKER_CACHE_DEST: ${{ github.workspace }}/.docker/buildx-cache-${{ matrix.platform }}
strategy:
matrix:
platform:
- linux/amd64
- linux/arm64
steps:
- name: Checkout rmw
uses: actions/checkout@v4
with:
repository: theimpossibleastronaut/rmw
- if: ${{ ! contains(matrix.platform, 'amd64') }}
uses: docker/setup-qemu-action@v3
- name: Set variables
run: |
if [ -z "$VERSION" ]; then
echo "VERSION=${{ github.sha }}" >> $GITHUB_ENV
fi
- name: Checkout
uses: actions/checkout@v4
with:
path: _linuxdeploy_test
fetch-depth: 0
- name: Check if Dockerfile or entrypoint.sh has changed
run: |
if [ "${{ github.ref }}" != "refs/heads/trunk" ]; then
cd _linuxdeploy_test
FILES=$(git log -1 -p ./ | grep +++ | cut -d '/' -f 2-| sed -e 's|dev/null||g')
if echo "$FILES" | grep -qE "^(Dockerfile)$"; then
echo "do_build=true" >> $GITHUB_ENV
else
echo "do_build=false" >> $GITHUB_ENV
fi
else
# If there was a push to trunk, we don't want the docker build
# to run. All the builds in docker.yml will be pushed when *that*
# workflow runs, so we really don't want to be adding extra builds
# that won't become "permanent".
# Theoretically, if a new Dockerfile is pushed to master, it should
# already have been tested anyway.
#
# That may mean the test will fail if the images don't exist yet
# in the registry or there was a dramatic change in the Dockerfile
# that might break the test that runs via docker compose.
# That's ok for now. We'll see how things go...
echo "do_build=false" >> $GITHUB_ENV
fi
- name: Cache Docker layers
if: ${{ env.do_build == 'true' }}
id: docker-cache
uses: actions/cache@v4
with:
path: ${{ env.DOCKER_CACHE_DEST }}
key: ${{ runner.os }}-docker-${{ matrix.platform }}-${{ github.ref_name }}
restore-keys: |
${{ runner.os }}-docker-${{ matrix.platform }}-
${{ runner.os }}-docker-
- name: Set up Docker Buildx
if: ${{ env.do_build == 'true' }}
uses: docker/setup-buildx-action@v3
- name: Build Docker image
if: ${{ env.do_build == 'true' }}
run: |
cd _linuxdeploy_test
docker buildx build \
. \
-t $REGISTRY_IMAGE \
--platform=${{ matrix.platform }} \
--build-arg CODENAME=focal \
--cache-to=type=local,dest=${{ env.DOCKER_CACHE_DEST }} \
--cache-from=type=local,src=${{ env.DOCKER_CACHE_DEST }} \
--load
- name: Build AppImage
run: |
export HOSTUID=$(id -u) HOSTGID=$(id -g)
docker compose -f _linuxdeploy_test/docker-compose.yml run --rm build
env:
SCRIPT: 'packaging/appimage/pre-appimage.sh'
PLATFORM: ${{ matrix.platform }}
- name: Create sha256sum
run: |
IMAGE_FILENAME=$(basename `find out/*AppImage`)
echo "IMAGE_FILENAME=$IMAGE_FILENAME" >> $GITHUB_ENV
cd out
sha256sum "$IMAGE_FILENAME" > "$IMAGE_FILENAME.sha256sum"
- name: Upload AppImage
uses: actions/upload-artifact@v4
with:
name: ${{ env.IMAGE_FILENAME }}
path: ./out/*
if-no-files-found: error