Skip to content

Commit

Permalink
[chore] github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
floatshadow committed May 9, 2024
1 parent 8d96966 commit 1f9a6d0
Show file tree
Hide file tree
Showing 3 changed files with 716 additions and 16 deletions.
45 changes: 30 additions & 15 deletions .github/workflows/accipit-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,53 @@ name: Accipit Build and Release

on:
workflow_dispatch:
release:
types: [ created ]
push:
branches:
- 'release/**'
path:
- 'src/**'
- 'Cargo.toml'
- '.github/workflows/accipit-build.yml'
pull_request:
branches:
- 'release/**'
paths:
- 'src/**'
- 'Cargo.toml'
- '.github/workflows/accipit-build.yml'

jobs:
build:
name: ${{ matrix.platform.os_name }} with rust ${{ matrix.toolchain }}
runs-on: ${{ matrix.platform.os }}
name: Build ${{ matrix.platform.target }}
strategy:
fail-fast: false
matrix:
platform:
- os: linux-aarch64-musl
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
asset: accipit-linux-aarch64-musl
- os: linux-x86_64-musl
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
asset: accipit-linux-x86_64-musl
- os: linux-x86_64-gnu
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
asset: accipit-linux-x86_64-gnu
- os: windows-x86_64-msvc
- os: windows-latest
target: x86_64-pc-windows-msvc
asset: accipit-windows-x86_64-msvc.exe
- os: windows-x86_64-gnu
- os: windows-latest
target: x86_64-pc-windows-gnu
asset: accipit-windows-x86_64-gnu.exe
- os: darwin-x86_64
- os: macOS-latest
target: x86_64-apple-darwin
asset: accipit-darwin-x86_64
- os: darwin-aarch64
- os: macOS-latest
target: aarch64-apple-darwin
asset: accipit-darwin-aarch64
toolchain:
- stable

runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v4
- name: Build binary
Expand All @@ -48,15 +61,17 @@ jobs:
strip: true
- name: Rename binary (linux and macos)
run: mv target/${{ matrix.platform.target }}/release/accipit target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}
if: ${{ startWith(matrix.platform.os, 'linux') || startWith(matrix.platform.os, 'darwin') }}
if: ${{ startsWith(matrix.platform.os, 'ubuntu') || startsWith(matrix.platform.os, 'macOS') }}
- name: Rename binary (windows)
run: mv target/${{ matrix.platform.target }}/release/accipit.exe target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}
if: ${{ startWith(matrix.platform.os, 'windows') }}
if: ${{ startsWith(matrix.platform.os, 'windows') }}
- name: Generate SHA-256
run: shasum -a 256 target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }} | cut -d ' ' -f 1 > target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}.sha256
- name: Release binary and SHA-256 checksum to GitHub
uses: softprops/action-gh-release@v1
uses: actions/upload-artifact@v4
with:
files: |
if-no-files-found: error
name: ${{ matrix.platform.asset }}
path: |
target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}
target/${{ matrix.platform.target }}/release/${{ matrix.platform.asset }}.sha256
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock
# Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk
Expand Down
Loading

0 comments on commit 1f9a6d0

Please sign in to comment.