mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-19 08:55:36 +00:00
ci: bound shared jobs and preserve caller validation
This commit is contained in:
1 parent
306f1b65db
commit
e10d698d5c
6 files changed
+328
-8
No files matched your search
@@ -8,6 +8,11 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
require-craft-fonts:
|
||||
description: "Require the supplied craft-fonts checkout during builds and tests"
|
||||
type: boolean
|
||||
required: false
|
||||
default: false
|
||||
freebsd-release:
|
||||
description: "FreeBSD OS release version to run in the VM"
|
||||
type: string
|
||||
@@ -63,24 +68,48 @@ jobs:
|
||||
mem: 12288
|
||||
copyback: false
|
||||
prepare: |
|
||||
pkg install -y bash git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib
|
||||
pkg install -y bash git curl pkgconf cmake python3 libxkbcommon wayland libX11 libXcursor libXrandr libXi libxcb mesa-libs vulkan-loader gtk3 fontconfig freetype2 alsa-lib dejavu
|
||||
curl -fsSL https://sh.rustup.rs | sh -s -- -y --profile minimal
|
||||
run: |
|
||||
. "$HOME/.cargo/env"
|
||||
git config --global --add safe.directory "*"
|
||||
rustc --version
|
||||
if [ -d craft-fonts ]; then
|
||||
export CRAFT_FONTS_DIR="$PWD/craft-fonts"
|
||||
fi
|
||||
if [ "${{ inputs.require-craft-fonts }}" = "true" ]; then
|
||||
if [ ! -d craft-fonts ]; then
|
||||
echo "error: required craft-fonts checkout is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
export CRAFT_FONTS_REQUIRED=1
|
||||
fi
|
||||
CARGO_PROFILE_DEV_DEBUG=0 cargo build --workspace --all-targets --locked ${{ inputs.cargo-build-extra-args }}
|
||||
if [ "${{ inputs.skip-tests }}" != "true" ]; then
|
||||
if [ -n "${{ inputs.custom-test-command }}" ]; then
|
||||
${{ inputs.custom-test-command }}
|
||||
elif [ -d "craft-fonts" ]; then
|
||||
CRAFT_FONTS_DIR="$PWD/craft-fonts" CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked ${{ inputs.cargo-test-extra-args }}
|
||||
if [ "${{ inputs.custom-test-command != '' }}" = "true" ]; then
|
||||
# Isolate the command list: an early failure in an && chain must not
|
||||
# be hidden by a later successful packaging command in this script.
|
||||
sh -eu <<'CRAFT_CUSTOM_TESTS' || exit "$?"
|
||||
${{ inputs.custom-test-command }}
|
||||
CRAFT_CUSTOM_TESTS
|
||||
else
|
||||
CARGO_PROFILE_DEV_DEBUG=0 cargo test --workspace --locked ${{ inputs.cargo-test-extra-args }}
|
||||
fi
|
||||
fi
|
||||
if [ "${{ inputs.run-package-check }}" = "true" ] && [ -f packaging/freebsd/package.sh ]; then
|
||||
rm -rf target/debug || true
|
||||
if [ "${{ inputs.run-package-check }}" = "true" ]; then
|
||||
if [ ! -f packaging/freebsd/package.sh ]; then
|
||||
echo "error: requested FreeBSD packaging script is missing" >&2
|
||||
exit 1
|
||||
fi
|
||||
rm -rf target/debug
|
||||
CARGO_BUILD_JOBS=4 bash packaging/freebsd/package.sh
|
||||
tar -tzf dist/release/*-freebsd-x86_64.tar.gz || true
|
||||
# Check every produced archive; an unmatched glob or unreadable tarball
|
||||
# must fail instead of turning a requested package check into a no-op.
|
||||
for archive in dist/release/*-freebsd-x86_64.tar.gz; do
|
||||
if [ ! -f "$archive" ]; then
|
||||
echo "error: no FreeBSD x86_64 package was produced" >&2
|
||||
exit 1
|
||||
fi
|
||||
tar -tzf "$archive"
|
||||
done
|
||||
fi
|
||||
@@ -8,13 +8,24 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
default: "1.7.12"
|
||||
extra-checks-script:
|
||||
description: "Optional repository-local Bash script for app-specific packaging checks"
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 15
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Run packaging lint
|
||||
uses: storytold/craft-common-actions/actions/packaging-lint@main
|
||||
with:
|
||||
actionlint-version: ${{ inputs.actionlint-version }}
|
||||
- name: App-specific packaging checks
|
||||
if: inputs.extra-checks-script != ''
|
||||
env:
|
||||
CHECKS_SCRIPT: ${{ inputs.extra-checks-script }}
|
||||
run: bash -- "$CHECKS_SCRIPT"
|
||||
@@ -102,6 +102,7 @@ permissions:
|
||||
|
||||
jobs:
|
||||
version:
|
||||
timeout-minutes: 10
|
||||
name: version
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
@@ -118,6 +119,7 @@ jobs:
|
||||
app-title: ${{ inputs.app-title }}
|
||||
|
||||
macos:
|
||||
timeout-minutes: 90
|
||||
name: macOS universal
|
||||
needs: version
|
||||
runs-on: macos-15-xlarge
|
||||
@@ -243,6 +245,7 @@ jobs:
|
||||
if [ -n "${MACOS_KEYCHAIN:-}" ]; then security delete-keychain "$MACOS_KEYCHAIN" || true; fi
|
||||
|
||||
windows:
|
||||
timeout-minutes: 90
|
||||
name: Windows ${{ matrix.arch }}
|
||||
needs: version
|
||||
runs-on: windows-latest
|
||||
@@ -371,6 +374,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
linux:
|
||||
timeout-minutes: 90
|
||||
name: Linux ${{ matrix.arch }}
|
||||
needs: version
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -472,6 +476,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
flatpak:
|
||||
timeout-minutes: 90
|
||||
name: Flatpak ${{ matrix.arch }}
|
||||
needs: [version, linux]
|
||||
runs-on: ${{ matrix.runner }}
|
||||
@@ -660,6 +665,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
web:
|
||||
timeout-minutes: 90
|
||||
name: Web (wasm)
|
||||
if: inputs.has-web
|
||||
needs: version
|
||||
@@ -750,6 +756,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
linux-riscv64:
|
||||
timeout-minutes: 90
|
||||
name: Linux riscv64
|
||||
if: inputs.has-riscv64
|
||||
needs: version
|
||||
@@ -852,6 +859,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
server:
|
||||
timeout-minutes: 90
|
||||
name: Server Linux ${{ matrix.arch }}
|
||||
if: inputs.has-server
|
||||
needs: version
|
||||
@@ -896,6 +904,7 @@ jobs:
|
||||
if-no-files-found: error
|
||||
|
||||
release:
|
||||
timeout-minutes: 10
|
||||
name: Draft GitHub Release
|
||||
if: "!cancelled() && !contains(needs.*.result, 'failure')"
|
||||
needs: [version, macos, windows, linux, linux-riscv64, flatpak, freebsd, web, server]
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Shared FreeBSD workflow tests
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/freebsd.yml
|
||||
- .github/workflows/test-freebsd.yml
|
||||
- tests/**
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- .github/workflows/freebsd.yml
|
||||
- .github/workflows/test-freebsd.yml
|
||||
- tests/**
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 10
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Install YAML parser
|
||||
run: sudo apt-get update && sudo apt-get install -y --no-install-recommends python3-yaml
|
||||
- name: Exercise failing tests, package validation and required fonts
|
||||
run: /usr/bin/python3 -m unittest discover -s tests -v
|
||||
Reference in new issue
Block a user