Skip to content

Merge pull request #176 from xsnippet/ci2 #491

Merge pull request #176 from xsnippet/ci2

Merge pull request #176 from xsnippet/ci2 #491

Workflow file for this run

name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUST_BACKTRACE: 1
defaults:
run:
shell: bash
jobs:
spellcheck:
name: Spell check with Typos
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
cargo-fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
cargo-clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: clippy
override: true
- uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings
cargo-test:
strategy:
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Setup PostgreSQL
uses: ikalnytskyi/action-setup-postgres@v6
id: postgres
- name: Set ROCKET_DATABASE_URL
run: |
echo "ROCKET_DATABASE_URL=${{ steps.postgres.outputs.connection-uri }}" >> $GITHUB_ENV
- name: Install Alembic and psycopg2
run: |
python -m pip install --upgrade wheel
python -m pip install --upgrade alembic psycopg2-binary
- name: Run database migrations
run: |
python -m alembic.config upgrade head
- uses: actions-rs/cargo@v1
with:
command: test
cargo-rustdoc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- uses: actions-rs/cargo@v1
with:
command: rustdoc
args: -- -D rustdoc::broken_intra_doc_links
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.12'
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: Setup PostgreSQL
uses: ikalnytskyi/action-setup-postgres@v6
id: postgres
- run: |
echo "ROCKET_DATABASE_URL=${{ steps.postgres.outputs.connection-uri }}" >> $GITHUB_ENV
- run: cargo build
- run: python -m venv testvenv
- run: ./testvenv/bin/python -m pip install -r tests/requirements.txt
- run: ./testvenv/bin/python -m pytest -vv tests/