Refactor GitHub workflows
This mostly simplifies our GitHub actions, but also fixes recent breaking in the release workflows, unifies the tagged and nightly release workflows, and moves to using `gh release` to manage releases. Signed-off-by: Jonathon Anderson <janderson@ciq.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
name: "Changelog Enforcer"
|
||||
name: "changelog"
|
||||
on:
|
||||
pull_request:
|
||||
# The specific activity types are listed here to include "labeled" and "unlabeled"
|
||||
111
.github/workflows/check.yml
vendored
111
.github/workflows/check.yml
vendored
@@ -1,111 +0,0 @@
|
||||
---
|
||||
name: check
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- 'v4.*.x'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'v4.*.x'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Check Warewulf code with golang linter (golang ${{ matrix.go-version }})
|
||||
run: make lint staticcheck
|
||||
|
||||
vet:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Vet Warewulf code (golang ${{ matrix.go-version }})
|
||||
run: make vet
|
||||
|
||||
fmt:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Check Warewulf code for formatting (golang ${{ matrix.go-version }})
|
||||
run: test "$(make -s fmt | wc -l)" == 0
|
||||
|
||||
deadcode:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Check for dead Warewulf code (golang ${{ matrix.go-version }})
|
||||
run: make deadcode
|
||||
|
||||
licenses:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
- name: Check for out-of-date license information
|
||||
run: make LICENSE_DEPENDENCIES.md && git diff --quiet LICENSE_DEPENDENCIES.md
|
||||
|
||||
testsuite:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Run the test suite (golang ${{ matrix.go-version }})
|
||||
run: make test
|
||||
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- uses: ./.github/actions/prepare
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- name: Build Warewulf (golang ${{ matrix.go-version }})
|
||||
run: make all
|
||||
76
.github/workflows/nightly-release.yml
vendored
76
.github/workflows/nightly-release.yml
vendored
@@ -1,76 +0,0 @@
|
||||
---
|
||||
name: nightly
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
schedule:
|
||||
- cron: '05 00 * * *'
|
||||
|
||||
jobs:
|
||||
generate:
|
||||
name: Generate spec, dist and collect commits info
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
should-continue: ${{ steps.generate.outputs.should-continue }}
|
||||
version: ${{ steps.generate.outputs.version }}
|
||||
release-id: ${{ steps.generate.outputs.release-id }}
|
||||
permissions: write-all
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: generate warewulf spec, dist and collect commits info
|
||||
uses: ./.github/actions/generate
|
||||
id: generate
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
event-id: ${{ github.event.release.id }}
|
||||
|
||||
publish:
|
||||
name: Build and publish releases
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
needs: generate
|
||||
if: needs.generate.outputs.should-continue == 'true'
|
||||
container:
|
||||
image: rockylinux/rockylinux:9
|
||||
options: --privileged
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64, aarch64]
|
||||
dist: [el9, el8, suse.lp155]
|
||||
include:
|
||||
- dist: el8
|
||||
target: rocky+epel-8 #-arch
|
||||
- dist: el9
|
||||
target: rocky+epel-9
|
||||
- dist: suse.lp155
|
||||
target: opensuse-leap-15.5
|
||||
- arch: x86_64
|
||||
runs-on: ubuntu-24.04
|
||||
upload-source: 'true'
|
||||
- arch: aarch64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
|
||||
permissions: write-all
|
||||
|
||||
steps:
|
||||
- name: Install git
|
||||
run: |
|
||||
dnf install -y git
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: build rpms
|
||||
uses: ./.github/actions/rpm
|
||||
id: rpm
|
||||
with:
|
||||
dist: ${{ matrix.dist }}
|
||||
arch: ${{ matrix.arch }}
|
||||
target: ${{ matrix.target }}-${{ matrix.arch }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: ${{ needs.generate.outputs.version }}
|
||||
event-id: ${{ needs.generate.outputs.release-id }}
|
||||
upload-source: ${{ matrix.upload-source }}
|
||||
168
.github/workflows/release.yml
vendored
Normal file
168
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
---
|
||||
name: release
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
schedule:
|
||||
- cron: '05 00 * * *'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
dist:
|
||||
name: Build warewulf.spec and source dist
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
has-recent-commits: ${{ steps.commits.outputs.has-recent-commits }}
|
||||
commits: ${{ steps.commits.outputs.commits }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Get commit logs (nightly)
|
||||
if: github.event_name == 'schedule'
|
||||
id: commits
|
||||
shell: bash
|
||||
run: |
|
||||
echo "commits=$(git log --since="$(date -d '24 hours ago' --iso-8601)" --oneline | base64 --wrap=0)" >>$GITHUB_OUTPUT
|
||||
if git log --since="$(date -d '24 hours ago' --iso-8601)" --oneline | grep -q .; then
|
||||
echo "has-recent-commits=true" >>$GITHUB_OUTPUT
|
||||
else
|
||||
echo "has-recent-commits=false" >>$GITHUB_OUTPUT
|
||||
echo "No commits found in the last 24 hours"
|
||||
fi
|
||||
|
||||
- name: Build spec and dist
|
||||
run: |
|
||||
make warewulf.spec dist
|
||||
|
||||
- name: Upload spec
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: warewulf-spec
|
||||
retention-days: 7
|
||||
path: |
|
||||
warewulf.spec
|
||||
|
||||
- name: Upload dist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: warewulf-dist
|
||||
retention-days: 7
|
||||
path: |
|
||||
warewulf-*.tar.gz
|
||||
|
||||
rpms:
|
||||
needs: dist
|
||||
if: github.event_name != 'schedule' || needs.dist.outputs.has-recent-commits == 'true'
|
||||
name: Build RPMs
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
container:
|
||||
image: rockylinux/rockylinux:9
|
||||
options: --privileged
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64, aarch64]
|
||||
dist: [el9, el8, suse.lp155]
|
||||
include:
|
||||
- dist: el8
|
||||
target: rocky+epel-8
|
||||
- dist: el9
|
||||
target: rocky+epel-9
|
||||
- dist: suse.lp155
|
||||
target: opensuse-leap-15.5
|
||||
- arch: x86_64
|
||||
runs-on: ubuntu-24.04
|
||||
- arch: aarch64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Prepare mock
|
||||
run: |
|
||||
dnf -y install epel-release
|
||||
dnf -y install rpm-build mock
|
||||
usermod -a -G mock $(whoami)
|
||||
echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg
|
||||
|
||||
- name: Download spec
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: warewulf-spec
|
||||
|
||||
- name: Download dist
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: warewulf-dist
|
||||
|
||||
- name: Build RPMs and run tests
|
||||
run: |
|
||||
root="${{ matrix.target }}-${{ matrix.arch }}"
|
||||
eol_root="/etc/mock/eol/${root}.cfg"
|
||||
if [ -f "${eol_root}" ]
|
||||
then
|
||||
root="${eol_root}"
|
||||
fi
|
||||
mock --root="${root}" --rebuild --spec=warewulf.spec --sources=. \
|
||||
&& mock --root="${root}" --chroot -- bash -c "make -C /builddir/build/BUILD/warewulf-*/ test"
|
||||
|
||||
- name: Upload RPMs
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: warewulf-rpms-${{ matrix.target }}-${{ matrix.arch }}
|
||||
retention-days: 7
|
||||
path: |
|
||||
/var/lib/mock/${{ matrix.target }}-${{ matrix.arch }}/result/warewulf-*.rpm
|
||||
|
||||
release:
|
||||
needs: [dist, rpms]
|
||||
if: github.event_name == 'push' || (github.event_name == 'schedule' && needs.dist.outputs.has-recent-commits == 'true')
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: artifacts/
|
||||
merge-multiple: true
|
||||
|
||||
- name: Delete previous release (nightly)
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
gh release delete "nightly" \
|
||||
--repo ${{ github.repository }} \
|
||||
--cleanup-tag --yes \
|
||||
|| echo "No previous nightly release found"
|
||||
|
||||
- name: Create release (tagged)
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
gh release create "${{ github.ref_name }}" \
|
||||
artifacts/*.tar.gz \
|
||||
artifacts/*.rpm \
|
||||
--repo ${{ github.repository }} \
|
||||
--title "${{ github.ref_name }}" \
|
||||
--draft
|
||||
|
||||
- name: Create release (nightly)
|
||||
if: github.event_name == 'schedule'
|
||||
run: |
|
||||
COMMITS=$(echo "${{ needs.dist.outputs.commits }}" | base64 --decode)
|
||||
gh release create "nightly" \
|
||||
artifacts/*.tar.gz \
|
||||
artifacts/*.rpm \
|
||||
--repo ${{ github.repository }} \
|
||||
--title "nightly" \
|
||||
--prerelease \
|
||||
--notes "NIGHTLY RELEASE
|
||||
|
||||
Commits from the last 24 hours:
|
||||
|
||||
${COMMITS}"
|
||||
96
.github/workflows/tagged-release.yml
vendored
96
.github/workflows/tagged-release.yml
vendored
@@ -1,96 +0,0 @@
|
||||
---
|
||||
name: tagged-release
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
push:
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
permissions: write-all
|
||||
|
||||
jobs:
|
||||
dist:
|
||||
name: Checkout code and build warewulf.spec and dist
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build spec and dist
|
||||
run: |
|
||||
make warewulf.spec dist
|
||||
|
||||
- name: Upload spec and dist
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: spec-and-dist
|
||||
path: |
|
||||
warewulf.spec
|
||||
warewulf-*.tar.gz
|
||||
|
||||
- name: Attach dist to release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
delete_file: "warewulf-*.tar.gz;warewulf-*.rpm"
|
||||
file: warewulf-*.tar.gz
|
||||
tags: true
|
||||
|
||||
rpm:
|
||||
name: Build RPMs
|
||||
needs: dist
|
||||
runs-on: ${{ matrix.runs-on }}
|
||||
container:
|
||||
image: rockylinux/rockylinux:9
|
||||
options: --privileged
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
arch: [x86_64, aarch64]
|
||||
dist: [el9, el8, suse.lp155]
|
||||
include:
|
||||
- dist: el8
|
||||
target: rocky+epel-8 #-arch
|
||||
- dist: el9
|
||||
target: rocky+epel-9
|
||||
- dist: suse.lp155
|
||||
target: opensuse-leap-15.5
|
||||
- arch: x86_64
|
||||
runs-on: ubuntu-24.04
|
||||
- arch: aarch64
|
||||
runs-on: ubuntu-24.04-arm
|
||||
steps:
|
||||
- name: Prepare mock and rpm-build
|
||||
run: |
|
||||
dnf -y install epel-release
|
||||
dnf -y install mock rpm-build
|
||||
echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg
|
||||
|
||||
- name: Download dist and spec
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: spec-and-dist
|
||||
|
||||
- name: Build RPMs and run tests
|
||||
run: |
|
||||
root="${{ matrix.target }}-${{ matrix.arch }}"
|
||||
eol_root="/etc/mock/eol/${root}.cfg"
|
||||
if [ -f "${eol_root}" ]
|
||||
then
|
||||
root="${eol_root}"
|
||||
fi
|
||||
mock --root="${root}" --rebuild --spec=warewulf.spec --sources=. \
|
||||
&& mock --root="${root}" --chroot -- bash -c "make -C /builddir/build/BUILD/warewulf-*/ test"
|
||||
|
||||
- name: Attach RPM and SRPM to release
|
||||
uses: xresloader/upload-to-github-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
file: "/var/lib/mock/${{ matrix.target }}-${{ matrix.arch }}/result/warewulf-*.rpm"
|
||||
tags: true
|
||||
51
.github/workflows/testsuite.yml
vendored
Normal file
51
.github/workflows/testsuite.yml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: testsuite
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- 'v4.*.x'
|
||||
paths-ignore:
|
||||
- 'docs/**'
|
||||
|
||||
jobs:
|
||||
testsuite:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
go-version: ['1.22', '1.23']
|
||||
steps:
|
||||
- name: Checkout Warewulf
|
||||
uses: actions/checkout@v4
|
||||
- name: Install gpgme (dependency)
|
||||
run: |
|
||||
sudo apt update \
|
||||
&& sudo apt-get install libgpgme-dev
|
||||
shell: bash
|
||||
- name: Setup go ${{ matrix.go-version }}
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: true
|
||||
- name: Prepare Warewulf
|
||||
shell: bash
|
||||
run: |
|
||||
make config
|
||||
make vendor
|
||||
- name: Check for out-of-date license information
|
||||
run: make LICENSE_DEPENDENCIES.md && git diff --quiet LICENSE_DEPENDENCIES.md
|
||||
- name: Check Warewulf code with golang linter (golang ${{ matrix.go-version }})
|
||||
run: make lint
|
||||
- name: Check Warewulf code with staticcheck (golang ${{ matrix.go-version }})
|
||||
run: make staticcheck
|
||||
- name: Vet Warewulf code (golang ${{ matrix.go-version }})
|
||||
run: make vet
|
||||
- name: Check Warewulf code for formatting (golang ${{ matrix.go-version }})
|
||||
run: test "$(make -s fmt | wc -l)" == 0
|
||||
- name: Check for dead Warewulf code (golang ${{ matrix.go-version }})
|
||||
run: make deadcode
|
||||
- name: Run the test suite (golang ${{ matrix.go-version }})
|
||||
run: make test
|
||||
- name: Build Warewulf (golang ${{ matrix.go-version }})
|
||||
run: make all
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
name: publish_docs
|
||||
name: userdocs
|
||||
|
||||
on:
|
||||
workflow_dispatch: {}
|
||||
@@ -22,28 +22,17 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v5
|
||||
|
||||
- name: Update repositories
|
||||
- name: prepare
|
||||
run: |
|
||||
sudo apt update
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get install -f -y texlive-latex-extra latexmk graphviz pandoc
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v5
|
||||
|
||||
- name: Install Sphinx
|
||||
run: |
|
||||
pip install --user --upgrade --upgrade-strategy eager sphinx sphinx-rtd-theme restructuredtext_lint pygments sphinx_reredirects
|
||||
|
||||
- name: Include reference docs
|
||||
run: |
|
||||
make reference
|
||||
|
||||
- name: Include man pages
|
||||
- name: make generated docs
|
||||
run: |
|
||||
make docs
|
||||
mkdir -p userdocs/reference/man5
|
||||
for f in docs/man/man5/*.5
|
||||
do
|
||||
@@ -54,11 +43,11 @@ jobs:
|
||||
pandoc -f man -t rst "$f" >> "$output"
|
||||
done
|
||||
|
||||
- name: Build web documentation
|
||||
- name: build userdocs
|
||||
run: |
|
||||
make -C userdocs html
|
||||
|
||||
- name: Install SSH key
|
||||
- name: publish docs to github.com/warewulf/warewulf.org
|
||||
if: github.event_name != 'pull_request'
|
||||
env:
|
||||
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
|
||||
@@ -74,10 +63,6 @@ jobs:
|
||||
EOT
|
||||
git config --global user.email "actions@github.com"
|
||||
git config --global user.name "gh-actions"
|
||||
|
||||
- name: Update website repo
|
||||
if: github.event_name != 'pull_request'
|
||||
run: |
|
||||
git clone git@github.com:warewulf/warewulf.org.git ~/warewulf-web
|
||||
mkdir -p ~/warewulf-web/static/docs
|
||||
rm -rf ~/warewulf-web/static/docs/${GITHUB_REF##*/}
|
||||
Reference in New Issue
Block a user