ci: add test container build #30
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: Test build stream-sprout 🚧 | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- stream-sprout | ||
- debian/** | ||
- flake.nix | ||
- package.nix | ||
- Containerfile | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- stream-sprout | ||
- debian/** | ||
- flake.nix | ||
- package.nix | ||
- Containerfile | ||
workflow_dispatch: | ||
# TODO: arm64 runner | ||
# https://github.blog/changelog/2024-06-03-actions-arm-based-linux-and-windows-runners-are-now-in-public-beta/ | ||
name: Build and Publish Podman Image | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
test-deb-build: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: "Checkout 🥡" | ||
uses: actions/checkout@v4 | ||
- name: "Build & Test .deb 🍥" | ||
env: | ||
DEBFULLNAME: "Martin Wimpress" | ||
DEBEMAIL: "[email protected]" | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
sudo apt-get -y update | ||
sudo apt-get -y install debhelper devscripts | ||
REL_VER=$(grep "^readonly VERSION" stream-sprout | cut -d'"' -f2) | ||
rm debian/changelog | ||
dch --package stream-sprout --newversion="${REL_VER}-1" --distribution=unstable "New upstream release." --create | ||
dpkg-buildpackage --build=binary --no-check-builddeps --compression=gzip | ||
sudo apt-get -y install ../stream-sprout_${REL_VER}-1_all.deb | ||
test-nix-build: | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
id-token: "write" | ||
contents: "read" | ||
steps: | ||
- name: "Checkout 🥡" | ||
uses: "actions/checkout@v4" | ||
- name: "Install Nix ❄️" | ||
uses: "DeterminateSystems/nix-installer-action@v13" | ||
- name: "Enable Magic Nix Cache 🪄" | ||
uses: "DeterminateSystems/magic-nix-cache-action@v7" | ||
- name: "Build & Test .nix ❄️" | ||
run: | | ||
nix build .#stream-sprout | ||
tree ./result | ||
test-container-build: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout 🥡 | ||
uses: actions/checkout@v4 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: . | ||
file: ./Containerfile | ||
platforms: linux/amd64,linux/arm64 | ||
push: false | ||
tags: | | ||
ghcr.io/${{ github.repository }}:latest | ||
ghcr.io/${{ github.repository }}:${{ github.sha }} | ||
- name: Logout from GitHub Container Registry | ||
run: docker logout ghcr.io |