Skip to content

Setup Rust toolchain in build container #18

Setup Rust toolchain in build container

Setup Rust toolchain in build container #18

Workflow file for this run

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
#https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html
container: quay.io/pypa/manylinux2014_x86_64
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
args: -F gui
name: piton-gui-linux_x64
apt_deps: libgtk-3-dev
#https://kobzol.github.io/rust/ci/2021/05/07/building-rust-binaries-in-ci-that-work-with-older-glibc.html
container: quay.io/pypa/manylinux2014_x86_64
# 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 }}
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v3
- name: Setup Rust toolchain
if: ${{ matrix.container }}
run: |
sudo apt-get install -y rustup
rustup target add ${{ matrix.target }}
rustup update
- 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/*