@@ -3,101 +3,169 @@ name: Upload CLI binaries
33on :
44 release :
55 types :
6- - created
6+ - released
77
88env :
99 TAG : ${{ github.event.release.tag_name }} # had some issue using this directly on windows
1010
1111jobs :
1212 linux :
13- runs-on : ubuntu-16 .04
13+ runs-on : ubuntu-18 .04
1414 strategy :
1515 matrix :
16- target : [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
16+ target :
17+ [
18+ x86_64-unknown-linux-gnu,
19+ i686-unknown-linux-gnu,
20+ aarch64-unknown-linux-gnu,
21+ armv7-unknown-linux-gnueabihf,
22+ ]
1723 steps :
18- - uses : actions/checkout@v2
19- - uses : GoogleCloudPlatform/github-actions/setup-gcloud@master
24+ - name : Checkout
25+ uses : actions/checkout@v2
26+ - name : Install Rust
27+ uses : actions-rs/toolchain@v1
28+ with :
29+ profile : minimal
30+ toolchain : stable
31+ - name : Cache
32+ uses : Swatinem/rust-cache@v1
33+ - name : Node
34+ uses : actions/setup-node@v2
35+ with :
36+ node-version : " 16"
37+ - name : GCloud
38+ uses : google-github-actions/setup-gcloud@master
2039 with :
2140 project_id : ${{ secrets.GCP_PROJECT_ID }}
2241 service_account_key : ${{ secrets.GCP_SA_KEY }}
2342 - name : Install dependencies
2443 run : |
2544 sudo apt update
26- sudo apt install -y gcc-multilib # required to build for 32-bit arch
27- - name : Cargo build
28- run : |
29- rustup target add i686-unknown-linux-gnu
30- cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
45+ sudo apt install -y gcc-multilib # required to build for 32-bit arch
46+
47+ - name : Install aarch64-unknown-linux-gnu linker
48+ if : ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
49+ run : sudo apt install -y gcc-aarch64-linux-gnu
50+ - name : Install armv7-unknown-linux-gnueabihf linker
51+ if : ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
52+ run : sudo apt install -y gcc-arm-linux-gnueabihf
53+
3154 - name : Deploy
32- run : gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
55+ run : |
56+ rustup target add ${{ matrix.target }}
57+
58+ # build and deploy CLI
59+ cargo build -p tmc-langs-cli --release --target ${{ matrix.target }}
60+ gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
61+
62+ # build and deploy Node module
63+ npm --prefix ./bindings/tmc-langs-node install
64+ npm --prefix ./bindings/tmc-langs-node run build -- --release --target ${{ matrix.target }}
65+ gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node
3366
3467 windows :
3568 runs-on : windows-latest
3669 strategy :
3770 matrix :
3871 target : [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
3972 steps :
40- - uses : actions/checkout@v2
41- - uses : GoogleCloudPlatform/github-actions/setup-gcloud@master
73+ - name : Checkout
74+ uses : actions/checkout@v2
75+ - name : Install Rust
76+ uses : actions-rs/toolchain@v1
77+ with :
78+ profile : minimal
79+ toolchain : stable
80+ - name : Cache
81+ uses : Swatinem/rust-cache@v1
82+ - name : Node
83+ uses : actions/setup-node@v2
84+ with :
85+ node-version : " 16"
86+ - name : GCloud
87+ uses : google-github-actions/setup-gcloud@master
4288 with :
4389 project_id : ${{ secrets.GCP_PROJECT_ID }}
4490 service_account_key : ${{ secrets.GCP_SA_KEY }}
45- - name : Cargo build # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)
91+
92+ - name : Build
4693 run : |
47- rustup target add i686-pc-windows-msvc
48- $env:RUSTFLAGS="-C target-feature=+crt-static"
49- cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
94+ rustup target add ${{ matrix.target }}
95+ $env:RUSTFLAGS="-C target-feature=+crt-static" # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)
96+ cargo build -p tmc-langs-cli --release --target ${{ matrix.target }}
97+ cd ./bindings/tmc-langs-node && npm install && npm run build -- --release --target ${{ matrix.target }}
5098 - name : Deploy
5199 run : |
52100 $env:python_version=$(python -c 'import sys; print(\".\".join(map(str, sys.version_info[:3])))')
53101 $env:CLOUDSDK_PYTHON="C:\hostedtoolcache\windows\Python\$env:python_version\x64\python"
54102 gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli.exe gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$Env:TAG.exe
103+ gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$Env:TAG.node
55104
56105 macos :
57- runs-on : macos-latest
106+ runs-on : macos-10.15
58107 steps :
59- - uses : actions/checkout@v2
60- - uses : GoogleCloudPlatform/github-actions/setup-gcloud@master
108+ - name : Checkout
109+ uses : actions/checkout@v2
110+ - name : Install Rust
111+ uses : actions-rs/toolchain@v1
112+ with :
113+ profile : minimal
114+ toolchain : stable
115+ - name : Cache
116+ uses : Swatinem/rust-cache@v1
117+ - name : Node
118+ uses : actions/setup-node@v2
119+ with :
120+ node-version : " 16"
121+ - name : GCloud
122+ uses : google-github-actions/setup-gcloud@master
61123 with :
62124 project_id : ${{ secrets.GCP_PROJECT_ID }}
63125 service_account_key : ${{ secrets.GCP_SA_KEY }}
126+
64127 - name : Cargo build
65- run : cargo build -p tmc-langs-cli --release --verbose
128+ run : |
129+ cargo build -p tmc-langs-cli --release
130+ npm --prefix ./bindings/tmc-langs-node install
131+ npm run --prefix ./bindings/tmc-langs-node build -- --release
66132 - name : Sign
67133 run : codesign --force -s - target/release/tmc-langs-cli
68134 - name : Deploy
69- run : gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-x86_64-apple-darwin-$TAG
135+ run : |
136+ gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-x86_64-apple-darwin-$TAG
137+ gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-x86_64-apple-darwin-$TAG.node
70138
71139 macos-11 :
72- runs-on : macos-11.0
140+ runs-on : macos-11
73141 steps :
74- - uses : actions/checkout@v2
75- - uses : GoogleCloudPlatform/github-actions/setup-gcloud@master
142+ - name : Checkout
143+ uses : actions/checkout@v2
144+ - name : Install Rust
145+ uses : actions-rs/toolchain@v1
146+ with :
147+ profile : minimal
148+ toolchain : stable
149+ - name : Cache
150+ uses : Swatinem/rust-cache@v1
151+ - name : Node
152+ uses : actions/setup-node@v2
153+ with :
154+ node-version : " 16"
155+ - name : GCloud
156+ uses : google-github-actions/setup-gcloud@master
76157 with :
77158 project_id : ${{ secrets.GCP_PROJECT_ID }}
78159 service_account_key : ${{ secrets.GCP_SA_KEY }}
160+
79161 - name : Cargo build
80- run : cargo build -p tmc-langs-cli --release --verbose
162+ run : |
163+ cargo build -p tmc-langs-cli --release
164+ npm --prefix ./bindings/tmc-langs-node install
165+ npm run --prefix ./bindings/tmc-langs-node build -- --release
81166 - name : Sign
82167 run : codesign --force -s - target/release/tmc-langs-cli
83168 - name : Deploy
84- run : gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-aarch64-apple-darwin-$TAG
85-
86- arm :
87- runs-on : ubuntu-16.04
88- strategy :
89- matrix :
90- target : [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
91- steps :
92- - uses : actions/checkout@v2
93- - uses : GoogleCloudPlatform/github-actions/setup-gcloud@master
94- with :
95- project_id : ${{ secrets.GCP_PROJECT_ID }}
96- service_account_key : ${{ secrets.GCP_SA_KEY }}
97- - name : Cargo build
98169 run : |
99- rustup target add ${{ matrix.target }}
100- cargo install cross
101- cross build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
102- - name : Deploy
103- run : gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
170+ gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-aarch64-apple-darwin-$TAG
171+ gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-aarch64-apple-darwin-$TAG.node
0 commit comments