Install gtk3 dependency when building Linux binary #9
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
name: Build Piton binaries | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
# Windows i686 | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
args: | |
name: piton-win_x86.exe | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
args: -F gui | |
name: piton-gui-win_x86.exe | |
# Windows x64 | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
args: | |
name: piton-win_x64.exe | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
args: -F gui | |
name: piton-gui-win_x64.exe | |
# Linux | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
args: | |
name: piton-linux_x64 | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
args: -F gui | |
name: piton-gui-linux_x64 | |
apt_deps: libgtk-3-dev | |
# MacOS | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
args: | |
name: piton-macos_x64 | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
args: -F gui | |
name: piton-gui-macos_x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
if: ${{ matrix.apt_deps }} | |
run: sudo apt-get install -y ${{ matrix.apt_deps }} | |
- name: Build Piton binary | |
run: cargo build --verbose --release --target ${{ matrix.target }} ${{ matrix.args }} | |
- run: mv target/${{ matrix.target }}/release/${{ startsWith(matrix.os, 'windows') && 'piton.exe' || 'piton' }} ${{ matrix.name }} | |
- name: Upload Piton binaries | |
uses: actions/upload-artifact@v3.1.3 | |
with: | |
name: piton-binaries | |
path: ${{ matrix.name }} | |
upload-binaries: | |
if: github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- uses: actions/download-artifact@v2.1.1 | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: piton-binaries/* |