Main workflow #2648
This file contains hidden or 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: Main workflow | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| schedule: | |
| - cron: '17 14 * * *' | |
| jobs: | |
| dist: | |
| strategy: | |
| fail-fast: true | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Allow unprivileged user namespaces (for Ubuntu 24.04) | |
| run: | | |
| sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install expect mergerfs attr pandoc | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Check autoscan | |
| run: | | |
| autoscan | tee autoscan.out | |
| ! [ -s autoscan.out ] | |
| - name: Configure and build manpage | |
| run: | | |
| autoconf | |
| ./configure | |
| make dist | |
| - name: Upload dist tarball | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: try-dist.tgz | |
| path: try-*.tgz | |
| - name: Package packaging assets | |
| run: | | |
| tar czf packaging.tgz packaging | |
| - name: Upload packaging assets | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: packaging-assets | |
| path: packaging.tgz | |
| package: | |
| needs: [dist, test-dist] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install -y rpm | |
| - name: Download dist tarball | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-dist.tgz | |
| - name: Download packaging assets | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: packaging-assets | |
| - name: Unpack tarballs | |
| run: | | |
| tar xzf try-*.tgz --strip-components=1 | |
| tar xzf packaging.tgz | |
| rm -f try-*.tgz packaging.tgz | |
| - name: Build .deb and .rpm | |
| run: | | |
| packaging/build_packages.sh | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: try-packages | |
| path: | | |
| dist-packages/try*.deb | |
| dist-packages/try*.rpm | |
| test-dist: | |
| needs: dist | |
| strategy: | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.draft == false | |
| steps: | |
| - name: Allow unprivileged user namespaces (for Ubuntu 24.04) | |
| run: | | |
| sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install expect mergerfs attr pandoc | |
| - name: Download dist tarball | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-dist.tgz | |
| - name: Unpack tarball; configure and build utilities | |
| run: | | |
| tar xzf try-*.tgz --strip-components=1 | |
| rm try-*.tgz | |
| ./configure --disable-utils | |
| make all | |
| sudo make install | |
| - name: Run tests with shell fallbacks | |
| run: | | |
| ! which try-summary | |
| ! which try-commit | |
| scripts/run_tests.sh | |
| - name: Clean up build | |
| run: | | |
| sudo make clean | |
| - name: Install utilities | |
| run: | | |
| autoconf | |
| ./configure | |
| make all | |
| sudo make install | |
| - name: Run tests with utilities | |
| run: | | |
| which try-summary | |
| which try-commit | |
| scripts/run_tests.sh | |
| - name: Check manpage | |
| run: | | |
| man -w try | |
| test-checkout: | |
| strategy: | |
| fail-fast: false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Allow unprivileged user namespaces (for Ubuntu 24.04) | |
| run: | | |
| sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get install expect mergerfs attr pandoc | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Configure and build utilities | |
| run: | | |
| autoconf | |
| ./configure --disable-utils | |
| make all | |
| sudo make install | |
| - name: Run tests with shell fallbacks | |
| run: | | |
| ! which try-summary | |
| ! which try-commit | |
| scripts/run_tests.sh | |
| - name: Clean up build | |
| run: | | |
| sudo make clean | |
| - name: Install utilities | |
| run: | | |
| autoconf | |
| ./configure | |
| make all | |
| sudo make install | |
| - name: Run tests with utilities | |
| run: | | |
| which try-summary | |
| which try-commit | |
| scripts/run_tests.sh | |
| - name: Check manpage | |
| run: | | |
| man -w try | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Run scripts/lint.sh | |
| run: scripts/lint.sh | |
| trycase-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Run check_trycase.sh | |
| run: scripts/check_trycase.sh | |
| version-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Check version consistency (script, manpage, include) | |
| run: scripts/check_version.sh | |
| shellcheck: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Run ShellCheck | |
| uses: ludeeus/action-shellcheck@master | |
| with: | |
| ignore_paths: >- | |
| completions | |
| ./configure | |
| ./install-sh | |
| nix: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| - name: Allow unprivileged user namespaces (for Ubuntu 24.04) | |
| run: | | |
| sudo sysctl kernel.apparmor_restrict_unprivileged_userns=0 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@main | |
| - name: Run tests | |
| run: | | |
| nix-shell --run "sh scripts/run_tests.sh" | |
| tag-version-check: | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Check tag against declared versions | |
| run: scripts/check_version.sh "${GITHUB_REF_NAME#v}" | |
| smoke-test-deb: | |
| needs: package | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-packages | |
| - name: Install the .deb | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y ./try*.deb | |
| - name: Check installed version matches the tag | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| # try -v writes to stderr | |
| INSTALLED="$(try -v 2>&1 | awk '{print $NF}')" | |
| echo "installed: '$INSTALLED' expected: '$TAG_VERSION'" | |
| [ "$INSTALLED" = "$TAG_VERSION" ] | |
| - name: Check manpage is installed | |
| run: | | |
| man -w try | |
| smoke-test-rpm: | |
| needs: package | |
| runs-on: ubuntu-latest | |
| container: fedora:latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-packages | |
| - name: Install the .rpm | |
| run: | | |
| # fedora's container image sets tsflags=nodocs by default, which | |
| # would silently drop the manpage; override it for this install | |
| dnf install -y --setopt=tsflags= ./try*.rpm man-db | |
| - name: Check installed version matches the tag | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| # try -v writes to stderr | |
| INSTALLED="$(try -v 2>&1 | awk '{print $NF}')" | |
| echo "installed: '$INSTALLED' expected: '$TAG_VERSION'" | |
| [ "$INSTALLED" = "$TAG_VERSION" ] | |
| - name: Check manpage is installed | |
| run: | | |
| mandb | |
| man -w try | |
| release: | |
| needs: [tag-version-check, smoke-test-deb, smoke-test-rpm] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download dist tarball | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-dist.tgz | |
| - name: Download packages | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-packages | |
| - name: Publish release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| gh release create "$GITHUB_REF_NAME" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --title "$GITHUB_REF_NAME" \ | |
| --generate-notes \ | |
| try-*.tgz ./try*.deb ./try*.rpm | |
| prerelease: | |
| needs: | |
| - test-checkout | |
| - test-dist | |
| - version-check | |
| - lint | |
| - shellcheck | |
| - trycase-check | |
| - package | |
| runs-on: ubuntu-latest | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| steps: | |
| - name: Download dist tarball | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-dist.tgz | |
| - name: Download packages | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: try-packages | |
| - name: Rename tarball | |
| run: | | |
| mv try-*.tgz try-latest.tgz | |
| - name: Deploy 'latest' release | |
| uses: "marvinpinto/action-automatic-releases@latest" | |
| with: | |
| repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
| automatic_release_tag: "latest" | |
| prerelease: true | |
| title: "Latest distribution tarball" | |
| files: | | |
| try-latest.tgz | |
| try*.deb | |
| try*.rpm |