104 lines
2.9 KiB
YAML
104 lines
2.9 KiB
YAML
name: Cargo
|
|
run-name: ${{ gitea.actor }} is verifying cargo build and tests
|
|
on: [push]
|
|
|
|
jobs:
|
|
build:
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
runs-on: rust-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
${{ runner.os }}-cargo-
|
|
- name: Build release project
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: build
|
|
args: --locked
|
|
|
|
check:
|
|
needs: build
|
|
runs-on: rust-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- name: Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
${{ runner.os }}-cargo-
|
|
- name: Run clippy
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: clippy
|
|
args: -p nuchat --no-deps -- -Dwarnings -Wclippy::correctness -Wclippy::complexity -Wclippy::perf -Aclippy::missing_errors_doc -Aclippy::missing_panics_doc
|
|
|
|
ui:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
- name: Build
|
|
working-directory: ./ui
|
|
run: |
|
|
npm ci
|
|
npm run build
|
|
- name: Upload dist
|
|
working-directory: ./ui
|
|
uses: https://gitea.com/actions/upload-artifact@v3
|
|
with:
|
|
name: dist-${{ hashFiles('src/**') }}
|
|
path: dist
|
|
include-hidden-files: true
|
|
|
|
test:
|
|
needs: [build, ui]
|
|
runs-on: rust-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 24
|
|
- name: Cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
|
|
${{ runner.os }}-cargo-
|
|
- name: Download dist
|
|
working-directory: ./ui
|
|
uses: https://gitea.com/actions/download-artifact@v3
|
|
with:
|
|
name: dist-${{ hashFiles('src/**') }}
|
|
path: ../dist
|
|
- name: Run tests
|
|
uses: actions-rs/cargo@v1
|
|
with:
|
|
command: test
|