diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..6005cc4 --- /dev/null +++ b/.github/workflows/audit.yml @@ -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/audit-check@v1.4.1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..b430de2 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..82b3142 --- /dev/null +++ b/.github/workflows/release.yml @@ -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