-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
261 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Continuous integration | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
continuous-integration: | ||
name: Building project and running tests | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Cache Rust toolchain and build artifacts | ||
uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Check crates/msr-core | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path crates/msr-core/Cargo.toml | ||
|
||
- name: Check crates/msr-plugin | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path crates/msr-plugin/Cargo.toml | ||
|
||
- name: Check crates/msr-legacy | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path crates/msr-legacy/Cargo.toml | ||
|
||
- name: Check plugins/csv-event-journal-msr-plugin | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path plugins/csv-event-journal-msr-plugin/Cargo.toml | ||
|
||
- name: Check plugins/csv-register-recorder-msr-plugin | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --manifest-path plugins/csv-register-recorder-msr-plugin/Cargo.toml | ||
|
||
- name: Build tests with all features enabled | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --workspace --all-features --no-run | ||
|
||
- name: Run tests with all features enabled | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --workspace --all-features --locked -- --nocapture --quiet | ||
|
||
- name: Build release with default features | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --locked |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- '*' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
pre-commit: | ||
name: Detecting code style issues | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
components: rustfmt, clippy | ||
|
||
- name: Cache Rust toolchain and build artifacts | ||
uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
|
||
- name: Detect code style issues (push) | ||
uses: pre-commit/[email protected] | ||
if: github.event_name == 'push' | ||
|
||
- name: Detect code style issues (pull_request) | ||
uses: pre-commit/[email protected] | ||
if: github.event_name == 'pull_request' | ||
env: | ||
SKIP: no-commit-to-branch | ||
|
||
- name: Generate patch file | ||
if: failure() | ||
run: | | ||
git diff-index -p HEAD > "${PATCH_FILE}" | ||
[ -s "${PATCH_FILE}" ] && echo "UPLOAD_PATCH_FILE=${PATCH_FILE}" >> "${GITHUB_ENV}" | ||
env: | ||
PATCH_FILE: pre-commit.patch | ||
|
||
- name: Upload patch artifact | ||
if: failure() && env.UPLOAD_PATCH_FILE != null | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: ${{ env.UPLOAD_PATCH_FILE }} | ||
path: ${{ env.UPLOAD_PATCH_FILE }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
name: pre-release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v[0-9]+*' | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-and-upload-artifacts: | ||
name: Building and uploading artifacts | ||
runs-on: ${{ matrix.runner_os }} | ||
strategy: | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-musl | ||
- x86_64-apple-darwin | ||
- x86_64-pc-windows-msvc | ||
include: | ||
- target: x86_64-unknown-linux-musl | ||
runner_os: ubuntu-latest | ||
artifact_suffix: .tar.xz | ||
- target: x86_64-apple-darwin | ||
runner_os: macos-latest | ||
artifact_suffix: .tar.xz | ||
- target: x86_64-pc-windows-msvc | ||
runner_os: windows-latest | ||
artifact_suffix: .7z | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install musl-tools on Linux | ||
if: matrix.target == 'x86_64-unknown-linux-musl' | ||
run: | | ||
sudo apt -y install musl-tools | ||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
target: ${{ matrix.target }} | ||
toolchain: stable | ||
profile: minimal | ||
|
||
- name: Cache Rust toolchain and build artifacts | ||
uses: Swatinem/rust-cache@v1 | ||
|
||
- name: Build artifact | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --locked --target ${{ matrix.target }} | ||
|
||
- name: Prepare artifact on Linux/macOS | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
strip aoide | ||
tar cJvf ../../../aoide-${{ matrix.target }}${{ matrix.artifact_suffix }} aoide | ||
cd - | ||
- name: Prepare artifact on Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
cd target/${{ matrix.target }}/release | ||
strip aoide.exe | ||
7z a ../../../aoide-${{ matrix.target }}${{ matrix.artifact_suffix }} aoide.exe | ||
cd - | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: aoide-${{ matrix.target }}${{ matrix.artifact_suffix }} | ||
path: aoide-${{ matrix.target }}${{ matrix.artifact_suffix }} | ||
|
||
create-release-draft: | ||
name: Creating release draft | ||
needs: build-and-upload-artifacts | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v2 | ||
|
||
- name: Generate artifact checksums | ||
run: for file in aoide-*/aoide-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done | ||
|
||
- name: Extract release notes from changelog | ||
run: cat CHANGELOG.md | tail -n +7 | head -n 25 > RELEASE_NOTES.md | ||
|
||
- name: Create release draft | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: aoide-*/aoide-* | ||
body_path: RELEASE_NOTES.md | ||
draft: true | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Security audit | ||
|
||
on: | ||
push: | ||
paths: | ||
- '**/Cargo.toml' | ||
- '**/Cargo.lock' | ||
#schedule: | ||
# - cron: '0 0 * * *' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
security-audit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/audit-check@v1 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters