Skip to content

Reverts to Tools.mk for go run instead of go tool #265

Reverts to Tools.mk for go run instead of go tool

Reverts to Tools.mk for go run instead of go tool #265

Workflow file for this run

# `name` value will appear "as is" in the badge.
# See https://docs.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#adding-a-workflow-status-badge-to-your-repository
# yamllint --format github .github/workflows/packaging.yaml
---
name: "packaging"
on:
push: # We run tests on non-tagged pushes to master
tags-ignore: ['*']
branches: master
paths:
- 'packaging/nfpm/*'
- 'packaging/icon@48w.ico'
- '.github/workflows/packaging.yaml'
- 'Makefile'
- 'Tools.mk'
pull_request: # We also run tests on pull requests targeted at the master branch
branches: master
paths:
- 'packaging/nfpm/*'
- 'packaging/icon@48w.ico'
- '.github/workflows/packaging.yaml'
- 'Makefile'
- 'Tools.mk'
# workflow_dispatch will let us manually trigger the workflow from GitHub actions dashboard.
# For example, you can try to build a branch without raising a pull request.
# See https://docs.github.com/en/free-pro-team@latest/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
defaults:
run: # use bash for all operating systems unless overridden
shell: bash
jobs:
packaging:
name: "Test packaging build"
runs-on: ubuntu-24.04
steps:
- name: "Checkout"
uses: actions/checkout@v6
- name: "Cache Go"
uses: actions/cache@v5
with:
path: ~/go/pkg/mod
# go.mod for go release version, go.sum for modules used, and Tools.mk for 'go run' tools
key: test-${{ runner.os }}-${{ runner.arch }}-go-${{ hashFiles('go.mod', 'go.sum', 'Tools.mk') }}
restore-keys: test-${{ runner.os }}-${{ runner.arch }}-go-
- name: "Build packages (Installer, Debian, RPM)"
run: make dist
# In order to share the built artifacts in the subsequent tests, we use cache instead of actions/upload-artifacts.
# The reason is that upload-artifacts are not globally consistent and sometimes pre_release_test won't be able to
# find the artifacts uploaded here. See https://github.com/actions/upload-artifact/issues/21 for more context.
# Downside of this is extra cache pressure per repository, but these per-run caches expire automatically.
- uses: actions/cache@v5
id: cache
with:
# Use share the cache containing archives across OSes.
enableCrossOsArchive: true
# Note: this creates a cache per run.
key: release-artifacts-${{ github.run_id }}
path:
dist/
# pre_release_test tests the artifacts built by pre_release in the OS dependent way.
pre_release_test:
needs: packaging
name: Pre-release test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # don't fail fast as sometimes failures are arch/OS specific
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-26]
steps:
- uses: actions/checkout@v6
- uses: actions/cache@v5
id: cache
with:
# We need this cache to run tests.
fail-on-cache-miss: true
enableCrossOsArchive: true
key: release-artifacts-${{ github.run_id }}
path: dist/
- name: "Test Debian package"
if: runner.os == 'Linux'
run: packaging/nfpm/verify_deb.sh
- name: "Test RPM package (CentOS)"
if: runner.os == 'Linux'
run: docker run --rm -v $PWD:/work --entrypoint packaging/nfpm/verify_rpm.sh ${CENTOS_IMAGE}
env: # CENTOS_IMAGE was built by internal-images.yml
CENTOS_IMAGE: ghcr.io/tetratelabs/func-e-internal:centos-9