Skip to content

Merge pull request #37 from rage/ci #511

Merge pull request #37 from rage/ci

Merge pull request #37 from rage/ci #511

Workflow file for this run

name: Windows
on:
push:
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"]
release:
types:
- created
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4.1.7
- name: Enable long paths for git
run: git config --system core.longpaths true # allow long paths from git deps
- name: Install fmt and clippy
run: |
rustup component add rustfmt
rustup component add clippy
- name: Run fmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- -D warnings
- name: Build
run: cargo build --tests --verbose
- name: Run tests
run: cargo test --verbose
deploy:
needs: test
if: ${{ github.event_name == 'release' }}
runs-on: windows-latest
strategy:
matrix:
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
steps:
- uses: actions/checkout@v4.1.7
- id: "auth"
uses: google-github-actions/auth@v2.1.5
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: "Set up Cloud SDK"
uses: google-github-actions/setup-gcloud@v2.1.1
- name: Enable long paths for git
run: git config --system core.longpaths true # allow long paths from git deps
- name: Cargo build # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)
run: |
rustup target add i686-pc-windows-msvc
$env:RUSTFLAGS="-C target-feature=+crt-static"
cargo build -p tmc --release --verbose --target ${{ matrix.target }}
- name: Get the version
id: get_version
shell: bash
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- name: Create msi installer
run: |
dotnet tool install --global wix
cargo install cargo-wix
cargo wix --output installer.msi
- name: Upload msi artifact
uses: svenstaro/upload-release-action@2.9.0
with:
file: "./installer.msi"
asset_name: tmc-cli-rust--${{ matrix.target }}-$tag.msi
- name: Deploy
run: |
$env:python_version=$(python -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
$env:CLOUDSDK_PYTHON="C:\hostedtoolcache\windows\Python\$env:python_version\x64\python"
gsutil cp target/${{ matrix.target }}/release/tmc.exe gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}.exe