Skip to content

Commit e89b493

Browse files
authored
Merge pull request #131 from rust-osdev/ci-windows
ci: windows
2 parents 14eb04b + dce672a commit e89b493

File tree

2 files changed

+46
-8
lines changed

2 files changed

+46
-8
lines changed

.github/workflows/_build-rust.yml

+32-8
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,21 @@
22
# More info: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iduses
33

44
# Common Rust CI setup that checkout the repo, installs the common toolchain
5-
# and set's up the cargo cache. It builds, tests, and lints the code.
5+
# and set's up the cargo cache. It builds, tests, and lints the code, but is
6+
# configurable. This way, the same workflow can be used to build, test, and lint
7+
# all in different steps, but with the same cache.
68

79
on:
810
workflow_call:
911
inputs:
12+
runs-on:
13+
type: string
14+
required: false
15+
default: ubuntu-latest
16+
description: |
17+
The value for the "runs-on" property: e.g.
18+
- ubuntu-latest
19+
- windows-latest
1020
rust-version:
1121
type: string
1222
required: false
@@ -22,7 +32,14 @@ on:
2232
required: false
2333
# Make sure we always an empty string to "--features <FEATURES>"
2434
default: '""'
25-
description: Comma-separated String with additional Rust features relevant for a certain job.
35+
description: >
36+
Comma-separated string with additional crate features. Empty string by
37+
default. CAUTION: For Windows CI runners, this must be '""' as is,
38+
i.e., the string itself must be "". This is a limitation of the
39+
Windows power shell. This might be configured like this:
40+
41+
features: >
42+
'""'
2643
do-style-check:
2744
type: boolean
2845
required: false
@@ -35,8 +52,8 @@ on:
3552
description: Execute tests.
3653

3754
jobs:
38-
check_rust:
39-
runs-on: ubuntu-latest
55+
rust:
56+
runs-on: ${{ inputs.runs-on }}
4057
steps:
4158
- name: Check out
4259
uses: actions/checkout@v3
@@ -67,16 +84,23 @@ jobs:
6784
- name: Build (all targets)
6885
run: cargo build --all-targets --features ${{ inputs.features }}
6986
- name: Code Formatting
70-
if: ${{ inputs.do-style-check }}
87+
if: inputs.do-style-check
7188
run: cargo fmt --all -- --check
7289
- name: Code Style and Doc Style
73-
if: ${{ inputs.do-style-check }}
90+
if: inputs.do-style-check
7491
run: |
7592
cargo doc --document-private-items --features ${{ inputs.features }}
7693
cargo clippy --all-targets --features ${{ inputs.features }}
77-
- name: Unit Test
78-
if: ${{ inputs.do-test }}
94+
- name: Unit Test (UNIX)
95+
if: inputs.do-test && runner.os != 'Windows'
7996
run: |
8097
curl -LsSf https://get.nexte.st/latest/linux | tar zxf -
8198
chmod u+x cargo-nextest
8299
./cargo-nextest nextest run --features ${{ inputs.features }}
100+
- name: Unit Test (Windows)
101+
if: inputs.do-test && runner.os == 'Windows'
102+
run: |
103+
Invoke-WebRequest https://get.nexte.st/latest/windows -OutFile cargo-nextest.zip
104+
Expand-Archive .\cargo-nextest.zip
105+
cp .\cargo-nextest/cargo-nextest.exe .
106+
.\cargo-nextest.exe nextest run --features ${{ inputs.features }}

.github/workflows/rust.yml

+14
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,20 @@ jobs:
5757
do-style-check: false
5858
rust-target: thumbv7em-none-eabihf
5959

60+
# We perform one single run also in Windows. This should be sufficient to
61+
# check that devs can also use this on Windows.
62+
build_nostd_stable_windows:
63+
name: build no_std (stable) [Windows]
64+
uses: ./.github/workflows/_build-rust.yml
65+
with:
66+
runs-on: windows-latest
67+
# Quirk for the Windows powershell and its handling of empty arguments.
68+
features: >
69+
'""'
70+
rust-version: stable
71+
do-style-check: false
72+
rust-target: thumbv7em-none-eabihf
73+
6074
build_nostd_nightly:
6175
name: build no_std (nightly)
6276
needs: build_nightly

0 commit comments

Comments
 (0)