-
Notifications
You must be signed in to change notification settings - Fork 34
128 lines (108 loc) · 3.71 KB
/
push.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
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-msvc"
runs-on: windows-latest
- os: windows
arch: "arm64"
rust-target: "aarch64-pc-windows-msvc"
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