-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (72 loc) · 2.62 KB
/
windows.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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-$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