From 0cb9354364433a67b610278632cf46e3388f7045 Mon Sep 17 00:00:00 2001 From: Jonathon Anderson Date: Mon, 7 Jul 2025 17:32:02 -0600 Subject: [PATCH] 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 --- .github/actions/generate/action.yml | 128 ------------- .github/actions/prepare/action.yml | 31 ---- .github/actions/rpm/action.yml | 107 ----------- .../{changelog-enforcer.yml => changelog.yml} | 2 +- .github/workflows/check.yml | 111 ------------ .github/workflows/nightly-release.yml | 76 -------- .github/workflows/release.yml | 168 ++++++++++++++++++ .github/workflows/tagged-release.yml | 96 ---------- .github/workflows/testsuite.yml | 51 ++++++ .../{documentation.yml => userdocs.yml} | 29 +-- 10 files changed, 227 insertions(+), 572 deletions(-) delete mode 100644 .github/actions/generate/action.yml delete mode 100644 .github/actions/prepare/action.yml delete mode 100644 .github/actions/rpm/action.yml rename .github/workflows/{changelog-enforcer.yml => changelog.yml} (96%) delete mode 100644 .github/workflows/check.yml delete mode 100644 .github/workflows/nightly-release.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/tagged-release.yml create mode 100644 .github/workflows/testsuite.yml rename .github/workflows/{documentation.yml => userdocs.yml} (80%) diff --git a/.github/actions/generate/action.yml b/.github/actions/generate/action.yml deleted file mode 100644 index 3c64063e..00000000 --- a/.github/actions/generate/action.yml +++ /dev/null @@ -1,128 +0,0 @@ -name: 'Generate warewulf metadata' -description: 'Generate warewulf.spec and dist, collect commits info' - -inputs: - token: - description: "Github token" - required: true - event-id: - description: "Github event id" - required: true - -outputs: - should-continue: - description: "Whether other jobs should continue" - value: ${{ steps.should-continue.outputs.continue }} - version: - description: "Version value" - value: ${{ steps.dist.outputs.version }} - release-id: - description: "First stage release id" - value: ${{ steps.release.outputs.id }} - -runs: - using: "composite" - steps: - - name: Extract current branch tag - run: | - echo "BRANCH=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - echo "TAG=`./script/get-version.sh`" >> $GITHUB_ENV - shell: bash - - - name: Extract last 24 hours commits info - id: commits - run: | - echo "raw=`git reflog ${{ env.BRANCH }} --since="24 hours ago"`" >> $GITHUB_OUTPUT - echo "commits=`git log ${{ env.BRANCH }} --pretty --since="24 hours ago" | jq --raw-input . | jq --slurp . | jq -c .`" >> $GITHUB_OUTPUT - shell: bash - - - name: Whether should continue - id: should-continue - run: | - if [[ "${{ steps.commits.outputs.raw }}" ]]; then - echo "continue=true" >> $GITHUB_OUTPUT - else - echo "continue=false" >> $GITHUB_OUTPUT - fi - shell: bash - - - name: Build spec and dist - if: steps.should-continue.outputs.continue == 'true' - run: | - make warewulf.spec dist - shell: bash - - - name: Set DIST - if: steps.should-continue.outputs.continue == 'true' - id: dist - run: | - dist="warewulf-${{ env.TAG }}.tar.gz" - - if [[ ! -f "$dist" ]];then - for f in warewulf-*.tar.gz; do - if [[ -e "$f" ]]; then - dist="$f" - break - fi - done - fi - echo "DIST=$dist" >> $GITHUB_ENV - - version=`echo $dist | sed 's/warewulf-//' | sed 's/\.tar\.gz//'` - echo "version=$version" >> $GITHUB_OUTPUT - shell: bash - - - name: Upload warewulf.spec - if: steps.should-continue.outputs.continue == 'true' - uses: actions/upload-artifact@v4 - with: - name: warewulf.spec - path: warewulf.spec - - - name: Upload DIST - if: steps.should-continue.outputs.continue == 'true' - uses: actions/upload-artifact@v4 - with: - name: ${{ env.DIST }} - path: ${{ env.DIST }} - - - name: Write nightly release content - if: steps.should-continue.outputs.continue == 'true' - run: | - cat << EOF >> nightly.release.note - THIS IS A NIGHTLY RELEASE - - This release contains latest commits, which is a feature unstable version - - Reflog: - ${{ steps.commits.outputs.raw }} - - Commits: - ${{ steps.commits.outputs.commits }} - EOF - shell: bash - - - name: Nightly dist release - uses: xresloader/upload-to-github-release@v1 - if: steps.should-continue.outputs.continue == 'true' - env: - GITHUB_TOKEN: ${{ inputs.token }} - with: - release_id: ${{ inputs.event-id }} - delete_file: "warewulf-*.tar.gz;warewulf-*.rpm" - file: ${{ env.DIST }} - tag_name: "nightly" - prerelease: true - draft: false - default_release_name: "warewulf nightly release" - - - name: Update nightly release content - if: steps.should-continue.outputs.continue == 'true' - uses: tubone24/update_release@v1.3.1 - id: release - env: - GITHUB_TOKEN: ${{ inputs.token }} - TAG_NAME: "nightly" - with: - body_path: nightly.release.note - diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml deleted file mode 100644 index 905a2cf3..00000000 --- a/.github/actions/prepare/action.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: 'Prepare Warewulf' -description: 'Prepare environment and Warewulf source code for testing and building' -inputs: - go-version: - description: "go version" - required: true - -runs: - using: "composite" - steps: - - name: Update apt - run: sudo apt update - shell: bash - - - name: Install gpgme (dependency) - run: sudo apt-get install libgpgme-dev - shell: bash - - - name: Setup go ${{ inputs.go-version }} - uses: actions/setup-go@v5 - with: - go-version: ${{ inputs.go-version }} - cache: true - - - name: Configure Warewulf - run: make config - shell: bash - - - name: Prepare vendor directory - run: make vendor - shell: bash diff --git a/.github/actions/rpm/action.yml b/.github/actions/rpm/action.yml deleted file mode 100644 index 30167f40..00000000 --- a/.github/actions/rpm/action.yml +++ /dev/null @@ -1,107 +0,0 @@ -name: 'Build RPMs' -description: 'Build warewulf rpms' - -inputs: - dist: - description: "distro dist" - required: true - arch: - description: "distro arch" - required: true - target: - description: "distro target" - required: true - token: - description: "Github token" - required: true - version: - description: "Version value" - required: true - event-id: - description: "Github event id" - required: true - upload-source: - description: "Upload source" - required: false - default: 'false' - -runs: - using: "composite" - steps: - - name: Install EPEL - run: dnf -y install epel-release - shell: bash - - - name: Install mock and rpm-build - run: | - dnf -y install mock rpm-build - echo "config_opts['print_main_output'] = True" >>/etc/mock/site-defaults.cfg - shell: bash - - - name: Download spec - uses: actions/download-artifact@v4 - with: - name: warewulf.spec - - - name: Set the expected version - run: | - echo "EXPECTED_VERSION=${{ inputs.version }}" >> $GITHUB_ENV - shell: bash - - - name: Download dist - uses: actions/download-artifact@v4 - with: - name: warewulf-${{ env.EXPECTED_VERSION }}.tar.gz - - - name: Set RPM and SRPM - run: | - VERSION=$(rpm -q --qf "%{VERSION}\n" --specfile warewulf.spec | head -1) - GENERIC_RELEASE=$(rpm -q --qf "%{RELEASE}\n" --specfile warewulf.spec | cut -d. -f1 | head -1) - RPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.${{ inputs.arch }}.rpm - SRPM=warewulf-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.src.rpm - DRACUT=warewulf-dracut-${VERSION}-${GENERIC_RELEASE}.${{ inputs.dist }}.noarch.rpm - echo "RPM=${RPM}" >> $GITHUB_ENV - echo "SRPM=${SRPM}" >> $GITHUB_ENV - echo "DRACUT=${DRACUT}" >> $GITHUB_ENV - shell: bash - - - name: Build RPMs and run tests - run: | - root="${{ inputs.target }}" - 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 -- make -C /builddir/build/BUILD/warewulf-${{ env.EXPECTED_VERSION }} test - shell: bash - - - name: Upload RPM - uses: actions/upload-artifact@v4 - with: - name: ${{ env.RPM }} - path: /var/lib/mock/${{ inputs.target }}/result/${{ env.RPM }} - - - name: Upload SRPM - if: ${{ inputs.upload-source == 'true' }} - uses: actions/upload-artifact@v4 - with: - name: ${{ env.SRPM }} - path: /var/lib/mock/${{ inputs.target }}/result/${{ env.SRPM }} - - - name: Upload dracut RPM - uses: actions/upload-artifact@v4 - with: - name: ${{ env.DRACUT }} - path: /var/lib/mock/${{ inputs.target }}/result/${{ env.DRACUT }} - if-no-files-found: 'ignore' - - - name: Attach all files to release - uses: xresloader/upload-to-github-release@v1 - env: - GITHUB_TOKEN: ${{ inputs.token }} - with: - release_id: ${{ inputs.event-id }} - file: " warewulf-${{ env.EXPECTED_VERSION }}.tar.gz;/var/lib/mock/${{ inputs.target }}/result/${{ env.RPM }};/var/lib/mock/${{ inputs.target }}/result/${{ env.SRPM }};/var/lib/mock/${{ inputs.target }}/result/${{ env.DRACUT }}" - overwrite: true diff --git a/.github/workflows/changelog-enforcer.yml b/.github/workflows/changelog.yml similarity index 96% rename from .github/workflows/changelog-enforcer.yml rename to .github/workflows/changelog.yml index e762f52a..d2d739fc 100644 --- a/.github/workflows/changelog-enforcer.yml +++ b/.github/workflows/changelog.yml @@ -1,4 +1,4 @@ -name: "Changelog Enforcer" +name: "changelog" on: pull_request: # The specific activity types are listed here to include "labeled" and "unlabeled" diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index 7d0ff335..00000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/nightly-release.yml b/.github/workflows/nightly-release.yml deleted file mode 100644 index 2da3da77..00000000 --- a/.github/workflows/nightly-release.yml +++ /dev/null @@ -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 }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..539d734d --- /dev/null +++ b/.github/workflows/release.yml @@ -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}" diff --git a/.github/workflows/tagged-release.yml b/.github/workflows/tagged-release.yml deleted file mode 100644 index 7110c6db..00000000 --- a/.github/workflows/tagged-release.yml +++ /dev/null @@ -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 diff --git a/.github/workflows/testsuite.yml b/.github/workflows/testsuite.yml new file mode 100644 index 00000000..933c50f2 --- /dev/null +++ b/.github/workflows/testsuite.yml @@ -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 diff --git a/.github/workflows/documentation.yml b/.github/workflows/userdocs.yml similarity index 80% rename from .github/workflows/documentation.yml rename to .github/workflows/userdocs.yml index 35b5c0b3..dcdc0203 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/userdocs.yml @@ -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##*/}