-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (55 loc) · 2.07 KB
/
linux.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
name: Linux
on: push
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install fmt, clippy and nightly for the fmt
run: |
rustup component add rustfmt
rustup component add clippy
rustup toolchain install nightly
rustup component add --toolchain nightly rustfmt
- name: Run fmt
run: cargo +nightly 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: ubuntu-20.04
strategy:
matrix:
target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4
- id: "auth"
uses: google-github-actions/auth@v2
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
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y gcc-multilib libssl-dev:i386 # required to build for 32-bit arch
- name: Cargo build
run: |
export I686_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=/usr/lib/i386-linux-gnu # required to build for 32-bit arch
export I686_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=/usr/include/i386-linux-gnu # required to build for 32-bit arch
rustup target add ${{ matrix.target }}
cargo build -p tmc --release --verbose --target ${{ matrix.target }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: Deploy
run: gsutil cp target/${{ matrix.target }}/release/tmc gs://${{ secrets.GCP_BUCKET }}/tmc-cli-rust/tmc-cli-rust-${{ matrix.target }}-${{ steps.get_version.outputs.VERSION }}