Skip to content

Commit

Permalink
Copy workflow setup from 74dcb3e
Browse files Browse the repository at this point in the history
  • Loading branch information
jolampi committed Nov 22, 2021
1 parent f1100c0 commit b98299d
Show file tree
Hide file tree
Showing 5 changed files with 177 additions and 118 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/clippy.yml

This file was deleted.

9 changes: 7 additions & 2 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,15 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
persist-credentials: false
profile: minimal
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v1

- name: Install and build
- name: Build docs
run: cargo doc

- name: Copy index to target/doc
Expand Down
14 changes: 0 additions & 14 deletions .github/workflows/fmt.yml

This file was deleted.

96 changes: 57 additions & 39 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,60 +2,78 @@ name: Run tests

on:
push:
branches: [master]
branches: [main, "[0-9]+.[0-9]+"]
pull_request:
branches: [master]
branches: [main, "[0-9]+.[0-9]+"]

env:
RUST_LOG: debug,j4rs=warn
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0"

jobs:
linux:
runs-on: ubuntu-latest
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
- name: Install depedencies
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Cache
uses: Swatinem/rust-cache@v1

- name: Diagnostics on Windows
if: matrix.os == 'windows-latest'
run: "gci env:"

- name: Rustfmt
run: cargo fmt -- --check
- name: Clippy
if: matrix.os == 'ubuntu-latest'
uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

- name: Build test binary
run: cargo test --no-run

- name: Install dependencies
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt update -y
sudo apt install -y check valgrind # required for make plugin
sudo apt install -y libcurl4-gnutls-dev libgit2-dev # required for R
- uses: r-lib/actions/setup-r@v1
with:
r-version: "3.5.3"
- uses: actions/setup-dotnet@v1
- name: Install Node
uses: actions/setup-node@v2
with:
dotnet-version: "5.0.x"
- name: Install tmc-r-tester
run: |
Rscript -e 'install.packages(c("devtools","testthat", "httr", "curl"),repos="https://ftp.eenet.ee/pub/cran/")'
Rscript -e 'devtools::install_github("RTMC/tmc-r-tester/tmcRtestrunner")'
- name: Build test binary
run: cargo test --no-run --verbose
- name: Run tests
run: cargo test --verbose --no-fail-fast
node-version: "16"

windows:
runs-on: windows-latest
steps: # TODO: install missing dependencies and run all tests on windows
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- name: Install C#
uses: actions/setup-dotnet@v1
with:
dotnet-version: "5.0.x"
- name: Diagnostics
run: "gci env:"
- name: Build test binary
run: cargo test --no-run --verbose
- name: Run tests
run: cargo test --verbose --no-fail-fast

macos:
runs-on: macos-latest
steps: # TODO: install missing dependencies and run all tests on macos
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
- name: Install R
if: matrix.os == 'ubuntu-latest'
uses: r-lib/actions/setup-r@v1
with:
dotnet-version: "5.0.x"
- name: Build test binary
run: cargo test --no-run --verbose
r-version: "3.5.3"
- name: Install tmc-r-tester
if: matrix.os == 'ubuntu-latest'
run: |
Rscript -e 'install.packages(c("testthat", "jsonlite", "R.utils"))'
Rscript -e 'install.packages("plugins/r/tests/tmcRtestrunner", repos=NULL, type="source")'
- name: Run tests
run: cargo test --verbose --no-fail-fast
run: cargo test --no-fail-fast
158 changes: 113 additions & 45 deletions .github/workflows/upload-binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,101 +3,169 @@ name: Upload CLI binaries
on:
release:
types:
- created
- released

env:
TAG: ${{ github.event.release.tag_name }} # had some issue using this directly on windows

