windows #5
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 | |
env: | |
RUSTFLAGS: "-D warnings" | |
GITHUB_TOKEN: "${{ secrets.FULL_GITHUB_TOKEN }}" | |
GITHUB_USER: "${{ github.actor }}" | |
jobs: | |
versio-checks: | |
runs-on: windows-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Get versio | |
uses: chaaz/versio-actions/install@v1.3 | |
- name: Fetch history | |
run: git fetch --unshallow | |
- name: Output plan | |
run: versio plan | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
root: "." | |
rustflags: "-D warnings" | |
bin_name: versio.exe | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
runs-on: "${{ matrix.os }}" | |
steps: | |
- name: Checkout release | |
uses: actions/checkout@v3 | |
with: | |
ref: main | |
- name: Install Windows dependencies | |
if: "matrix.os == 'windows-latest'" | |
# echo "C:\msys64\mingw32\bin" >> $GITHUB_PATH | |
run: | | |
$env:PATH = "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin" | |
[Environment]::SetEnvironmentVariable("Path", $env:PATH, "Machine") | |
choco install -y Gpg4win | |
echo "C:\Program Files (x86)\Gpg4win\..\GnuPG\bin" >> $env:GITHUB_PATH | |
- name: Get Windows cargo stable | |
if: "matrix.os == 'windows-latest'" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable-i686-pc-windows-gnu | |
target: i686-pc-windows-gnu | |
components: clippy | |
default: true | |
- name: Get Windows cargo nightly | |
if: "matrix.os == 'windows-latest'" | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-i686-pc-windows-gnu | |
target: i686-pc-windows-gnu | |
components: rustfmt | |
- name: Update Windows target configuration | |
if: "matrix.os == 'windows-latest'" | |
run: rustup set default-host i686-pc-windows-gnu | |
- name: Find paths | |
id: cargo-find-paths | |
run: "echo ::set-output name=cargo-lock-glob::\"${{ matrix.root }}\"/**/Cargo.lock" | |
- name: Cache cargo and target | |
uses: actions/cache@v1 | |
with: | |
path: "~/.cargo/registry\n~/.cargo/git\n${{ matrix.root }}/target\n" | |
key: "${{ runner.os }}-cargo-${{ hashFiles(steps.cargo-find-paths.outputs.cargo-lock-glob) }}" | |
- name: Build Windows binary | |
if: "matrix.os == 'windows-latest'" | |
run: cargo build --release --target i686-pc-windows-gnu | |
working-directory: "${{ matrix.root }}" | |
env: | |
RUSTFLAGS: "${{ matrix.rustflags }}" |