parent
3aba3aea1c
commit
470b934fb8
30 changed files with 528 additions and 1088 deletions
25
.github/workflows/code-quality.yml
vendored
25
.github/workflows/code-quality.yml
vendored
|
@ -1,25 +0,0 @@
|
|||
name: Code Quality
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
code-quality:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: nightly
|
||||
override: true
|
||||
components: clippy, rustfmt
|
||||
|
||||
- name: Check formatting
|
||||
run: cargo fmt -- --check
|
||||
|
||||
- name: Run Clippy
|
||||
run: cargo clippy -- -D warnings
|
||||
|
||||
- name: Compilation Check
|
||||
run: cargo check
|
39
.github/workflows/rust.yml
vendored
39
.github/workflows/rust.yml
vendored
|
@ -13,26 +13,35 @@ jobs:
|
|||
# Credit to https://github.com/Far-Beyond-Dev/Horizon/blob/main/.github/workflows/main.yml
|
||||
check-version:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
should_release: ${{ steps.check.outputs.should_release }}
|
||||
version: ${{ steps.check.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 2
|
||||
|
||||
- name: Check if Cargo.toml version changed
|
||||
id: check
|
||||
- name: Get binary name
|
||||
id: binary
|
||||
run: |
|
||||
CURRENT_VERSION=$(grep -m1 version Cargo.toml | cut -d '"' -f2)
|
||||
git checkout HEAD^1
|
||||
PREVIOUS_VERSION=$(grep -m1 version Cargo.toml | cut -d '"' -f2)
|
||||
if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
|
||||
echo "should_release=true" >> $GITHUB_OUTPUT
|
||||
echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "should_release=false" >> $GITHUB_OUTPUT
|
||||
BINARY_NAME=$(cargo metadata --format-version 1 | jq -r '.packages[0].targets[] | select(.kind[] | contains("bin")) | .name')
|
||||
echo "name=$BINARY_NAME" >> "$GITHUB_OUTPUT"
|
||||
- name: Check version change
|
||||
id: version
|
||||
run: |
|
||||
git fetch
|
||||
OLD_VERSION=$(git show HEAD^:Cargo.toml | grep -m 1 '^version = ' | cut -d '"' -f 2)
|
||||
NEW_VERSION=$(grep -m 1 '^version = ' Cargo.toml | cut -d '"' -f 2)
|
||||
if [ "$OLD_VERSION" != "$NEW_VERSION" ]; then
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Create Release
|
||||
if: steps.version.outputs.changed == 'true'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: v${{ steps.version.outputs.version }}
|
||||
name: Release v${{ steps.version.outputs.version }}
|
||||
files: target/release/${{ steps.binary.outputs.name }}
|
||||
generate_release_notes: true
|
||||
draft: false
|
||||
prerelease: false
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
@ -76,7 +85,7 @@ jobs:
|
|||
- name: 🔧 Install Rust
|
||||
uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
toolchain: nightly
|
||||
override: true
|
||||
target: ${{ matrix.target }}
|
||||
profile: minimal
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue