2021-02-14 08:39:51 -07:00
|
|
|
name: Rust
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ main ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2021-02-14 08:51:14 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/checkout@v3
|
2021-05-07 14:28:16 -06:00
|
|
|
|
2021-04-20 10:07:11 -06:00
|
|
|
- name: Install rust
|
2023-03-28 14:44:23 -06:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2021-02-14 08:51:14 -07:00
|
|
|
with:
|
2021-04-20 10:07:11 -06:00
|
|
|
toolchain: stable
|
2021-02-14 08:39:51 -07:00
|
|
|
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/cache@v3
|
2021-05-07 14:28:16 -06:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-cargo-release-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2021-05-10 15:25:42 -06:00
|
|
|
- name: Run cargo build common
|
2022-04-23 14:29:43 -06:00
|
|
|
run: cargo build -p atuin-common --locked --release
|
2021-05-10 15:25:42 -06:00
|
|
|
|
|
|
|
- name: Run cargo build client
|
2022-04-23 14:29:43 -06:00
|
|
|
run: cargo build -p atuin-client --locked --release
|
2021-05-10 15:25:42 -06:00
|
|
|
|
|
|
|
- name: Run cargo build server
|
2022-04-23 14:29:43 -06:00
|
|
|
run: cargo build -p atuin-server --locked --release
|
2021-05-10 15:25:42 -06:00
|
|
|
|
|
|
|
- name: Run cargo build main
|
2022-04-23 14:29:43 -06:00
|
|
|
run: cargo build --all --locked --release && strip target/release/atuin
|
2021-04-26 07:25:57 -06:00
|
|
|
|
2023-07-31 02:16:29 -06:00
|
|
|
unit-test:
|
2023-10-25 02:25:43 -06:00
|
|
|
runs-on: [self-hosted, ARM64, macOS]
|
2023-07-31 02:16:29 -06:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
|
|
|
|
- name: Install rust
|
|
|
|
uses: dtolnay/rust-toolchain@master
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
|
|
|
|
# - 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 test --lib --bins
|
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2023-08-14 02:27:35 -06:00
|
|
|
- name: Run cargo check (client only)
|
|
|
|
run: cargo check --no-default-features --features client --workspace
|
|
|
|
|
2023-07-31 02:16:29 -06:00
|
|
|
integration-test:
|
2021-02-14 08:39:51 -07:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2023-07-27 02:34:13 -06:00
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: atuin
|
|
|
|
POSTGRES_PASSWORD: pass
|
|
|
|
POSTGRES_DB: atuin
|
|
|
|
ports:
|
|
|
|
- 5432:5432
|
|
|
|
|
2021-02-14 08:39:51 -07:00
|
|
|
steps:
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 08:51:14 -07:00
|
|
|
|
2021-04-20 10:07:11 -06:00
|
|
|
- name: Install rust
|
2023-03-28 14:44:23 -06:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2021-02-14 08:51:14 -07:00
|
|
|
with:
|
2021-04-20 10:07:11 -06:00
|
|
|
toolchain: stable
|
2021-02-14 08:51:14 -07:00
|
|
|
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/cache@v3
|
2021-05-07 14:28:16 -06:00
|
|
|
with:
|
|
|
|
path: |
|
2023-03-28 14:44:23 -06:00
|
|
|
~/.cargo/registry
|
2021-05-07 14:28:16 -06:00
|
|
|
~/.cargo/git
|
|
|
|
target
|
2023-03-28 14:44:23 -06:00
|
|
|
key: ${ runner.os }-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
2021-05-07 14:28:16 -06:00
|
|
|
|
2021-02-14 08:51:14 -07:00
|
|
|
- name: Run cargo test
|
2023-07-31 02:16:29 -06:00
|
|
|
run: cargo test --test '*'
|
2023-07-27 02:34:13 -06:00
|
|
|
env:
|
|
|
|
ATUIN_DB_URI: postgres://atuin:pass@localhost:5432/atuin
|
2022-04-22 14:14:23 -06:00
|
|
|
|
2021-02-14 08:51:14 -07:00
|
|
|
clippy:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 08:51:14 -07:00
|
|
|
|
2021-04-20 10:07:11 -06:00
|
|
|
- name: Install latest rust
|
2023-03-28 14:44:23 -06:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2021-02-14 08:51:14 -07:00
|
|
|
with:
|
2021-04-20 10:07:11 -06:00
|
|
|
toolchain: stable
|
2021-02-14 08:56:49 -07:00
|
|
|
components: clippy
|
2021-02-14 08:51:14 -07:00
|
|
|
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/cache@v3
|
2021-05-07 14:28:16 -06:00
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/.cargo/registry
|
|
|
|
~/.cargo/git
|
|
|
|
target
|
|
|
|
key: ${{ runner.os }}-cargo-debug-${{ hashFiles('**/Cargo.lock') }}
|
|
|
|
|
2021-02-14 08:55:30 -07:00
|
|
|
- name: Run clippy
|
2021-02-14 11:16:53 -07:00
|
|
|
run: cargo clippy -- -D warnings
|
2021-02-14 08:55:30 -07:00
|
|
|
|
|
|
|
format:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-03-28 14:44:23 -06:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-14 08:55:30 -07:00
|
|
|
|
2021-04-20 10:07:11 -06:00
|
|
|
- name: Install latest rust
|
2023-03-28 14:44:23 -06:00
|
|
|
uses: dtolnay/rust-toolchain@master
|
2021-02-14 08:55:30 -07:00
|
|
|
with:
|
2021-04-20 10:07:11 -06:00
|
|
|
toolchain: stable
|
2021-02-14 08:55:30 -07:00
|
|
|
components: rustfmt
|
2021-05-07 14:28:16 -06:00
|
|
|
|
2021-02-14 08:55:30 -07:00
|
|
|
- name: Format
|
|
|
|
run: cargo fmt -- --check
|