|
@@ -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
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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 }}
|