update setup-go #845
This file contains 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
on: [push] | |
name: CI | |
env: | |
BINSTALL_VERSION: 1.1.2 | |
PROTOC_VERSION: 23.4 | |
jobs: | |
rust: | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
include: | |
- os: macos-latest | |
protoc-target: osx-x86_64 | |
binstall-target: x86_64-apple-darwin.zip | |
binstall-extract: unzip | |
- os: ubuntu-latest | |
protoc-target: linux-x86_64 | |
binstall-target: x86_64-unknown-linux-gnu.tgz | |
binstall-extract: tar -xzvf | |
- os: windows-latest | |
protoc-target: win64 | |
binstall-target: x86_64-pc-windows-msvc.zip | |
binstall-extract: unzip | |
fail-fast: false | |
env: | |
SQLX_OFFLINE: true | |
PROTOC: ${{ github.workspace }}/protoc/bin/protoc | |
name: Run Rust tests | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: apt-get update | |
if: matrix.os == 'ubuntu-latest' | |
# act doesn't have sudo installed but it's required on the real actions runner | |
run: $(command -v sudo>/dev/null && echo "sudo") apt-get update | |
- name: Install deps | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
$(command -v sudo>/dev/null && echo "sudo") apt-get install -y libssl-dev libasound2-dev git | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: cache-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build | |
run: | | |
curl -LO https://github.com/protocolbuffers/protobuf/releases/download/v${{env.PROTOC_VERSION}}/protoc-${{env.PROTOC_VERSION}}-${{ matrix.protoc-target }}.zip | |
unzip protoc-${{env.PROTOC_VERSION}}-${{ matrix.protoc-target }}.zip -d "${{ github.workspace }}/protoc" | |
cargo build --no-default-features | |
cargo build | |
cargo build --all-features | |
- name: Clippy | |
run: | | |
cargo clippy --all-features -- -D warnings | |
- name: Test | |
run: | | |
# Install precompiled binaries to improve build time | |
curl -LO https://github.com/cargo-bins/cargo-binstall/releases/download/v${{env.BINSTALL_VERSION}}/cargo-binstall-${{ matrix.binstall-target }} | |
${{ matrix.binstall-extract }} cargo-binstall-${{ matrix.binstall-target }} | |
./cargo-binstall cargo-nextest --no-confirm --force | |
rustup component add llvm-tools-preview | |
cargo nextest run --locked --no-fail-fast | |
- name: Generate coverage | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
./cargo-binstall cargo-llvm-cov --no-confirm --force | |
cargo llvm-cov --all-features --codecov --ignore-filename-regex ".cargo|.*_test\.rs" > ./codecov.json | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v3 | |
with: | |
verbose: true | |
fail_ci_if_error: true | |
files: ./codecov.json | |
go: | |
strategy: | |
matrix: | |
# skip tests on mac for now, throws a weird error trying to open the input device | |
os: [ubuntu-latest, windows-latest] | |
include: | |
- os: ubuntu-latest | |
test-script: TERM=xterm-256color script -q -e -c "go test ./... -v" | |
- os: windows-latest | |
test-script: go test ./... -v | |
fail-fast: false | |
name: Run Go tests | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.x | |
- name: Test | |
run: cd platune-cli && go build && ${{ matrix.test-script }} |