-
Notifications
You must be signed in to change notification settings - Fork 0
145 lines (120 loc) · 3.86 KB
/
rust.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
name: Rust
on:
push: {}
release:
types: [published]
env:
VERSION: "0.0.0-dev"
jobs:
version:
name: Start Release
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Generate Package Version (Release Tag)
shell: pwsh
if: github.event_name == 'release'
run: Add-Content -Path $env:GITHUB_ENV -Value "VERSION=$('${{ github.event.release.tag_name }}'.substring(1))"
- name: Set Package Version
run: sed -i "s/^version\s*=\s*\".*\"/version = \"$VERSION\"/g" Cargo.toml
- name: Stash Versioned Cargo.toml
uses: actions/upload-artifact@v4
with:
name: cargofile
path: Cargo.toml
test:
name: Test
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: llvm-tools-preview
- name: cargo install grcov
uses: SierraSoftworks/setup-grcov@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
RUSTFLAGS: -Cinstrument-coverage
- name: grcov
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --ignore-not-existing --ignore '../**' --ignore '/*' --ignore 'C:/' -o ./lcov.info
- name: codecov upload
uses: codecov/[email protected]
with:
files: ./lcov.info
build:
name: ${{ matrix.os }}-${{ matrix.arch }}-release
runs-on: ${{ matrix.run_on }}
needs:
- version
strategy:
matrix:
include:
# Windows builds
- arch: amd64
os: windows
run_on: windows-latest
target: x86_64-pc-windows-msvc
extension: .exe
# Linux builds
- arch: amd64
run_on: ubuntu-latest
os: linux
target: x86_64-unknown-linux-gnu
test: true
- arch: "arm64"
os: linux
run_on: ubuntu-latest
target: aarch64-unknown-linux-gnu
cross: true
# Apple MacOS builds
- arch: amd64
run_on: macos-latest
os: darwin
target: x86_64-apple-darwin
- arch: arm64
run_on: macos-latest
os: darwin
target: aarch64-apple-darwin
steps:
- name: Get Rust Stable
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
target: ${{ matrix.target }}
components: llvm-tools-preview
- name: Check out code
uses: actions/checkout@v4
- name: Fetch Versioned Cargo.toml
uses: actions/download-artifact@v4
with:
name: cargofile
- name: cargo build
uses: actions-rs/[email protected]
with:
use-cross: ${{ matrix.cross }}
command: build
args: --release --target ${{ matrix.target }}
- name: Upload GitHub Release Artifacts
uses: SierraSoftworks/[email protected]
if: github.event_name == 'release'
with:
files: "target/${{ matrix.target }}/release/http-errors${{ matrix.extension }} | http-errors-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}"
token: ${{ secrets.GITHUB_TOKEN }}
overwrite: "true"
- name: Upload build artifacts
uses: actions/upload-artifact@v4
if: github.event_name == 'push'
with:
name: http-errors-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.extension }}
path: target/${{ matrix.target }}/release/http-errors${{ matrix.extension }}