feat: rust rewrite #61
Workflow file for this run
This file contains 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: PR Workflow | |
on: | |
push: | |
branches: | |
- master | |
- main | |
pull_request: | |
jobs: | |
check: | |
strategy: | |
matrix: | |
target: | |
- os: linux | |
arch: "amd64" | |
rust-target: "x86_64-unknown-linux-gnu" | |
- os: linux | |
arch: "arm64" | |
rust-target: "aarch64-unknown-linux-gnu" | |
- os: darwin | |
arch: "amd64" | |
rust-target: "x86_64-apple-darwin" | |
- os: darwin | |
arch: "arm64" | |
rust-target: "aarch64-apple-darwin" | |
- os: windows | |
arch: "amd64" | |
rust-target: "x86_64-pc-windows-msvc" | |
- os: windows | |
arch: "arm64" | |
rust-target: "aarch64-pc-windows-msvc" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install stable --profile minimal --target ${{ matrix.target.rust-target }} --no-self-update | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo check --target ${{ matrix.target.rust-target }} | |
clippy: | |
needs: | |
- check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install stable --profile minimal --component clippy --no-self-update | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo clippy --all-targets --all-features -- -W clippy::pedantic -D warnings | |
build: | |
needs: | |
- clippy | |
strategy: | |
fail-fast: false | |
matrix: | |
target: | |
- os: linux | |
arch: "amd64" | |
rust-target: "x86_64-unknown-linux-gnu" | |
runs-on: ubuntu-latest | |
- os: linux | |
arch: "arm64" | |
rust-target: "aarch64-unknown-linux-gnu" | |
runs-on: ubuntu-latest | |
- os: darwin | |
arch: "amd64" | |
rust-target: "x86_64-apple-darwin" | |
runs-on: macos-latest | |
- os: darwin | |
arch: "arm64" | |
rust-target: "aarch64-apple-darwin" | |
runs-on: macos-latest | |
- os: windows | |
arch: "amd64" | |
rust-target: "x86_64-pc-windows-gnu" | |
runs-on: windows-latest | |
- os: windows | |
arch: "arm64" | |
rust-target: "aarch64-pc-windows-gnu" | |
runs-on: windows-latest | |
runs-on: ${{ matrix.target.runs-on }} | |
name: Build and save artifact | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup toolchain install stable --profile minimal --target ${{ matrix.target.rust-target }} --no-self-update | |
- run: cargo install cross --git https://github.com/cross-rs/cross | |
if: matrix.target.os != 'windows' && matrix.target.os != 'darwin' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build | |
run: cross build --release --target ${{ matrix.target.rust-target }} | |
if: matrix.target.os != 'windows' && matrix.target.os != 'darwin' | |
- name: Build | |
run: cargo build --release --target ${{ matrix.target.rust-target }} | |
if: matrix.target.os == 'windows' || matrix.target.os == 'darwin' | |
- name: Set .exe extension for Windows | |
run: echo "EXTENSION=.exe" >> $GITHUB_ENV | |
if: matrix.target.os == 'windows' | |
- name: Set executable filename | |
run: echo "FILENAME=sshs-${{ matrix.target.os }}-${{ matrix.target.arch }}${{ env.EXTENSION }}" >> $GITHUB_ENV | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ env.FILENAME }} | |
path: target/${{ matrix.target.rust-target }}/release/sshs${{ env.EXTENSION }} | |
# nix: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v2 | |
# - uses: cachix/install-nix-action@v17 | |
# with: | |
# nix_path: nixpkgs=channel:nixos-unstable | |
# - run: nix build | |
# - run: nix flake check |