67 lines
1.5 KiB
YAML
67 lines
1.5 KiB
YAML
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-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
override: true
|
|
|
|
- name: Build
|
|
run: cargo build --release
|
|
|
|
- name: Run tests
|
|
run: cargo test --all
|
|
|
|
- name: Run clippy
|
|
run: cargo clippy --all --all-features -- -D warnings
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt -- --check
|
|
|
|
binary:
|
|
runs-on: ubuntu-latest
|
|
needs: test
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: actions-rs/toolchain@v1
|
|
with:
|
|
toolchain: stable
|
|
target: x86_64-unknown-linux-musl
|
|
override: true
|
|
|
|
- name: Build binary
|
|
run: cargo build --release --target x86_64-unknown-linux-musl
|
|
|
|
- name: Upload binary artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: env-guard-linux-amd64
|
|
path: target/x86_64-unknown-linux-musl/release/env-guard
|
|
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: binary
|
|
if: startsWith(gitea.ref, 'refs/tags/v')
|
|
steps:
|
|
- name: Create Release
|
|
uses: https://gitea.com/actions/release-action@main
|
|
with:
|
|
files: |
|
|
target/x86_64-unknown-linux-musl/release/env-guard
|
|
title: ${{ gitea.ref_name }}
|
|
body: "Release ${{ gitea.ref_name }} of env-guard"
|