Skip to content

ci: use mold linker #101

ci: use mold linker

ci: use mold linker #101

Workflow file for this run

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
- uses: cargo-bins/cargo-binstall@main
- name: Install cross
run: cargo binstall cross --no-confirm
- name: Install mold
if: matrix.platform.command == 'cargo'
run: |
apt-get update
apt-get --assume-yes install mold
- 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 }}