Release build #3
Workflow file for this run
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: Release build | |
| permissions: | |
| contents: write | |
| actions: write | |
| on: | |
| push: | |
| tags: | |
| - "[0-9]+.[0-9]+.[0-9]+" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to build' | |
| required: true | |
| jobs: | |
| clippy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Lint | |
| run: | | |
| cargo clippy -- -D warnings | |
| cargo clippy --release -- -D warnings | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - run: | | |
| sudo apt update && sudo apt install -y libnss-wrapper scdoc | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Test | |
| env: | |
| NSS_WRAPPER_PASSWD: contrib/fixtures/passwd | |
| NSS_WRAPPER_GROUP: contrib/fixtures/group | |
| run: | | |
| cargo test | |
| LD_PRELOAD=libnss_wrapper.so cargo test --features nsswrapper nsswrapper_ | |
| - name: Generate manpage | |
| run: | | |
| scdoc < contrib/man/tuigreet-1.scd > /dev/null | |
| build: | |
| strategy: | |
| matrix: | |
| arch: | |
| - { name: "x86_64", os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", cross: false } | |
| - { name: "aarch64", os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", cross: true } | |
| - { name: "i686", os: "ubuntu-latest", target: "i686-unknown-linux-gnu", cross: true } | |
| - { name: "armv7", os: "ubuntu-latest", target: "armv7-unknown-linux-gnueabihf", cross: true } | |
| runs-on: ${{ matrix.arch.os }} | |
| steps: | |
| - name: Get the version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "VERSION=${{ inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.arch.target }} | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| shared-key: cargo-cache-${{ matrix.arch.target }} | |
| - name: Install cross | |
| run: cargo install cross | |
| - name: Build | |
| run: | | |
| cross build --release --target=${{ matrix.arch.target }} | |
| - name: Rename artifact | |
| run: mv target/${{ matrix.arch.target }}/release/tuigreet target/${{ matrix.arch.target }}/release/tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }} | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }} | |
| path: target/${{ matrix.arch.target }}/release/tuigreet-${{ steps.version.outputs.VERSION }}-${{ matrix.arch.name }} | |
| release: | |
| runs-on: ubuntu-latest | |
| needs: build | |
| steps: | |
| - name: Get the version | |
| id: version | |
| run: | | |
| if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
| echo "VERSION=${{ inputs.tag }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: target/out | |
| - name: Create release | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| name: ${{ steps.version.outputs.VERSION }} | |
| prerelease: false | |
| tag: refs/tags/${{ steps.version.outputs.VERSION }} | |
| artifacts: target/out/*/* |