0.39.2 #163
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload CLI binaries | |
on: | |
release: | |
types: | |
- created | |
env: | |
TAG: ${{ github.event.release.tag_name }} # had some issue using this directly on windows | |
jobs: | |
linux: | |
runs-on: ubuntu-latest | |
container: | |
# due to the dynamically linked glibc, | |
# changes to the image should be communicated in the changelog | |
# as a change to the minimum OS version requirement | |
image: ubuntu:20.04 | |
options: --user root | |
strategy: | |
fail-fast: false # we don't want to cancel building binaries for other targets just because one fails | |
matrix: | |
target: | |
[ | |
x86_64-unknown-linux-gnu, | |
i686-unknown-linux-gnu, | |
aarch64-unknown-linux-gnu, | |
armv7-unknown-linux-gnueabihf, | |
x86_64-unknown-linux-musl, | |
] | |
steps: | |
- name: Install dependencies | |
run: | | |
apt update | |
apt install -y gcc-multilib # required to build for 32-bit arch | |
apt install -y curl # required for Rust installation | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- 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 aarch64-unknown-linux-gnu linker | |
if: ${{ matrix.target == 'aarch64-unknown-linux-gnu' }} | |
run: apt install -y gcc-aarch64-linux-gnu | |
- name: Install armv7-unknown-linux-gnueabihf linker | |
if: ${{ matrix.target == 'armv7-unknown-linux-gnueabihf' }} | |
run: apt install -y gcc-arm-linux-gnueabihf | |
- name: Install musl gcc | |
if: ${{ matrix.target == 'x86_64-unknown-linux-musl' }} | |
run: apt install -y musl-tools | |
- name: Build | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build -p tmc-langs-cli --release --target ${{ matrix.target }} | |
npm --prefix ./crates/bindings/tmc-langs-node install | |
- name: Build for node | |
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' }} | |
run: npm --prefix ./crates/bindings/tmc-langs-node run build -- --release --target ${{ matrix.target }} | |
- name: Generate checksums | |
run: | | |
sha256sum ./target/${{ matrix.target }}/release/tmc-langs-cli > ./target/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 | |
if [ "${{ matrix.target }}" != "x86_64-unknown-linux-musl" ]; then | |
sha256sum ./crates/bindings/tmc-langs-node/ts/functions.node > ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$TAG.node.sha256 | |
fi | |
- 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/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 | |
- name: Deploy for node | |
if: ${{ matrix.target != 'x86_64-unknown-linux-musl' }} | |
run: | | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$TAG.node.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node.sha256 | |
windows: | |
runs-on: windows-2022 | |
strategy: | |
fail-fast: false # we don't want to cancel building binaries for other targets just because one fails | |
matrix: | |
target: [i686-pc-windows-msvc, x86_64-pc-windows-msvc] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- 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: Build | |
run: | | |
git config --system core.longpaths true # allow long paths from git deps | |
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 ./crates/bindings/tmc-langs-node && npm install && npm run build -- --release --target ${{ matrix.target }} | |
- name: Generate checksums | |
run: | | |
Get-FileHash -Path ./target/${{ matrix.target }}/release/tmc-langs-cli.exe -Algorithm SHA256 | Select-Object -ExpandProperty Hash | Out-File -Encoding ASCII ./target/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$Env:TAG.exe.sha256 | |
Get-FileHash -Path ./crates/bindings/tmc-langs-node/ts/functions.node -Algorithm SHA256 | Select-Object -ExpandProperty Hash | Out-File -Encoding ASCII ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$Env:TAG.node.sha256 | |
- 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 ./target/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$Env:TAG.exe.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$Env:TAG.exe.sha256 | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$Env:TAG.node | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$Env:TAG.node.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$Env:TAG.node.sha256 | |
macos: | |
runs-on: macos-13 | |
strategy: | |
fail-fast: false # we don't want to cancel building binaries for other targets just because one fails | |
matrix: | |
target: [x86_64-apple-darwin, aarch64-apple-darwin] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Cache | |
uses: Swatinem/rust-cache@v2 | |
- name: Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "18" | |
- id: "auth" | |
uses: google-github-actions/auth@v2 | |
with: | |
project_id: ${{ secrets.GCP_PROJECT_ID }} | |
credentials_json: ${{ secrets.GCP_SA_KEY }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" # gsutil doesn't support >3.11 | |
- name: "Set up Cloud SDK" | |
uses: google-github-actions/setup-gcloud@v2 | |
- name: Cargo build | |
run: | | |
rustup target add ${{ matrix.target }} | |
cargo build -p tmc-langs-cli --release --target ${{ matrix.target }} | |
npm --prefix ./crates/bindings/tmc-langs-node install | |
npm run --prefix ./crates/bindings/tmc-langs-node build -- --release | |
- name: Sign | |
run: codesign --force -s - target/${{ matrix.target }}/release/tmc-langs-cli | |
- name: Generate checksums | |
run: | | |
shasum -a 256 ./target/${{ matrix.target }}/release/tmc-langs-cli > ./target/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 | |
shasum -a 256 ./crates/bindings/tmc-langs-node/ts/functions.node > ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$TAG.node.sha256 | |
- 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/${{ matrix.target }}/release/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-cli-${{ matrix.target }}-$TAG.sha256 | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions.node gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node | |
gsutil cp ./crates/bindings/tmc-langs-node/ts/functions-${{ matrix.target }}-$TAG.node.sha256 gs://${{ secrets.GCP_BUCKET }}/tmc-langs-rust/tmc-langs-${{ matrix.target }}-$TAG.node.sha256 |