windows #17
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
name: windows | |
on: | |
workflow_dispatch: | |
jobs: | |
buildandtest: | |
runs-on: windows-latest | |
name: (${{ matrix.target }}, ${{ matrix.cfg_release_channel }}) | |
env: | |
CFG_RELEASE_CHANNEL: ${{ matrix.cfg_release_channel }} | |
strategy: | |
# https://help.github.com/en/actions/getting-started-with-github-actions/about-github-actions#usage-limits | |
# There's a limit of 60 concurrent jobs across all repos in the rust-lang organization. | |
# In order to prevent overusing too much of that 60 limit, we throttle the | |
# number of rustfmt jobs that will run concurrently. | |
max-parallel: 2 | |
fail-fast: false | |
matrix: | |
target: [ | |
# i686-pc-windows-gnu, | |
# i686-pc-windows-msvc, | |
# x86_64-pc-windows-gnu, | |
x86_64-pc-windows-msvc, | |
] | |
# cfg_release_channel: [nightly, stable] | |
cfg_release_channel: [stable] | |
steps: | |
# The Windows runners have autocrlf enabled by default | |
# which causes failures for some of rustfmt's line-ending sensitive tests | |
- name: disable git eol translation | |
run: git config --global core.autocrlf false | |
- name: checkout | |
uses: actions/checkout@v3 | |
# Run build | |
- name: Install Rustup using win.rustup.rs | |
run: | | |
# Disable the download progress bar which can cause perf issues | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe | |
.\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --default-toolchain=none | |
del rustup-init.exe | |
rustup target add ${{ matrix.target }} | |
shell: powershell | |
- name: Install the arduino-cli | |
run: | | |
# Disable the download progress bar which can cause perf issues | |
$ProgressPreference = "SilentlyContinue" | |
Invoke-WebRequest https://github.com/arduino/arduino-cli/releases/download/0.34.1/arduino-cli_0.34.1_Windows_64bit.msi -OutFile $env:USERPROFILE\Downloads\arduino-cli-0.34.1.msi | |
pwd | |
dir $env:USERPROFILE\Downloads | |
Start-Process msiexec.exe "/i $env:USERPROFILE\Downloads\arduino-cli-0.34.1.msi /passive /L*V install.log" -Wait | |
cat install.log | |
echo " C:\Program Files\Arduino CLI" >> $GITHUB_PATH | |
del $env:USERPROFILE\Downloads\arduino-cli-0.34.1.msi | |
del install.log | |
shell: powershell | |
- name: Test the arduino-cli | |
run: | | |
echo $GITHUB_PATH | |
arduino-cli version | |
shell: powershell | |
- name: Add mingw32 to path for i686-gnu | |
run: | | |
echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH | |
if: matrix.target == 'i686-pc-windows-gnu' && matrix.channel == 'nightly' | |
shell: bash | |
- name: Add mingw64 to path for x86_64-gnu | |
run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH | |
if: matrix.target == 'x86_64-pc-windows-gnu' && matrix.channel == 'nightly' | |
shell: bash | |
- name: Build | |
shell: cmd | |
run: cargo build --verbose --target ${{ matrix.target }} | |
- name: Test | |
shell: cmd | |
run: cargo test --verbose | |
- name: Run rustfmt | |
shell: cmd | |
run: cargo fmt --all -- --check | |
- name: Run clippy | |
shell: cmd | |
run: cargo clippy --all -- -D warnings | |
package: | |
needs: buildandtest | |
runs-on: windows-latest | |
env: | |
RUSTFLAGS: '-C target-feature=+crt-static' | |
name: Windows | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: actions-rs/[email protected] | |
with: | |
crate: cargo-wix | |
version: latest | |
- name: Build MSI Artifact | |
shell: cmd | |
run: | | |
cargo wix init | |
cargo wix -v --nocapture -o . | |
- name: Upload MSI Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: windows | |
path: ./*.msi |