Add Gitea Actions workflow: ci.yml
This commit is contained in:
77
.gitea/workflows/ci.yml
Normal file
77
.gitea/workflows/ci.yml
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, master]
|
||||||
|
pull_request:
|
||||||
|
branches: [main, master]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions/setup-rust@v1
|
||||||
|
with:
|
||||||
|
rust-version: '1.75'
|
||||||
|
toolchain: stable
|
||||||
|
|
||||||
|
- name: Cache cargo registry
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ~/.cargo/registry
|
||||||
|
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-registry-
|
||||||
|
|
||||||
|
- name: Cache cargo build
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: target
|
||||||
|
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-cargo-build-
|
||||||
|
|
||||||
|
- name: Check format
|
||||||
|
run: cargo fmt --check --all
|
||||||
|
|
||||||
|
- name: Check clippy
|
||||||
|
run: cargo clippy --all-features --all-targets -- -D warnings
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cargo build --all-features
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: cargo test --lib
|
||||||
|
|
||||||
|
- name: Run integration tests
|
||||||
|
run: cargo test --test integration_test
|
||||||
|
|
||||||
|
- name: Run all tests
|
||||||
|
run: cargo test
|
||||||
|
|
||||||
|
release:
|
||||||
|
needs: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: actions/setup-rust@v1
|
||||||
|
with:
|
||||||
|
rust-version: '1.75'
|
||||||
|
toolchain: stable
|
||||||
|
|
||||||
|
- name: Build release
|
||||||
|
run: cargo build --release --locked
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: https://gitea.com/actions/release-action@main
|
||||||
|
with:
|
||||||
|
files: |
|
||||||
|
target/release/lata
|
||||||
|
title: ${{ github.ref_name }}
|
||||||
|
body: Release ${{ github.ref_name }}
|
||||||
Reference in New Issue
Block a user