name: build-and-test on: [push, pull_request] jobs: build: name: build runs-on: ${{ matrix.os }} strategy: matrix: include: - target: x86_64-apple-darwin os: macos-latest # - target: x86_64-pc-windows-gnu # os: windows-latest # ext: .exe - target: x86_64-pc-windows-msvc os: windows-latest ext: .exe - target: x86_64-unknown-linux-gnu os: ubuntu-latest - target: x86_64-unknown-linux-musl os: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Install dependencies (musl) if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} run: | sudo apt-get update sudo apt-get install help2man musl-tools - name: Build and test on stable run: | rustup toolchain install stable --profile minimal -t ${{ matrix.target }} cargo +stable build --target ${{ matrix.target }} cargo +stable test --target ${{ matrix.target }} - name: Release on nightly run: | rustup toolchain install nightly --profile minimal -t ${{ matrix.target }} cargo +nightly build --release --target ${{ matrix.target }} env: GEN_COMPLETIONS: 1 RUSTFLAGS: -Z strip=symbols - name: Upload bianry uses: actions/upload-artifact@v2 with: name: ouch-${{ matrix.target }}${{ matrix.ext }} path: target/${{ matrix.target }}/release/ouch${{ matrix.ext }} - name: Build man page and find completions (musl) if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} run: | help2man target/${{ matrix.target }}/release/ouch > ouch.1 cp -r target/${{ matrix.target }}/release/build/ouch-*/out/completions . - name: Upload completions (musl) if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} uses: actions/upload-artifact@v2 with: name: completions path: completions - name: Upload man page (musl) if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} uses: actions/upload-artifact@v2 with: name: ouch.1 path: ouch.1 clippy-rustfmt: name: clippy-rustfmt runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: "Cargo: clippy, fmt" run: | rustup toolchain install stable --profile minimal -c clippy rustup toolchain install nightly --profile minimal -c rustfmt cargo +stable clippy -- -D warnings cargo +nightly fmt -- --check