Skip to content

Commit a6a3e06

Browse files
committed
updated CI to match main
1 parent a6062a7 commit a6a3e06

File tree

5 files changed

+177
-103
lines changed

5 files changed

+177
-103
lines changed

.github/workflows/clippy.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

.github/workflows/doc.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,15 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v2
14+
- name: Install Rust
15+
uses: actions-rs/toolchain@v1
1416
with:
15-
persist-credentials: false
17+
profile: minimal
18+
toolchain: stable
19+
- name: Cache
20+
uses: Swatinem/rust-cache@v1
1621

17-
- name: Install and build
22+
- name: Build docs
1823
run: cargo doc
1924

2025
- name: Copy index to target/doc

.github/workflows/fmt.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 55 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,60 +2,78 @@ name: Run tests
22

33
on:
44
push:
5-
branches: [master, '[0-9]+.[0-9]+']
5+
branches: [main, "[0-9]+.[0-9]+"]
66
pull_request:
7-
branches: [master, '[0-9]+.[0-9]+']
7+
branches: [main, "[0-9]+.[0-9]+"]
88

99
env:
1010
RUST_LOG: debug,j4rs=warn
11+
CARGO_INCREMENTAL: 0
12+
RUSTFLAGS: "-C debuginfo=0"
1113

1214
jobs:
13-
linux:
14-
runs-on: ubuntu-latest
15+
test:
16+
strategy:
17+
matrix:
18+
os: [ubuntu-latest, windows-latest, macos-latest]
19+
fail-fast: false
20+
runs-on: ${{ matrix.os }}
21+
1522
steps:
16-
- uses: actions/checkout@v2
17-
- name: Install depedencies
23+
- name: Checkout
24+
uses: actions/checkout@v2
25+
- name: Install Rust
26+
uses: actions-rs/toolchain@v1
27+
with:
28+
profile: minimal
29+
toolchain: stable
30+
components: rustfmt, clippy
31+
- name: Cache
32+
uses: Swatinem/rust-cache@v1
33+
34+
- name: Diagnostics on Windows
35+
if: matrix.os == 'windows-latest'
36+
run: "gci env:"
37+
38+
- name: Rustfmt
39+
run: cargo fmt -- --check
40+
- name: Clippy
41+
if: matrix.os == 'ubuntu-latest'
42+
uses: actions-rs/clippy-check@v1
43+
with:
44+
token: ${{ secrets.GITHUB_TOKEN }}
45+
args: --all-features
46+
47+
- name: Build test binary
48+
run: cargo test --no-run
49+
50+
- name: Install dependencies
51+
if: matrix.os == 'ubuntu-latest'
1852
run: |
1953
sudo apt update -y
2054
sudo apt install -y check valgrind # required for make plugin
2155
sudo apt install -y libcurl4-gnutls-dev libgit2-dev # required for R
22-
- uses: r-lib/actions/setup-r@v1
56+
57+
- name: Install Node
58+
uses: actions/setup-node@v2
2359
with:
24-
r-version: "3.5.3"
25-
- uses: actions/setup-dotnet@v1
60+
node-version: "16"
61+
62+
- name: Install C#
63+
uses: actions/setup-dotnet@v1
2664
with:
2765
dotnet-version: "5.0.x"
66+
67+
- name: Install R
68+
if: matrix.os == 'ubuntu-latest'
69+
uses: r-lib/actions/setup-r@v1
70+
with:
71+
r-version: "3.5.3"
2872
- name: Install tmc-r-tester
73+
if: matrix.os == 'ubuntu-latest'
2974
run: |
3075
Rscript -e 'install.packages(c("testthat", "jsonlite", "R.utils"))'
3176
Rscript -e 'install.packages("plugins/r/tests/tmcRtestrunner", repos=NULL, type="source")'
32-
- name: Build test binary
33-
run: cargo test --no-run --verbose
34-
- name: Run tests
35-
run: cargo test --verbose --no-fail-fast
3677
37-
windows:
38-
runs-on: windows-latest
39-
steps: # TODO: install missing dependencies and run all tests on windows
40-
- uses: actions/checkout@v2
41-
- uses: actions/setup-dotnet@v1
42-
with:
43-
dotnet-version: "5.0.x"
44-
- name: Diagnostics
45-
run: "gci env:"
46-
- name: Build test binary
47-
run: cargo test --no-run --verbose
48-
- name: Run tests
49-
run: cargo test --verbose --no-fail-fast
50-
51-
macos:
52-
runs-on: macos-latest
53-
steps: # TODO: install missing dependencies and run all tests on macos
54-
- uses: actions/checkout@v2
55-
- uses: actions/setup-dotnet@v1
56-
with:
57-
dotnet-version: "5.0.x"
58-
- name: Build test binary
59-
run: cargo test --no-run --verbose
6078
- name: Run tests
61-
run: cargo test --verbose --no-fail-fast
79+
run: cargo test --no-fail-fast

.github/workflows/upload-binaries.yml

Lines changed: 115 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Upload CLI binaries
33
on:
44
release:
55
types:
6-
- created
6+
- released
77

88
env:
99
TAG: ${{ github.event.release.tag_name }} # had some issue using this directly on windows
@@ -13,76 +13,159 @@ jobs:
1313
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
71-
arm:
72-
runs-on: ubuntu-18.04
73-
strategy:
74-
matrix:
75-
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
139+
macos-11:
140+
runs-on: macos-11
76141
steps:
77-
- uses: actions/checkout@v2
78-
- 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
79157
with:
80158
project_id: ${{ secrets.GCP_PROJECT_ID }}
81159
service_account_key: ${{ secrets.GCP_SA_KEY }}
160+
82161
- name: Cargo build
83162
run: |
84-
rustup target add ${{ matrix.target }}
85-
cargo install cross
86-
cross build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
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
166+
- name: Sign
167+
run: codesign --force -s - target/release/tmc-langs-cli
87168
- name: Deploy
88-
run: gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
169+
run: |
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

Comments
 (0)