jobs:
linux:
runs-on: ubuntu-16.04
runs-on: ubuntu-18.04
strategy:
matrix:
target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
target:
[
x86_64-unknown-linux-gnu,
i686-unknown-linux-gnu,
aarch64-unknown-linux-gnu,
armv7-unknown-linux-gnueabihf,
]
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: GCloud
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y gcc-multilib # required to build for 32-bit arch
- name: Cargo build
run: |
rustup target add i686-unknown-linux-gnu
cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
sudo apt install -y gcc-multilib # required to build for 32-bit arch
- name: Install aarch64-unknown-linux-gnu linker
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }}
run: sudo apt install -y gcc-aarch64-linux-gnu
- name: Install armv7-unknown-linux-gnueabihf linker
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }}
run: sudo apt install -y gcc-arm-linux-gnueabihf

- name: Deploy
run: gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
run: |
rustup target add ${{ matrix.target }}
# build and deploy CLI
cargo build -p tmc-langs-cli --release --target ${{ matrix.target }}
gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
# build and deploy Node module
npm --prefix ./bindings/tmc-langs-node install
npm --prefix ./bindings/tmc-langs-node run build -- --release --target ${{ matrix.target }}
gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node
windows:
runs-on: windows-latest
strategy:
matrix:
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc]
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: GCloud
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Cargo build # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)

- name: Build
run: |
rustup target add i686-pc-windows-msvc
$env:RUSTFLAGS="-C target-feature=+crt-static"
cargo build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
rustup target add ${{ matrix.target }}
$env:RUSTFLAGS="-C target-feature=+crt-static" # crt-static is set with RUSTFLAGS to statically link MSVCRT (VCRUNTIME140.dll)
cargo build -p tmc-langs-cli --release --target ${{ matrix.target }}
cd ./bindings/tmc-langs-node && npm install && npm run build -- --release --target ${{ matrix.target }}
- 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-langs-cli.exe gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$Env:TAG.exe
gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$Env:TAG.node
macos:
runs-on: macos-latest
runs-on: macos-10.15
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: GCloud
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Cargo build
run: cargo build -p tmc-langs-cli --release --verbose
run: |
cargo build -p tmc-langs-cli --release
npm --prefix ./bindings/tmc-langs-node install
npm run --prefix ./bindings/tmc-langs-node build -- --release
- name: Sign
run: codesign --force -s - target/release/tmc-langs-cli
- name: Deploy
run: gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-x86_64-apple-darwin-$TAG
run: |
gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-x86_64-apple-darwin-$TAG
gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-x86_64-apple-darwin-$TAG.node
macos-11:
runs-on: macos-11.0
runs-on: macos-11
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
- name: Checkout
uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- name: Cache
uses: Swatinem/rust-cache@v1
- name: Node
uses: actions/setup-node@v2
with:
node-version: "16"
- name: GCloud
uses: google-github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}

- name: Cargo build
run: cargo build -p tmc-langs-cli --release --verbose
run: |
cargo build -p tmc-langs-cli --release
npm --prefix ./bindings/tmc-langs-node install
npm run --prefix ./bindings/tmc-langs-node build -- --release
- name: Sign
run: codesign --force -s - target/release/tmc-langs-cli
- name: Deploy
run: gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-aarch64-apple-darwin-$TAG

arm:
runs-on: ubuntu-16.04
strategy:
matrix:
target: [aarch64-unknown-linux-gnu, armv7-unknown-linux-gnueabihf]
steps:
- uses: actions/checkout@v2
- uses: GoogleCloudPlatform/github-actions/setup-gcloud@master
with:
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_SA_KEY }}
- name: Cargo build
run: |
rustup target add ${{ matrix.target }}
cargo install cross
cross build -p tmc-langs-cli --release --verbose --target ${{ matrix.target }}
- name: Deploy
run: gsutil cp target/${{ matrix.target }}/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG
gsutil cp target/release/tmc-langs-cli gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-aarch64-apple-darwin-$TAG
gsutil cp bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-aarch64-apple-darwin-$TAG.node

0 comments on commit b98299d

Please sign in to comment.