2021-02-14 16:39:51 +01:00
|
|
|
name: Rust
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2024-04-11 17:59:01 +02:00
|
|
|
branches: [main]
|
2021-02-14 16:39:51 +01:00
|
|
|
pull_request:
|
2024-04-11 17:59:01 +02:00
|
|
|
branches: [main]
|
2021-02-14 16:39:51 +01:00
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2024-02-05 10:28:55 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-08 13:09:04 +02:00
|
|
|
os: [ubuntu-latest, macos-14]
|
2024-02-05 10:28:55 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2021-02-14 16:51:14 +01:00
|
|
|
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-07 22:28:16 +02:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2021-04-20 18:07:11 +02:00
|
|
|
toolchain: stable
|
2021-02-14 16:39:51 +01:00
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Run cargo build common
|
|
|
|
run: cargo build -p atuin-common --locked --release
|
|
|
|
|
|
|
|
- name: Run cargo build client
|
|
|
|
run: cargo build -p atuin-client --locked --release
|
|
|
|
|
|
|
|
- name: Run cargo build server
|
|
|
|
run: cargo build -p atuin-server --locked --release
|
|
|
|
|
|
|
|
- name: Run cargo build main
|
|
|
|
run: cargo build --all --locked --release
|
2021-04-26 15:25:57 +02:00
|
|
|
|
2024-03-06 11:32:56 +01:00
|
|
|
cross-compile:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
# There was an attempt to make cross-compiles also work on FreeBSD, but that failed with:
|
|
|
|
#
|
|
|
|
# warning: libelf.so.2, needed by <...>/libkvm.so, not found (try using -rpath or -rpath-link)
|
|
|
|
target: [x86_64-unknown-illumos]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install cross
|
|
|
|
uses: taiki-e/install-action@v1
|
|
|
|
with:
|
|
|
|
tool: cross
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ matrix.target }}-cross-compile-${{ hashFiles('**/Cargo.lock') }}
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Run cross build common
|
|
|
|
run: cross build -p atuin-common --locked --target ${{ matrix.target }}
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Run cross build client
|
|
|
|
run: cross build -p atuin-client --locked --target ${{ matrix.target }}
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Run cross build server
|
|
|
|
run: cross build -p atuin-server --locked --target ${{ matrix.target }}
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Run cross build main
|
2024-05-08 13:09:04 +02:00
|
|
|
run: |
|
|
|
|
cross build --all --locked --target ${{ matrix.target }}
|
2024-03-06 11:32:56 +01:00
|
|
|
|
2023-07-31 10:16:29 +02:00
|
|
|
unit-test:
|
2024-02-05 10:28:55 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-08 13:09:04 +02:00
|
|
|
os: [ubuntu-latest, macos-14]
|
2024-02-05 10:28:55 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2023-07-31 10:16:29 +02:00
|
|
|
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2023-07-31 10:16:29 +02:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2023-07-31 10:16:29 +02:00
|
|
|
toolchain: stable
|
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-04-11 17:59:01 +02:00
|
|
|
|
|
|
|
- uses: taiki-e/install-action@v2
|
|
|
|
name: Install nextest
|
|
|
|
with:
|
|
|
|
tool: cargo-nextest
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${ runner.os }-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Run cargo test
|
|
|
|
run: cargo nextest run --lib --bins
|
2024-02-01 16:08:01 +01:00
|
|
|
|
|
|
|
check:
|
2024-02-05 10:28:55 +01:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-05-08 13:09:04 +02:00
|
|
|
os: [ubuntu-latest, macos-14]
|
2024-02-05 10:28:55 +01:00
|
|
|
runs-on: ${{ matrix.os }}
|
2024-02-01 16:08:01 +01:00
|
|
|
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2024-02-01 16:08:01 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2024-02-01 16:08:01 +01:00
|
|
|
toolchain: stable
|
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-04-11 17:59:01 +02:00
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${ runner.os }-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Run cargo check (all features)
|
|
|
|
run: cargo check --all-features --workspace
|
|
|
|
|
|
|
|
- name: Run cargo check (no features)
|
|
|
|
run: cargo check --no-default-features --workspace
|
|
|
|
|
|
|
|
- name: Run cargo check (sync)
|
|
|
|
run: cargo check --no-default-features --features sync --workspace
|
|
|
|
|
|
|
|
- name: Run cargo check (server)
|
|
|
|
run: cargo check --no-default-features --features server --workspace
|
|
|
|
|
|
|
|
- name: Run cargo check (client only)
|
|
|
|
run: cargo check --no-default-features --features client --workspace
|
2023-08-14 10:27:35 +02:00
|
|
|
|
2023-07-31 10:16:29 +02:00
|
|
|
integration-test:
|
2021-02-14 16:39:51 +01:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2023-07-27 10:34:13 +02:00
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: atuin
|
|
|
|
POSTGRES_PASSWORD: pass
|
|
|
|
POSTGRES_DB: atuin
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
2021-02-14 16:39:51 +01:00
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 16:51:14 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2021-04-20 18:07:11 +02:00
|
|
|
toolchain: stable
|
2021-02-14 16:51:14 +01:00
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: taiki-e/install-action@v2
|
|
|
|
name: Install nextest
|
|
|
|
with:
|
|
|
|
tool: cargo-nextest
|
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${ runner.os }-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Run cargo test
|
|
|
|
run: cargo nextest run --test '*'
|
|
|
|
env:
|
|
|
|
ATUIN_DB_URI: postgres://atuin:pass@localhost:5432/atuin
|
2022-04-22 22:14:23 +02:00
|
|
|
|
2021-02-14 16:51:14 +01:00
|
|
|
clippy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 16:51:14 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install latest rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2021-04-20 18:07:11 +02:00
|
|
|
toolchain: stable
|
2021-02-14 16:56:49 +01:00
|
|
|
components: clippy
|
2021-02-14 16:51:14 +01:00
|
|
|
|
2024-05-08 13:09:04 +02:00
|
|
|
- name: Install Protoc
|
|
|
|
uses: arduino/setup-protoc@v3
|
|
|
|
with:
|
|
|
|
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
2024-04-11 17:59:01 +02:00
|
|
|
|
|
|
|
- uses: actions/cache@v3
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
|
|
|
- name: Run clippy
|
|
|
|
run: cargo clippy -- -D warnings
|
|
|
|
|
2021-02-14 16:55:30 +01:00
|
|
|
format:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2024-04-11 17:59:01 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 16:55:30 +01:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Install latest rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
2021-04-20 18:07:11 +02:00
|
|
|
toolchain: stable
|
2021-02-14 16:55:30 +01:00
|
|
|
components: rustfmt
|
2021-05-07 22:28:16 +02:00
|
|
|
|
2024-04-11 17:59:01 +02:00
|
|
|
- name: Format
|
|
|
|
run: cargo fmt -- --check
|