-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Obviously, * you can't test GH actions locally * and you can't test the actions in the repo without the actual source code * and you don't want to include the actions with the initial source code commit if its _wrong_ So, here's the GH action to test this that we _think_ is right
- Loading branch information
1 parent
e5ce5c6
commit fa15df4
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Fix environment | ||
description: GitHub VMs aren't configured correctly | ||
# Shamelessly borrowed from https://github.com/microsoft/windows-rs/blob/master/.github/actions/fix-environment/action.yml | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Configure environment | ||
shell: pwsh | ||
run: | | ||
$vs_root = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` | ||
-latest -property installationPath -format value | ||
switch -Wildcard ("${{ matrix.target }}") | ||
{ | ||
"*-pc-windows-gnu" | ||
{ | ||
"C:\msys64\mingw64\bin;C:\msys64\mingw32\bin" >> $env:GITHUB_PATH | ||
} | ||
"i686*" | ||
{ | ||
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x86" >> $env:GITHUB_PATH | ||
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx86\x86") | ||
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH | ||
} | ||
"x86_64*" | ||
{ | ||
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH | ||
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | ||
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH | ||
} | ||
"aarch64*" | ||
{ | ||
"${env:ProgramFiles(x86)}\Windows Kits\10\bin\10.0.22000.0\x64" >> $env:GITHUB_PATH | ||
((Resolve-Path "$vs_root\VC\Tools\MSVC\*\bin\Hostx64\x64") | ||
| Sort-Object -Descending | Select -First 1).ToString() >> $env:GITHUB_PATH | ||
} | ||
"*" | ||
{ | ||
(Join-Path $env:GITHUB_WORKSPACE "target\debug\deps").ToString() >> $env:GITHUB_PATH | ||
(Join-Path $env:GITHUB_WORKSPACE "target\test\debug\deps").ToString() >> $env:GITHUB_PATH | ||
"INCLUDE=${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\winrt;${env:ProgramFiles(x86)}\Windows Kits\10\include\10.0.22000.0\cppwinrt" ` | ||
>> $env:GITHUB_ENV | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: PR Build & Test | ||
|
||
on: | ||
pull_request: | ||
push: | ||
paths-ignore: | ||
- '.github/ISSUE_TEMPLATE/**' | ||
branches: | ||
- main | ||
|
||
jobs: | ||
check: | ||
runs-on: windows-2022 | ||
|
||
strategy: | ||
matrix: | ||
# Apparently ARM targets aren't usable in GH actions | ||
# target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc, aarch64-pc-windows-msvc] | ||
target: [x86_64-pc-windows-msvc, i686-pc-windows-msvc] | ||
branding: [Inbox, Stable, Dev] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Update toolchain | ||
run: rustup update --no-self-update stable && rustup default stable-${{ matrix.target }} | ||
|
||
- name: Add toolchain target | ||
run: rustup target add ${{ matrix.target }} | ||
|
||
- name: Install fmt | ||
run: rustup component add rustfmt | ||
|
||
- name: Install clippy | ||
run: rustup component add clippy | ||
|
||
- name: Fix environment | ||
uses: ./.github/actions/fix-environment | ||
|
||
- name: Clean | ||
run: cargo clean | ||
|
||
- name: Run fmt | ||
run: cargo fmt --all -- --check | ||
|
||
# Test will build the code, then also test it. | ||
- name: Test | ||
run: cargo test --no-default-features --features ${{matrix.branding}} --target ${{ matrix.target }} | ||
|
||
- name: Run clippy | ||
run: cargo clippy --no-default-features --features ${{matrix.branding}} --target ${{matrix.target}} 2>&1 |