Skip to content

Commit

Permalink
Add github workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jonlamb-gh committed Jun 9, 2024
1 parent 055a228 commit 317d349
Show file tree
Hide file tree
Showing 3 changed files with 161 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Security Audit

on: [push, pull_request]

jobs:
audit:
name: Audit
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
100 changes: 100 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: CI

on: [push, pull_request]

jobs:
lint:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [stable]
os: [ubuntu-latest]

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

- name: Cache target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.os }}-cargo--${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
toolchain: ${{ matrix.rust }}

- name: Clippy
run: cargo clippy --all-features -- -W clippy::all -D warnings

- name: Format
run: cargo fmt --all -- --check

- name: Doc Generation
run: cargo doc --bins --examples --all-features --no-deps

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [stable]
os: [ubuntu-latest]

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

- name: Cache target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.os }}-cargo--${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
toolchain: ${{ matrix.rust }}

- name: Build debug binary
run: cargo build

- name: Build release binary
run: cargo build --release

test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [stable]
os: [ubuntu-latest]

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

- name: Cache target
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ matrix.os }}-cargo--${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }}

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
toolchain: ${{ matrix.rust }}

- name: Test
run: cargo test --all-features
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Release

# Push events to matching v*, i.e. v1.0, v20.15.10
on:
push:
tags:
- 'v*'

jobs:
build:
name: Build Release Artifacts
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- name: Print version
run: |
RELEASE_TAG=${{ github.ref }}
RELEASE_TAG="${RELEASE_TAG#refs/tags/}"
RELEASE_VERSION="${RELEASE_TAG#v}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "Release tag: $RELEASE_TAG"
echo "Release version: $RELEASE_VERSION"
- name: Checkout sources
uses: actions/checkout@v4

- name: Install toolchain
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Fetch dependencies
run: cargo fetch

- name: Build release binaries
run: cargo build --release

- name: Create github release
id: create_release
uses: softprops/action-gh-release@v2
with:
draft: false
prerelease: false
name: Release ${{ env.RELEASE_VERSION }}
files: |
target/release/trace-recorder-to-ctf

0 comments on commit 317d349

Please sign in to comment.