Skip to content

Commit

Permalink
Add GitHub Actions compilation guide for building on Ubuntu, macOS, a…
Browse files Browse the repository at this point in the history
…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
3 people authored Oct 8, 2024
1 parent 843afaa commit 25a61d6
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,12 @@ Do not compile with crates that depend on OpenSSL; their prefixing symbols are t

```shell
sudo apt-get install build-essential cmake perl pkg-config libclang-dev musl-tools -y

cargo build --release
```

You can also use [this GitHub Actions](https://github.com/penumbra-x/rquest/blob/main/compilation-guide/build.yml) to compile your project.

## Contributing

If you would like to submit your contribution, please open a [Pull Request](https://github.com/penumbra-x/rquest/pulls).
Expand Down
65 changes: 65 additions & 0 deletions compilation-guide/build.yml
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

0 comments on commit 25a61d6

Please sign in to comment.