-
Notifications
You must be signed in to change notification settings - Fork 2
138 lines (114 loc) · 4.1 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
name: Rust
on:
push:
branches: ['master', 'release']
env:
CARGO_TERM_COLOR: always
jobs:
check-fmt:
runs-on: windows-latest
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-09-25
target: x86_64-unknown-uefi
components: rustfmt
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Check fmt
run: cargo fmt --check
build-standalone:
runs-on: windows-latest
needs: check-fmt
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-09-25
target: x86_64-unknown-uefi
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get package version
shell: bash
run: |
VERSION=$(cargo pkgid --manifest-path driver-standalone/Cargo.toml | cut -d# -f2 | cut -d: -f2 | cut -d@ -f2)
echo "Package version: $VERSION"
echo "ARTIFACT_VERSION=$VERSION" >> "$GITHUB_ENV"
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
- name: Build Driver
run: ./.github/workflows/build-driver.ps1
- name: Upload release build to portal
shell: bash
run: .github/workflows/artifact_upload.sh kernel-driver target/x86_64-pc-windows-msvc/release/valthrun-driver.sys target/x86_64-pc-windows-msvc/release/driver_standalone.pdb
if: ${{ github.event_name != 'pull_request' }}
env:
ARTIFACT_API_KEY: ${{ secrets.ARTIFACT_API_KEY }}
build-uefi:
runs-on: windows-latest
needs: check-fmt
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-09-25
target: x86_64-unknown-uefi
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
- name: Build UEFI Driver
run: ./.github/workflows/build-driver-uefi.ps1
- uses: actions/upload-artifact@v4
id: uefi-driver-upload
with:
name: valthrun-driver-uefi
path: |
target/x86_64-pc-windows-msvc/release/driver_uefi.dll
target/x86_64-pc-windows-msvc/release/driver_uefi.pdb
- name: Trigger ISO build
env:
UEFI_MAPPER_GITHUB_TOKEN: ${{ secrets.UEFI_MAPPER_GITHUB_TOKEN }}
DRIVER_GITHUB_TOKEN: ${{ secrets.DRIVER_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
DRIVER_ARTIFACT_ID: ${{ steps.uefi-driver-upload.outputs.artifact-id }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_REF_NAME: ${{ github.ref_name || 'unknown' }}
if: ${{ env.UEFI_MAPPER_GITHUB_TOKEN != '' }} && github.ref == 'ref/head/master'
run: ./.github/workflows/invoke-mapper.ps1
build-driver-interface:
runs-on: windows-latest
needs: [check-fmt]
steps:
- name: Install toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Get package version
shell: bash
run: |
VERSION=$(cargo pkgid --manifest-path driver-interface/Cargo.toml | cut -d# -f2 | cut -d: -f2 | cut -d"@" -f2)
echo "Package version: $VERSION"
echo "ARTIFACT_VERSION=$VERSION" >> "$GITHUB_ENV"
- uses: Swatinem/rust-cache@v2
with:
cache-on-failure: true
cache-all-crates: true
- name: Build Kernel Driver interface
run: cargo b -r -v --lib --manifest-path driver-interface/Cargo.toml
- name: Upload artifact to portal
shell: bash
run: .github/workflows/artifact_upload.sh driver-interface-kernel target/release/driver_interface_kernel.dll target/release/driver_interface_kernel.pdb
if: ${{ github.event_name != 'pull_request' }}
env:
ARTIFACT_API_KEY: ${{ secrets.ARTIFACT_API_KEY }}