subsurface/.github/workflows/linux-snap.yml
Michael Keller c1bfded4a7 CICD: Add GitHub Action to build the Windows (MXE) Builder Docker Image.
Add a GitHub action that builds the docker image to run builds for the
Windows (MXE) version of Subsurface.
Also update the MXE image Dockerfile to the latest version of MXE, and
add a patch to use a current version of mdbtools.
Configure GitHub actions that do not build docker images to not trigger
on changes to the contents of `scripts/docker/`.

Signed-off-by: Michael Keller <github@ike.ch>
2024-01-20 21:30:12 -08:00

80 lines
2.3 KiB
YAML

name: Linux Snap
on:
push:
paths-ignore:
- scripts/docker/**
branches:
- master
pull_request:
paths-ignore:
- scripts/docker/**
branches:
- master
jobs:
Snap:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Check out code
uses: actions/checkout@v3
with:
# Needed for version determination to work
fetch-depth: 0
- name: atomically create or retrieve the build number
id: version_number
if: github.event_name == 'push'
run: |
bash scripts/get-atomic-buildnr.sh ${{ github.sha }} ${{ secrets.NIGHTLY_BUILDS }} "CICD-release"
- name: store dummy version and build number for pull request
if: github.event_name == 'pull_request'
run: |
echo "100" > latest-subsurface-buildnumber
echo "CICD-pull-request" > latest-subsurface-buildnumber-extension
- name: Set up LXD
uses: canonical/setup-lxd@main
- name: Set up CCache
id: setup-ccache
run: |
sudo apt-get install ccache
mkdir -p ${HOME}/.ccache
ccache --max-size=2G
/snap/bin/lxc profile device add default ccache disk source=${HOME}/.ccache/ path=/root/.ccache
# Patch snapcraft.yaml to enable ccache
patch -p1 < .github/workflows/linux-snap.patch
# Find common base between master and HEAD to use as cache key.
git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules origin master
echo "key=$( git merge-base origin/master ${{ github.sha }} )" >> $GITHUB_OUTPUT
- name: CCache
uses: actions/cache@v3
with:
key: ccache-${{ runner.os }}-${{ steps.setup-ccache.outputs.key }}
restore-keys: |
ccache-${{ runner.os }}-
path: ~/.ccache/**
- name: Build and verify the snap
uses: canonical/actions/build-snap@release
id: build-snap
with:
setup-lxd: false
- name: Clear CCache stats
run: ccache --show-stats --zero-stats
- name: Upload the snap
if: github.event_name == 'push'
uses: actions/upload-artifact@v2
with:
name: ${{ steps.build-snap.outputs.snap-name }}
path: ${{ steps.build-snap.outputs.snap-path }}
if-no-files-found: error