Skip to content

chore: cargo update + drop test counts from README #4

chore: cargo update + drop test counts from README

chore: cargo update + drop test counts from README #4

Workflow file for this run

---
name: Build and Test
permissions:
contents: read
on:
push:
branches:
- main
pull_request:
merge_group:
env:
CARGO_TERM_COLOR: always
RUST_TOOLCHAIN_VERSION: "1.93.0"
// TODO all github workflows should be using the latest pinned versions of the actions - https://simonw.github.io/actions-latest/versions.txt helps maybe but only partially, check upstream what the real latest hash is

Check failure on line 18 in .github/workflows/build.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/build.yaml

Invalid workflow file

You have an error in your yaml syntax on line 18
jobs:
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust ${{ env.RUST_TOOLCHAIN_VERSION }} toolchain
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
components: clippy
- name: Setup Rust Cache
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
- name: Build
run: cargo build --release
- name: Run unit tests
run: cargo test --lib --bins
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
static-binary:
name: Static (musl) Build
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- name: Install host dependencies
uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.6.0
with:
packages: musl-tools
version: ubuntu-latest
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
token: ${{ secrets.GITHUB_TOKEN }}
- name: Install Rust ${{ env.RUST_TOOLCHAIN_VERSION }} toolchain
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
targets: x86_64-unknown-linux-musl
- name: Setup Rust Cache
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
with:
key: musl
- name: Build static binary
run: cargo build --release --target x86_64-unknown-linux-musl
- name: Confirm binary is statically linked
run: |
file target/x86_64-unknown-linux-musl/release/postgresql-trino-gateway \
| tee /tmp/file.out
grep -q "statically linked" /tmp/file.out
# Single required check for branch protection rules.
finished:
name: Finished Build and Test
if: always()
needs:
- unit-tests
- static-binary
runs-on: ubuntu-latest
steps:
- name: Check job results
run: |
if [[ "${{ needs.unit-tests.result }}" != "success" ]] ||
[[ "${{ needs.static-binary.result }}" != "success" ]]; then
echo "One or more jobs failed"
exit 1
fi
echo "All jobs passed"