-
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GitHub Actions compilation guide for building on Ubuntu, macOS, a…
…nd Windows (#19) * Add GitHub Actions compilation guide for building on Ubuntu, macOS, and Windows --------- Co-authored-by: 0x676e67 <[email protected]> Co-authored-by: mather <[email protected]>
- Loading branch information
1 parent
843afaa
commit 25a61d6
Showing
2 changed files
with
68 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
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,65 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install dependencies on Ubuntu | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install build-essential cmake perl pkg-config libclang-dev musl-tools nasm -y | ||
- name: Install dependencies on macOS | ||
if: runner.os == 'macOS' | ||
run: | | ||
brew update | ||
brew install --formula cmake pkg-config llvm nasm | ||
- name: Install dependencies on Windows | ||
if: runner.os == 'Windows' | ||
run: | | ||
choco install cmake -y | ||
choco install strawberryperl -y | ||
choco install pkgconfiglite -y | ||
choco install llvm -y | ||
choco install nasm -y | ||
shell: cmd | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Archive build artifacts on Linux/macOS | ||
if: runner.os == 'Linux' || runner.os == 'macOS' | ||
run: | | ||
cd target/release | ||
zip -r ../../build-${{ runner.os }}.zip * | ||
working-directory: ${{ github.workspace }} | ||
|
||
- name: Archive build artifacts on Windows | ||
if: runner.os == 'Windows' | ||
shell: pwsh | ||
run: | | ||
Compress-Archive -Path 'target\release\*' -DestinationPath "build-${{ runner.os }}.zip" -CompressionLevel Optimal -Force | ||
working-directory: ${{ github.workspace }} | ||
|
||
- name: Upload build artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-${{ matrix.os }} | ||
path: build-${{ runner.os }}.zip |