Skip to content

Merge pull request #31 from rage/ci #495

Merge pull request #31 from rage/ci

Merge pull request #31 from rage/ci #495

Workflow file for this run

name: Windows
on: push
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- 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: startsWith(github.ref, 'refs/tags/v')
runs-on: windows-latest
strategy:
matrix:
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
steps:
- uses: actions/checkout@v4
- uses: google-github-actions/setup-gcloud@v2
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- 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 ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- 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