Skip to content

build

build #248

Workflow file for this run

name: Build
on: [workflow_call, workflow_dispatch]
jobs:
build-winmac:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-2022
arch: x64
- target: i686-pc-windows-msvc
os: windows-2022
arch: x86
- target: x86_64-apple-darwin
os: macos-12
arch: x64
- target: aarch64-apple-darwin
os: macos-12
arch: x64
runs-on: ${{ matrix.os }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install Nightly Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
architecture: ${{ matrix.arch }}
- name: Install Python packages
run: pip install -r requirements.txt
- name: Build wheels
run: make TARGET=${{ matrix.target }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: pyxel-wheels
path: dist/*
build-linux:
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
image: messense/manylinux2014-cross:x86_64
- target: i686-unknown-linux-gnu
image: messense/manylinux2014-cross:i686
- target: aarch64-unknown-linux-gnu
image: messense/manylinux2014-cross:aarch64
- target: armv7-unknown-linux-gnueabihf
image: messense/manylinux2014-cross:armv7l
runs-on: ubuntu-22.04
container: ${{ matrix.image }}
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install Nightly Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: rustfmt
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Python packages
run: pip install -r requirements.txt
- name: Install OpenSSL for x86_64
if: matrix.target == 'x86_64-unknown-linux-gnu'
run: |
sudo apt-get update
sudo apt-get install -y libssl-dev
OPENSSL_LIB_DIR=$(dpkg -L libssl-dev | grep -m 1 '/lib' | xargs dirname)
OPENSSL_INCLUDE_DIR=$(dpkg -L libssl-dev | grep -m 1 '/include' | xargs dirname)
echo "OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR" >> $GITHUB_ENV
- name: Install OpenSSL for i686
if: matrix.target == 'i686-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y libssl-dev:i386
OPENSSL_LIB_DIR=$(dpkg -L libssl-dev:i386 | grep -m 1 '/lib' | xargs dirname)
OPENSSL_INCLUDE_DIR=$(dpkg -L libssl-dev:i386 | grep -m 1 '/include' | xargs dirname)
echo "I686_UNKNOWN_LINUX_GNU_OPENSSL_OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR" >> $GITHUB_ENV
echo "I686_UNKNOWN_LINUX_GNU_OPENSSL_OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR" >> $GITHUB_ENV
- name: Install OpenSSL for aarch64
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo dpkg --add-architecture arm64
sudo apt-get update
sudo apt-get install -y libssl-dev:arm64
OPENSSL_LIB_DIR=$(dpkg -L libssl-dev:arm64 | grep -m 1 '/lib' | xargs dirname)
OPENSSL_INCLUDE_DIR=$(dpkg -L libssl-dev:arm64 | grep -m 1 '/include' | xargs dirname)
echo "AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR" >> $GITHUB_ENV
echo "AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR" >> $GITHUB_ENV
- name: Install OpenSSL for armv7
if: matrix.target == 'armv7-unknown-linux-gnueabihf'
run: |
sudo dpkg --add-architecture armhf
sudo apt-get update
sudo apt-get install -y libssl-dev:armhf
OPENSSL_LIB_DIR=$(dpkg -L libssl-dev:armhf | grep -m 1 '/lib' | xargs dirname)
OPENSSL_INCLUDE_DIR=$(dpkg -L libssl-dev:armhf | grep -m 1 '/include' | xargs dirname)
echo "ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_LIB_DIR=$OPENSSL_LIB_DIR" >> $GITHUB_ENV
echo "ARMV7_UNKNOWN_LINUX_GNUEABIHF_OPENSSL_INCLUDE_DIR=$OPENSSL_INCLUDE_DIR" >> $GITHUB_ENV
- name: Build and install SDL2
run: |
export SDL2_VERSION=2.24.2
export CC=$TARGET_CC
export AR=$TARGET_AR
export RANLIB=$TARGET_RANLIB
curl -sqLO https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VERSION}/SDL2-${SDL2_VERSION}.tar.gz
tar xzf SDL2-${SDL2_VERSION}.tar.gz
cd SDL2-${SDL2_VERSION}
CFLAGS="-O3 -fPIC" ./configure \
--build=x86_64-unknown-linux-gnu \
--host=${{ matrix.target }} \
--prefix=$(pwd)/SDL2-build
make -j4
make install
cd ..
rm -rf SDL2-${SDL2_VERSION}
- name: Build wheels
run: |
export RUSTFLAGS="-L/usr/${{ matrix.target }}/lib"
make TARGET=${{ matrix.target }}
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: pyxel-wheels
path: dist/*