name: ci on: push: branches: - master pull_request: workflow_dispatch: jobs: test: runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest toolchain: x86_64-unknown-linux-musl - os: windows-latest toolchain: x86_64-pc-windows-msvc - os: macos-latest toolchain: x86_64-apple-darwin steps: - name: Checkout uses: actions/checkout@v3 - name: Cargo cache # https://github.com/actions/cache/blob/main/examples.md#rust---cargo uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable target: ${{ matrix.toolchain }} default: true - name: Test uses: actions-rs/cargo@v1 with: command: test args: --all-features build: if: github.ref == 'refs/heads/master' needs: - test runs-on: ${{ matrix.os }} strategy: matrix: include: - os: ubuntu-latest toolchain: x86_64-unknown-linux-musl platform: linux ext: - os: windows-latest toolchain: x86_64-pc-windows-msvc platform: windows ext: .exe - os: macos-latest toolchain: x86_64-apple-darwin platform: darwin ext: steps: - name: Checkout uses: actions/checkout@v3 - name: Cargo cache # https://github.com/actions/cache/blob/main/examples.md#rust---cargo uses: actions/cache@v3 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Install toolchain uses: actions-rs/toolchain@v1 with: profile: minimal toolchain: stable target: ${{ matrix.toolchain }} default: true - name: Build uses: actions-rs/cargo@v1 with: command: build args: --release --all-features - name: Bundle manpages uses: thedoctor0/zip-release@0.6.2 with: type: zip filename: manpages.zip path: ./target/release/manpages - name: Bundle completions uses: thedoctor0/zip-release@0.6.2 with: type: zip filename: completions.zip path: ./target/release/completions - name: Get short commit SHA id: short_commit_sha shell: bash run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Upload binary artifact uses: actions/upload-artifact@v3 with: name: crunchy-${{ steps.short_commit_sha.sha_short }}_${{ matrix.platform }}${{ matrix.ext }} path: ./target/release/crunchy-cli${{ matrix.ext }} if-no-files-found: error - name: Upload manpages artifact uses: actions/upload-artifact@v3 with: name: manpages-${{ steps.short_commit_sha.sha_short }}.zip path: ./manpages.zip if-no-files-found: error - name: Upload completions artifact uses: actions/upload-artifact@v3 with: name: completions-${{ steps.short_commit_sha.sha_short }}.zip path: ./completions.zip if-no-files-found: error