Skip to content

Linux

Linux #532

Workflow file for this run

name: Linux
on:
push:
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"]
pull_request:
branches: [main, "v[0-9]+.[0-9]+.[0-9]+"]
release:
types:
- created
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.7
- 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: ${{ github.event_name == 'release' }}
runs-on: ubuntu-20.04
strategy:
matrix:
target: [i686-unknown-linux-gnu, x86_64-unknown-linux-gnu]
steps:
- uses: actions/checkout@v4.1.7
- id: "auth"
uses: google-github-actions/auth@v2.1.5
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.1.1
- 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
shell: bash
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
- 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 }}