name: Code Function
permissions:
contents: read
on:
pull_request:
branches: [main]
push:
branches-ignore:
- main
- release-plz-*
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
required:
runs-on: ${{ matrix.os }}
name: ubuntu / ${{ matrix.toolchain }}
strategy:
matrix:
toolchain: [stable, beta]
os: [ubuntu-latest]
include:
- os: ubuntu-latest
rust: nightly
services:
mysql:
image: mysql:8
env:
MYSQL_DATABASE: mysql_store
MYSQL_USER: mysql
MYSQL_PASSWORD: mysql
MYSQL_ROOT_PASSWORD: mysql
ports:
- 3306:3306
options: >-
--health-cmd="mysqladmin ping -h localhost -u root -pmysql"
--health-interval=10s
--health-timeout=5s
--health-retries=5
postgres:
image: postgres:18
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U postgres"
--health-interval=10s
--health-timeout=5s
--health-retries=5
mongodb:
image: mongo:8
env:
MONGO_INITDB_DATABASE: mongo_store
MONGO_INITDB_ROOT_USERNAME: mongodb
MONGO_INITDB_ROOT_PASSWORD: mongodb
ports:
- 27017:27017
options: >-
--health-cmd="mongosh --eval 'db.runCommand({ping: 1})' --quiet"
--health-interval=10s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@v6
with:
submodules: true
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Set up Python
run: uv python install 3.12
- name: Setup Python Env & Seed
run: |
uv sync --directory=scripts
source scripts/.venv/bin/activate
python scripts/seed.py
- name: Install protobuf compiler
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install ${{ matrix.toolchain }}
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: cargo test --locked
run: cargo test --locked --all-features --verbose -- --test-threads=1
- name: cargo test --doc
run: cargo test --locked --all-features --doc