ci: use mold linker #120
Workflow file for this run
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: Main | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build-linux: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- target: x86_64-unknown-linux-gnu | |
command: cargo | |
- target: aarch64-unknown-linux-gnu | |
command: cross | |
- target: x86_64-unknown-linux-musl | |
command: cross | |
- target: aarch64-unknown-linux-musl | |
command: cross | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/postgres" | |
CROSS_CONTAINER_OPTS: "--network=host" | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST_AUTH_METHOD: md5 | |
POSTGRES_INITDB_ARGS: --auth-host=md5 | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install mold | |
uses: rui314/setup-mold@v1 | |
if: matrix.platform.command == 'cargo' | |
- name: Install cross | |
if: matrix.platform.command == 'cross' | |
run: cargo install cross --git https://github.com/cross-rs/cross | |
- name: Build and test | |
run: ${{ matrix.platform.command }} test --locked --target ${{ matrix.platform.target }} | |
build-windows: | |
runs-on: windows-latest | |
env: | |
VCPKG_BINARY_SOURCES: "clear;x-gha,readwrite" | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ikalnytskyi/action-setup-postgres@v5 | |
id: postgres | |
- name: Export GitHub Actions cache environment variables | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
- name: Install libpq | |
run: | | |
vcpkg install libpq[core]:x64-windows-release | |
cp "C:/vcpkg/installed/x64-windows-release/lib/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/lib/" | |
cp "C:/vcpkg/installed/x64-windows-release/bin/*" "C:/Users/runneradmin/.rustup/toolchains/stable-x86_64-pc-windows-msvc/lib/rustlib/x86_64-pc-windows-msvc/bin/" | |
- name: Build and test | |
run: cargo test --locked --target x86_64-pc-windows-msvc | |
env: | |
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }} | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ikalnytskyi/action-setup-postgres@v5 | |
id: postgres | |
- name: Build and test | |
run: cargo test --locked --target x86_64-apple-darwin | |
env: | |
DATABASE_URL: ${{ steps.postgres.outputs.connection-uri }} |