Compare commits
1 commit
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1b73889fd9 |
1 changed files with 62 additions and 66 deletions
128
.github/workflows/rust.yml
vendored
128
.github/workflows/rust.yml
vendored
|
@ -2,99 +2,95 @@ name: Rust -> Build & Test & Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ "main" ]
|
branches: ["main"]
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
|
PROJECT_NAME: ${{ github.event.repository.name }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_linux:
|
build_linux:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --verbose
|
run: cargo build --release --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
|
||||||
- name: Upload Linux Binary
|
- name: Upload Linux Binary
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: banker_algorithm_linux_x64_86
|
name: ${{ env.PROJECT_NAME }}-linux-x64_86
|
||||||
path: target/release/banker-algorithm
|
path: target/release/${{ env.PROJECT_NAME }}
|
||||||
|
|
||||||
build_windows:
|
build_windows:
|
||||||
|
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --verbose
|
run: cargo build --release --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
|
||||||
- name: Upload Windows Binary
|
- name: Upload Windows Binary
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: banker_algorithm_windows_x64_86
|
name: ${{ env.PROJECT_NAME }}-windows-x64_86
|
||||||
path: target/release/banker-algorithm.exe
|
path: target/release/${{ env.PROJECT_NAME }}.exe
|
||||||
|
|
||||||
build_macos:
|
build_macos:
|
||||||
|
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build
|
- name: Build
|
||||||
run: cargo build --release --verbose
|
run: cargo build --release --verbose
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
|
|
||||||
- name: Upload MacOS Binary
|
- name: Upload MacOS Binary
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: banker_algorithm_macos_x64_86
|
name: ${{ env.PROJECT_NAME }}-macos-arm64
|
||||||
path: target/release/banker-algorithm
|
path: target/release/${{ env.PROJECT_NAME }}
|
||||||
|
|
||||||
release:
|
release:
|
||||||
needs: [build_linux, build_windows, build_macos]
|
needs: [build_linux, build_windows, build_macos]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Forge a Folder
|
||||||
|
run: mkdir Downloads
|
||||||
|
working-directory: /home/runner/work/${{ env.PROJECT_NAME }}/${{ env.PROJECT_NAME }}/
|
||||||
|
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/download-artifact@v4
|
||||||
- name: Forge a Folder
|
name: Download
|
||||||
run: mkdir Downloads
|
with:
|
||||||
working-directory: /home/runner/work/banker-algorithm/banker-algorithm/
|
path: Downloads/
|
||||||
|
|
||||||
- uses: actions/download-artifact@v4
|
- name: Rename Binaries
|
||||||
name: Download
|
run: |
|
||||||
with:
|
tree Downloads/
|
||||||
path: Downloads/
|
mv Downloads/${{ env.PROJECT_NAME }}-linux-x64_86/${{ env.PROJECT_NAME }} Downloads/${{ env.PROJECT_NAME }}-linux-x64_86/${{ env.PROJECT_NAME }}-linux-x64_86
|
||||||
|
mv Downloads/${{ env.PROJECT_NAME }}-windows-x64_86/${{ env.PROJECT_NAME }}.exe Downloads/${{ env.PROJECT_NAME }}-windows-x64_86/${{ env.PROJECT_NAME }}-windows-x64_86.exe
|
||||||
- name: Rename Binaries
|
mv Downloads/${{ env.PROJECT_NAME }}-macos-arm64/${{ env.PROJECT_NAME }} Downloads/${{ env.PROJECT_NAME }}-macos-arm64/${{ env.PROJECT_NAME }}-macos-arm64
|
||||||
run: |
|
- name: Git Commit SHA
|
||||||
mv Downloads/banker_algorithm_linux_x64_86/banker-algorithm Downloads/banker_algorithm_linux_x64_86/banker-algorithm-linux_x64_86
|
id: vars
|
||||||
mv Downloads/banker_algorithm_windows_x64_86/banker-algorithm.exe Downloads/banker_algorithm_windows_x64_86/banker-algorithm-windows_x64_86.exe
|
run: |
|
||||||
mv Downloads/banker_algorithm_macos_x64_86/banker-algorithm Downloads/banker_algorithm_macos_x64_86/banker-algorithm-macos_x64_86
|
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
||||||
|
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Git Commit SHA
|
- uses: softprops/action-gh-release@v2
|
||||||
id: vars
|
name: Release
|
||||||
run: |
|
with:
|
||||||
calculatedSha=$(git rev-parse --short ${{ github.sha }})
|
tag_name: ${{ steps.vars.outputs.short_sha }}
|
||||||
echo "short_sha=$calculatedSha" >> $GITHUB_OUTPUT
|
generate_release_notes: true
|
||||||
|
files: |
|
||||||
- uses: softprops/action-gh-release@v2
|
Downloads/*linux*/${{ env.PROJECT_NAME }}*
|
||||||
name: Release
|
Downloads/*windows*/${{ env.PROJECT_NAME }}*
|
||||||
with:
|
Downloads/*macos*/${{ env.PROJECT_NAME }}*
|
||||||
tag_name: ${{ steps.vars.outputs.short_sha }}
|
|
||||||
generate_release_notes: true
|
|
||||||
files: |
|
|
||||||
Downloads/*linux*/*banker*
|
|
||||||
Downloads/*windows*/*banker*
|
|
||||||
Downloads/*macos*/*banker*
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue