-
Notifications
You must be signed in to change notification settings - Fork 3
131 lines (113 loc) · 3.49 KB
/
rust.yml
File metadata and controls
131 lines (113 loc) · 3.49 KB
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
129
130
131
name: Rust Build and Artifact Creation
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
permissions:
# For syyyr/rust-pycobertura-action
pull-requests: write
contents: write
jobs:
build:
strategy:
fail-fast: false
matrix:
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:
- name: Checkout code
uses: actions/checkout@v6
- name: Install system dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev pkg-config
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
toolchain: ${{ matrix.toolchain }}
components: clippy
override: true
- name: Clippy
run: cargo clippy --all-targets --all-features
- name: Build
run: cargo build --all-targets --all-features
- name: Run tests
run: cargo test --all-targets --all-features
- name: Build and Install Binary
run: |
mkdir -p ${{github.workspace}}/install
cargo install --all-features --path '${{github.workspace}}' --root '${{github.workspace}}/install' --target ${{ matrix.target }} --locked
shell: bash
- name: Upload Artifact
uses: actions/upload-artifact@v7
with:
name: ${{ matrix.os }}-${{ matrix.toolchain }}-binary
path: ${{github.workspace}}/install/bin
create-nightly-release:
name: Create nightly
if: github.ref == 'refs/heads/master'
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Consolidate artifacts
uses: actions/download-artifact@v8
with:
pattern: '*-latest-nightly-binary'
merge-multiple: true
- name: Rename artifacts
run: |
SHVCALL_FILE_NAME="$(printf "shvcall-nightly-g%s" "$(head -c 7 <<< '${{github.sha}}')")"
mv shvcall "${SHVCALL_FILE_NAME}"
- name: Create release
env:
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
uses: silicon-heaven/rust-nightly-release-action@v1.0.0
with:
path_glob: shvcall*
coverage:
name: Code coverage
runs-on: ubuntu-latest
steps:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libudev-dev pkg-config
- name: Generate coverage
uses: silicon-heaven/rust-pycobertura-action@v4.1.0
with:
project_name: shvcall
nix:
name: NixOS
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v31.10.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Build
run: nix --experimental-features 'nix-command flakes' build
- name: Flake check
run: nix --experimental-features 'nix-command flakes' flake check
- name: Format
run: nix --experimental-features 'nix-command flakes' fmt . && git diff --exit-code