diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index e2e5502..b1bbc4d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,39 +1,45 @@ -name: Rust +name: Rust Build and Artifact Creation on: push: - branches: [ "master" ] + branches: + - master pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - RUSTFLAGS: "-Dwarnings" + branches: + - master jobs: build: strategy: matrix: - toolchain: - - channel: stable - cargo_args: --verbose --all-targets - clippy_args: "" - - channel: nightly - cargo_args: --verbose --all-targets --all-features - clippy_args: --allow clippy::needless_lifetimes - - runs-on: ubuntu-latest + os: [ubuntu-latest, windows-latest] + toolchain: [stable, nightly] + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + - os: windows-latest + target: x86_64-pc-windows-msvc + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 - - name: Setup toolchain - run: > - rustup update ${{ matrix.toolchain.channel }} && - rustup default ${{ matrix.toolchain.channel }} && - rustup component add clippy - - name: Clippy - run: cargo clippy ${{ matrix.toolchain.cargo_args }} -- ${{matrix.toolchain.clippy_args}} - - name: Build - run: cargo build ${{ matrix.toolchain.cargo_args }} - - name: Run tests - run: cargo test ${{ matrix.toolchain.cargo_args }} -- --test-threads=1 + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + target: ${{ matrix.target }} + toolchain: ${{ matrix.toolchain }} + override: true + + - name: Build and Install Binary + run: | + mkdir -p ${{github.workspace}}/install + cargo install --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }} + shell: bash + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary + path: ${{github.workspace}}/install/bin