mirror of
https://github.com/sreedevk/deduplicator.git
synced 2026-08-31 04:25:31 +00:00
97 lines
2.5 KiB
YAML
97 lines
2.5 KiB
YAML
name: Deduplicator Build & Release CI Pipeline
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*.*.*'
|
|
|
|
jobs:
|
|
lint_test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
with:
|
|
components: clippy
|
|
|
|
- name: Run cargo check
|
|
run: cargo check
|
|
|
|
- name: Run cargo clippy
|
|
run: cargo clippy -- -D warnings
|
|
|
|
- name: Run tests
|
|
run: cargo test -- --test-threads=1
|
|
|
|
build:
|
|
needs: lint_test
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- target: aarch64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
artifact_name: linux-aarch64
|
|
- target: x86_64-unknown-linux-gnu
|
|
os: ubuntu-latest
|
|
artifact_name: linux-amd64
|
|
- target: x86_64-apple-darwin
|
|
os: macos-14
|
|
artifact_name: macos-amd64
|
|
- target: aarch64-apple-darwin
|
|
os: macos-14
|
|
artifact_name: macos-arm64
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install Rust
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Add target
|
|
run: rustup target add ${{ matrix.target }}
|
|
|
|
- name: Build release binary
|
|
run: cargo build --release --target ${{ matrix.target }}
|
|
|
|
- name: Package binary
|
|
run: |
|
|
BINARY_NAME=$(basename $(find target/${{ matrix.target }}/release -maxdepth 1 -type f -executable | head -1))
|
|
mkdir -p release
|
|
cp target/${{ matrix.target }}/release/$BINARY_NAME release/$BINARY_NAME
|
|
tar -C release -czf ${{ matrix.artifact_name }}.tar.gz $BINARY_NAME
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ${{ matrix.artifact_name }}-binary
|
|
path: ${{ matrix.artifact_name }}.tar.gz
|
|
|
|
create_release:
|
|
needs: build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download all artifacts
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
path: artifacts
|
|
|
|
- name: Create GitHub Release
|
|
id: create_release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
tag_name: ${{ github.ref_name }}
|
|
name: Release ${{ github.ref_name }}
|
|
body: "Automated release for version ${{ github.ref_name }}"
|
|
files: |
|
|
artifacts/*/*.tar.gz
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|