Skip to content

Commit

Permalink
feat: add CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ceopaludetto committed Oct 6, 2024
1 parent f374b94 commit 8bce40c
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 9 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: CI
run-name: CI (${{ github.event.pull_request.title }})

on:
pull_request:
branches: [main]

env:
CI: true

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Rust
uses: actions-rust-lang/setup-rust-toolchain@v1

- name: Run Lint
run: cargo clippy --all-targets --all-features

- name: Run Build
run: cargo build

- name: Run Tests
run: cargo test
55 changes: 46 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,35 @@ jobs:
strategy:
matrix:
include:
- build: linux
# Linux x86_64
- build: linux (x86_64)
os: ubuntu-latest
target: x86_64-unknown-linux-gnu
binary: libxid.so

- build: macos
# Linux ARM64
- build: linux (aarch64)
os: ubuntu-latest
target: aarch64-unknown-linux-gnu
binary: libxid.so

# MacOS x86_64
- build: macos (x86_64)
os: macos-latest
target: x86_64-apple-darwin
binary: libxid.dylib

# MacOS ARM64
- build: macos (aarch64)
os: macos-latest
target: aarch64-apple-darwin
binary: libxid.dylib

- build: windows-gnu
# Windows x86_64
- build: windows-gnu (x86_64)
os: windows-latest
target: x86_64-pc-windows-gnu
binary: xid.dll

steps:
- name: Checkout Repository
Expand All @@ -44,14 +62,33 @@ jobs:
target: ${{ matrix.target }}

- name: Build
run: cargo build --verbose --release --target ${{ matrix.target }}
run: cargo build --release --target ${{ matrix.target }}

- name: Release
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: xid-${{ env.VERSION }}-${{ matrix.target }}
path: |
target/${{ matrix.target }}/release/libxid.so
target/${{ matrix.target }}/release/libxid.dll
target/${{ matrix.target }}/release/libxid.dylib
path: target/${{ matrix.target }}/release/${{ matrix.binary }}

release:
name: Release
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/tags/v*'

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: ./binaries

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: ./binaries/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8bce40c

Please sign in to comment.