Skip to content

ci: windows #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 32 additions & 8 deletions .github/workflows/_build-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
# More info: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_iduses

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

on:
workflow_call:
inputs:
runs-on:
type: string
required: false
default: ubuntu-latest
description: |
The value for the "runs-on" property: e.g.
- ubuntu-latest
- windows-latest
rust-version:
type: string
required: false
Expand All @@ -22,7 +32,14 @@ on:
required: false
# Make sure we always an empty string to "--features <FEATURES>"
default: '""'
description: Comma-separated String with additional Rust features relevant for a certain job.
description: >
Comma-separated string with additional crate features. Empty string by
default. CAUTION: For Windows CI runners, this must be '""' as is,
i.e., the string itself must be "". This is a limitation of the
Windows power shell. This might be configured like this:

features: >
'""'
do-style-check:
type: boolean
required: false
Expand All @@ -35,8 +52,8 @@ on:
description: Execute tests.

jobs:
check_rust:
runs-on: ubuntu-latest
rust:
runs-on: ${{ inputs.runs-on }}
steps:
- name: Check out
uses: actions/checkout@v3
Expand Down Expand Up @@ -67,16 +84,23 @@ jobs:
- name: Build (all targets)
run: cargo build --all-targets --features ${{ inputs.features }}
- name: Code Formatting
if: ${{ inputs.do-style-check }}
if: inputs.do-style-check
run: cargo fmt --all -- --check
- name: Code Style and Doc Style
if: ${{ inputs.do-style-check }}
if: inputs.do-style-check
run: |
cargo doc --document-private-items --features ${{ inputs.features }}
cargo clippy --all-targets --features ${{ inputs.features }}
- name: Unit Test
if: ${{ inputs.do-test }}
- name: Unit Test (UNIX)
if: inputs.do-test && runner.os != 'Windows'
run: |
curl -LsSf https://get.nexte.st/latest/linux | tar zxf -
chmod u+x cargo-nextest
./cargo-nextest nextest run --features ${{ inputs.features }}
- name: Unit Test (Windows)
if: inputs.do-test && runner.os == 'Windows'
run: |
Invoke-WebRequest https://get.nexte.st/latest/windows -OutFile cargo-nextest.zip
Expand-Archive .\cargo-nextest.zip
cp .\cargo-nextest/cargo-nextest.exe .
.\cargo-nextest.exe nextest run --features ${{ inputs.features }}
14 changes: 14 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,20 @@ jobs:
do-style-check: false
rust-target: thumbv7em-none-eabihf

# We perform one single run also in Windows. This should be sufficient to
# check that devs can also use this on Windows.
build_nostd_stable_windows:
name: build no_std (stable) [Windows]
uses: ./.github/workflows/_build-rust.yml
with:
runs-on: windows-latest
# Quirk for the Windows powershell and its handling of empty arguments.
features: >
'""'
rust-version: stable
do-style-check: false
rust-target: thumbv7em-none-eabihf

build_nostd_nightly:
name: build no_std (nightly)
needs: build_nightly
Expand Down