Merge pull request #149 from DrDaveD/prepare-2.6 #162
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: Build and test | |
| on: | |
| # run workflows on main master and release/** branches | |
| push: | |
| branches: | |
| - main | |
| - master | |
| - release/** | |
| # run workflows on pull requests against the same branches | |
| pull_request: | |
| branches: | |
| - main | |
| - master | |
| - release/** | |
| # automatically cancel redundant builds | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| tarball: | |
| name: Tarball | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Get source code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install build requirements | |
| run: python -m pip install build | |
| - name: Create distributions | |
| run: python -m build . --sdist --wheel --outdir . | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: tarball | |
| path: htgettoken-*.tar.* | |
| if-no-files-found: error | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheel | |
| path: htgettoken*.whl | |
| if-no-files-found: error | |
| # -- RPM builds -- | |
| # Build the Source RPM | |
| rhel-srpm: | |
| name: EL ${{ matrix.version }} (${{ matrix.distro }}) source package | |
| needs: | |
| - tarball | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Build for Rockylinux >=8 | |
| include: | |
| - distro: rockylinux | |
| version: 8 | |
| - distro: rockylinux | |
| version: 9 | |
| runs-on: ubuntu-latest | |
| container: ${{ matrix.distro }}:${{ matrix.version }} | |
| env: | |
| TARBALL: "htgettoken-*.tar.*" | |
| steps: | |
| - name: Download tarball | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: tarball | |
| - name: Configure SRPM build tools | |
| run: | | |
| dnf -y install \ | |
| "*-srpm-macros" \ | |
| rpm-build \ | |
| ; | |
| - name: Create source package | |
| run: rpmbuild -ts --define "_srcrpmdir $(pwd)" ${TARBALL} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: srpm-${{ matrix.distro }}-${{ matrix.version }} | |
| path: "*.src.rpm" | |
| if-no-files-found: error | |
| # Build the binary RPM(s) | |
| rhel-rpm: | |
| name: EL ${{ matrix.version }} (${{ matrix.distro }}) binary package(s) | |
| needs: | |
| - rhel-srpm | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Build for Rockylinux >=8 | |
| include: | |
| - distro: rockylinux | |
| version: 8 | |
| - distro: rockylinux | |
| version: 9 | |
| runs-on: ubuntu-latest | |
| container: ${{ matrix.distro }}:${{ matrix.version }} | |
| steps: | |
| - name: Download SRPM | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: srpm-${{ matrix.distro }}-${{ matrix.version }} | |
| # on RL9 python3-wheel is provided via 'CRB' | |
| - name: Enable CRB (Rocky Linux >=9) | |
| if: matrix.version >= 9 | |
| run: | | |
| dnf -y -q install "dnf-command(config-manager)" | |
| dnf config-manager --set-enabled crb | |
| - name: Configure EPEL | |
| run: dnf -y install epel-release | |
| - name: Install build tools | |
| run: | | |
| dnf -y -q install \ | |
| rpm-build \ | |
| "dnf-command(builddep)" \ | |
| ; | |
| - name: Install build dependencies | |
| run: dnf builddep -y htgettoken-*.src.rpm | |
| - name: List installed packages | |
| run: dnf list installed | |
| - name: Build binary packages | |
| run: | | |
| rpmbuild --rebuild --define "_rpmdir $(pwd)" htgettoken-*.src.rpm | |
| rm -f *.src.rpm | |
| mv */*.rpm . | |
| - name: Print package info | |
| run: | | |
| # print contents of packages | |
| for rpmf in *.rpm; do | |
| echo "===== ${rpmf} =======" | |
| rpm --query --package "${rpmf}" --info | |
| echo "----- Files: --------" | |
| rpm --query --package "${rpmf}" --list | |
| echo "----- Provides: -----" | |
| rpm --query --package "${rpmf}" --provides | |
| echo "----- Requires: -----" | |
| rpm --query --package "${rpmf}" --requires | |
| done | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: rpm-${{ matrix.distro }}-${{ matrix.version }} | |
| path: "*.rpm" | |
| if-no-files-found: error | |
| # Install the binary RPM(s) and sanity check | |
| rhel-install: | |
| name: EL ${{ matrix.version }} (${{ matrix.distro }}) install test | |
| needs: | |
| - rhel-rpm | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Build for Rockylinux >=8 | |
| include: | |
| - distro: rockylinux | |
| version: 8 | |
| - distro: rockylinux | |
| version: 9 | |
| runs-on: ubuntu-latest | |
| container: ${{ matrix.distro }}:${{ matrix.version }} | |
| steps: | |
| - name: Download RPMs | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: rpm-${{ matrix.distro }}-${{ matrix.version }} | |
| - name: Configure EPEL | |
| run: dnf -y install epel-release | |
| - name: Install RPMs | |
| run: dnf -y install *.rpm | |
| - name: Test htgettoken | |
| run: /usr/bin/htgettoken --help |