-
Notifications
You must be signed in to change notification settings - Fork 1
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
3 changed files
with
178 additions
and
0 deletions.
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,18 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: cargo | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
target-branch: "main" | ||
commit-message: | ||
prefix: "deps(cargo)" | ||
|
||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
target-branch: "main" | ||
commit-message: | ||
prefix: "deps(ci)" |
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,75 @@ | ||
name: release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
|
||
jobs: | ||
release_build: | ||
name: Build ${{ matrix.platform.os_name }} | ||
runs-on: ${{ matrix.platform.os }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- os_name: Windows-x86_64 | ||
os: windows-latest | ||
target: x86_64-pc-windows-gnu | ||
archiver: zip | ||
archive_type: zip | ||
bin: spritter.exe | ||
- os_name: Linux-x86_64 | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
archiver: tar | ||
archive_type: tar.gz | ||
bin: spritter | ||
- os_name: MacOS-x86_64 | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
archiver: tar | ||
archive_type: tar.gz | ||
bin: spritter | ||
- os_name: MacOS-aarch64 | ||
os: macos-latest | ||
target: aarch64-apple-darwin | ||
archiver: tar | ||
archive_type: tar.gz | ||
bin: spritter | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Stable rust toolchain | ||
run: rustup toolchain install stable --target ${{ matrix.platform.target }} --profile minimal | ||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: "rust-stable" | ||
shared-key: "release_build-${{ matrix.platform.target }}" | ||
- name: Build | ||
run: cargo build --target ${{ matrix.platform.target }} --release --package spritter | ||
- name: Archive the built binary | ||
uses: TheDoctor0/zip-release@0.7.6 | ||
with: | ||
type: ${{ matrix.platform.archiver }} | ||
filename: spritter_${{ matrix.platform.target }}.${{ matrix.platform.archive_type }} | ||
directory: ./target/${{ matrix.platform.target }}/release | ||
path: ${{ matrix.platform.bin }} | ||
- name: Upload release artifact for release job | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
path: ./target/${{ matrix.platform.target }}/release/spritter_${{ matrix.platform.target }}.${{ matrix.platform.archive_type }} | ||
create_release: | ||
name: Create release | ||
needs: release_build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download release artifacts from build job | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ~/build_artifacts | ||
- name: Create release | ||
id: create_release | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
artifacts: ~/build_artifacts/artifact/* |
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,85 @@ | ||
name: rust | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
- ready_for_review | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
fmt: | ||
name: Check formatting | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Stable rust toolchain | ||
run: rustup toolchain install stable --profile minimal | ||
- name: Check formatting | ||
run: cargo fmt --all -- --check | ||
|
||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Stable rust toolchain | ||
run: rustup toolchain install stable --profile minimal | ||
- name: Add Clippy | ||
run: rustup component add clippy | ||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: "rust-stable" | ||
shared-key: "clippy" | ||
- name: Install cargo-binstall | ||
run: wget https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-x86_64-unknown-linux-gnu.tgz -O - | tar -xz -C $HOME/.cargo/bin | ||
- name: Install sarif-fmt & clippy-sarif | ||
run: cargo binstall --no-confirm --force sarif-fmt clippy-sarif | ||
- name: Run Clippy | ||
run: cargo clippy --message-format=json | clippy-sarif | tee results.sarif | sarif-fmt | ||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: results.sarif | ||
|
||
build: | ||
name: Build ${{ matrix.platform.os_name }} [rust ${{ matrix.toolchain }}] | ||
runs-on: ${{ matrix.platform.os }} | ||
if: ${{ github.event_name == 'push' || !github.event.pull_request.draft }} | ||
strategy: | ||
matrix: | ||
platform: | ||
- os_name: Windows-x86_64 | ||
os: windows-latest | ||
target: x86_64-pc-windows-gnu | ||
- os_name: Linux-x86_64 | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-gnu | ||
- os_name: MacOS-x86_64 | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
- os_name: MacOS-aarch64 | ||
os: macos-latest | ||
target: aarch64-apple-darwin | ||
toolchain: | ||
- stable | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Setup ${{ matrix.toolchain }} toolchain | ||
run: rustup toolchain install ${{ matrix.toolchain }} --target ${{ matrix.platform.target }} --profile minimal | ||
- name: Rust cache | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
prefix-key: "rust-${{ matrix.toolchain }}" | ||
shared-key: "build-${{ matrix.platform.target }}" | ||
- name: Build | ||
run: cargo build --target ${{ matrix.platform.target }} |