Files
pongrs/.gitea/workflows/build.yml
T
nicknase27 f4b20300fa
CI/CD / clippy (push) Successful in 26s
CI/CD / test (push) Successful in 22s
CI/CD / Release (push) Successful in 1m20s
init
2026-09-26 21:08:22 +02:00

86 lines
2.1 KiB
YAML

name: CI/CD
on:
push:
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
jobs:
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Run clippy action
uses: clechasseur/rs-clippy-check@v3
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Generate lockfile if missing
if: hashFiles('Cargo.lock') == ''
run: cargo generate-lockfile
- name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2
- name: Run tests
run: cargo test --locked --all-features --all-targets
release:
name: Release
needs: [clippy, test]
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: |
x86_64-unknown-linux-gnu
x86_64-pc-windows-gnu
- uses: Swatinem/rust-cache@v2
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
pkg-config \
libasound2-dev \
gcc-mingw-w64-x86-64
- name: Build Linux
run: cargo build --release --target x86_64-unknown-linux-gnu
- name: Build Windows
env:
CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER: x86_64-w64-mingw32-gcc
run: cargo build --release --target x86_64-pc-windows-gnu
- name: Collect artifacts
run: |
mkdir artifacts
cp target/x86_64-unknown-linux-gnu/release/pongrs artifacts/pongrs
cp target/x86_64-pc-windows-gnu/release/pongrs.exe artifacts/pongrs.exe
- name: Create Release
uses: akkuman/gitea-release-action@v1
with:
files: |
artifacts/pongrs
artifacts/pongrs.exe