docs: enable Github sponsor #158
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
name: CI | |
on: [push, pull_request] | |
jobs: | |
code_quality: | |
name: Code quality | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
components: clippy, rustfmt | |
- uses: taiki-e/install-action@just | |
- uses: taiki-e/install-action@dprint | |
- uses: taiki-e/install-action@v2 | |
with: | |
tool: typos-cli | |
- name: Check MSRV | |
run: | | |
cargo_msrv=$(sed -n 's/rust-version = "\(.*\)"/\1/p' Cargo.toml) | |
toolchain_channel=$(sed -n 's/channel = "\(.*\)"/\1/p' rust-toolchain.toml) | |
echo "Cargo MSRV: $cargo_msrv" | |
echo "Toolchain Channel: $toolchain_channel" | |
if [ "$cargo_msrv" = "$toolchain_channel" ]; then | |
echo "MSRV match" | |
else | |
echo "MSRV do not match" | |
exit 1 | |
fi | |
- name: Show version information | |
shell: bash | |
run: | | |
rustc --version | |
cargo --version | |
cargo fmt --version | |
- name: Ensure `fmt` has been run | |
run: just fmt-check | |
- name: Run clippy | |
env: | |
SQLX_OFFLINE: true | |
run: just lint | |
msrv: | |
name: Minimum supported rust version | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
- uses: taiki-e/install-action@nextest | |
- uses: taiki-e/install-action@just | |
- name: Prepare the environment variables | |
run: | | |
cp .example.env .env | |
- name: Prepare the database | |
env: | |
PGPASSWORD: secret | |
run: | | |
docker-compose --file ./tests/docker-compose.yml run --detach -p 5432:5432 --name postgres_db postgres_db | |
# Wait until the DB is up | |
docker exec postgres_db bash -c "until pg_isready; do sleep 1; done" | |
# Check DB version | |
docker exec postgres_db psql -h localhost -p 5432 -U durin --version | |
- name: Show version information | |
shell: bash | |
run: | | |
rustc --version | |
cargo --version | |
- name: Run tests | |
env: | |
DATABASE_URL: postgres://durin:SpeakFriendAndEnter@localhost:5432/tin | |
run: just test | |
build: | |
name: Build for ${{ matrix.build }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { build: linux-gnu, os: ubuntu-22.04, target: x86_64-unknown-linux-gnu } | |
# `sfackler/rust-openssl` needs more effort to compile to musl | |
# - { build: linux-musl, os: ubuntu-22.04, target: x86_64-unknown-linux-musl } | |
- { build: win-gnu, os: windows-2022, target: x86_64-pc-windows-gnu } | |
- { build: win-msvc, os: windows-2022, target: x86_64-pc-windows-msvc } | |
- { build: win32-msvc, os: windows-2022, target: i686-pc-windows-msvc } | |
- { build: macos, os: macos-12 , target: x86_64-apple-darwin } | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v4 | |
- uses: actions-rust-lang/setup-rust-toolchain@v1 | |
with: | |
target: ${{ matrix.target }} | |
- name: Show version information | |
shell: bash | |
run: | | |
rustc --version | |
cargo --version | |
- name: Install musl-tools | |
if: matrix.target == 'x86_64-unknown-linux-musl' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y --no-install-recommends \ | |
--allow-unauthenticated musl-tools | |
- name: Build | |
run: cargo build --release --locked --target ${{ matrix.target }} |