update glfw to v3.4 (#376) #207
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 workflow builds the binaries, which are released when a "v*" tag is pushed. | |
# These also include builds for 32bit platforms, which are thus tested as a side-effect. | |
# This workflow only runs on a push to master and when pushing a version-tag. | |
# | |
# The Linux builds are performed on a "manylinux" container. This container | |
# is designed such that that the resulting binary has minimal dependencies on system | |
# libraries, and thus works on as many linuxes as possible. It's a thing from the | |
# Python world, but generally useful. | |
# | |
# Each target (os + architecture) is build in a seperate job. This is kinda verbose, | |
# resulting in some duplication, but at least its easy to read and maintain. | |
# Don't forget to add new jobs to the needs of the publish job. | |
# | |
# Each job should specify at least these env vars: | |
# * TARGET: used in makefile to do cargo build --target $TARGET | |
# * ARCHIVE_NAME: used by the makefile to package things up | |
# * WGPU_NATIVE_VERSION: is backed into the binary at compile time | |
# | |
# See https://doc.rust-lang.org/nightly/rustc/platform-support.html for Rust build targets. | |
name: CD | |
env: | |
CACHE_SUFFIX: a | |
on: | |
workflow_dispatch: | |
push: | |
tags: ["v*"] | |
branches: [trunk, cd] | |
jobs: | |
# ----- | |
linux-x86_64: | |
# Config | |
name: release - linux-x86_64 | |
runs-on: ubuntu-latest | |
env: | |
TARGET: x86_64-unknown-linux-gnu | |
ARCHIVE_NAME: wgpu-linux-x86_64 | |
TOOLCHAIN: stable-x86_64-unknown-linux-gnu | |
IMAGE: manylinux_2_28_x86_64 | |
steps: | |
# Common part (same for nearly each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
# Build | |
- name: Build | |
run: | | |
CID=$(docker create -t -w /tmp/wgpu-native -v $PWD:/tmp/src:ro -e TARGET -e ARCHIVE_NAME -e WGPU_NATIVE_VERSION quay.io/pypa/$IMAGE bash -c "\ | |
cp -r /tmp/src/. . && \ | |
rm -rf ./dist && \ | |
export PATH=/root/.cargo/bin:\$PATH && \ | |
export USER=root && \ | |
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \ | |
rustup toolchain install --no-self-update $TOOLCHAIN && \ | |
rustup default $TOOLCHAIN && \ | |
dnf install clang-devel zip -y && \ | |
make package") | |
docker start -ai $CID | |
mkdir -p dist | |
docker cp $CID:/tmp/wgpu-native/dist/. dist/. | |
docker rm $CID | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# ----- | |
linux-aarch64: | |
# Config | |
name: release - linux-aarch64 | |
runs-on: ubuntu-latest | |
env: | |
TARGET: aarch64-unknown-linux-gnu | |
ARCHIVE_NAME: wgpu-linux-aarch64 | |
TOOLCHAIN: stable-aarch64-unknown-linux-gnu | |
IMAGE: manylinux_2_28_aarch64 | |
steps: | |
# Common part (same for nearly each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
# prepare qemu for cross-compilation | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: arm64 | |
# Build | |
- name: Build | |
run: | | |
CID=$(docker create --platform linux/arm64 -t -w /tmp/wgpu-native -v $PWD:/tmp/src:ro -e TARGET -e ARCHIVE_NAME -e WGPU_NATIVE_VERSION quay.io/pypa/$IMAGE bash -c "\ | |
cp -r /tmp/src/. . && \ | |
rm -rf ./dist && \ | |
export PATH=/root/.cargo/bin:\$PATH && \ | |
export USER=root && \ | |
curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain none && \ | |
rustup toolchain install --no-self-update $TOOLCHAIN && \ | |
rustup default $TOOLCHAIN && \ | |
dnf install clang-devel zip -y && \ | |
make package") | |
docker start -ai $CID | |
mkdir -p dist | |
docker cp $CID:/tmp/wgpu-native/dist/. dist/. | |
docker rm $CID | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# ----- | |
windows-x86_64: | |
# Config | |
name: release - windows-x86_64 | |
runs-on: windows-latest | |
env: | |
TARGET: x86_64-pc-windows-msvc | |
ARCHIVE_NAME: wgpu-windows-x86_64 | |
steps: | |
# Common part (same for each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable-msvc | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
# Build | |
- name: Install llvm | |
run: | | |
set -x | |
choco install -y llvm | |
echo "LIBCLANG_PATH=C:\Program Files\LLVM\lib" >> $GITHUB_ENV | |
shell: bash | |
- name: Build | |
run: make package | |
shell: bash | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# ----- | |
windows-i686: | |
# Config | |
name: release - windows-i686 | |
runs-on: windows-latest | |
env: | |
TARGET: i686-pc-windows-msvc | |
ARCHIVE_NAME: wgpu-windows-i686 | |
steps: | |
# Common part (same for each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable-i686-pc-windows-msvc | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
# Build | |
- name: Install llvm | |
run: | | |
set -x | |
choco install -y --x86 --force llvm | |
echo "LIBCLANG_PATH=C:\Program Files (x86)\LLVM\lib" >> $GITHUB_ENV | |
shell: bash | |
- name: Build | |
run: make package | |
shell: bash | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# ----- | |
macos-x86_64: | |
# Config | |
name: release - macos-x86_64 | |
runs-on: macos-latest | |
env: | |
TARGET: x86_64-apple-darwin | |
ARCHIVE_NAME: wgpu-macos-x86_64 | |
MACOSX_DEPLOYMENT_TARGET: "10.13" | |
RUSTFLAGS: "-C link-args=-Wl,-install_name,@rpath/libwgpu_native.dylib" | |
steps: | |
# Common part (same for each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
# Build | |
- name: Build | |
run: make package | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# ----- | |
macos-aarch64: | |
# Config | |
name: release - macos-aarch64 | |
runs-on: macos-14 | |
env: | |
TARGET: aarch64-apple-darwin | |
ARCHIVE_NAME: wgpu-macos-aarch64 | |
MACOSX_DEPLOYMENT_TARGET: "11.0" | |
RUSTFLAGS: "-C link-args=-Wl,-install_name,@rpath/libwgpu_native.dylib" | |
steps: | |
# Common part (same for each build) | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Set WGPU_NATIVE_VERSION | |
run: echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ env.TARGET }} | |
- name: Setup caching | |
uses: Swatinem/rust-cache@v2 | |
with: | |
key: build-${{ env.TARGET }}-${{ env.CACHE_SUFFIX }} | |
# Build | |
- name: Build | |
run: make package | |
# Upload (same for each build) | |
- name: Upload | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist | |
name: dist | |
# Create a Github release and upload the binary libs that we just built. | |
# There should be a release and debug build for each platform (win32, win64, MacOS64, Linux64), | |
# plus a file containing the commit sha. | |
publish: | |
name: Publish Github release | |
needs: | |
- linux-x86_64 | |
- linux-aarch64 | |
- windows-x86_64 | |
- windows-i686 | |
- macos-x86_64 | |
- macos-aarch64 | |
runs-on: ubuntu-latest | |
if: success() && contains(github.ref, 'tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: set version (which gets used as release name) | |
run: | | |
echo "WGPU_NATIVE_VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV | |
shell: bash | |
- name: Download assets | |
uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: dist | |
- name: Create commit-sha file | |
env: | |
GITHUB_SHA: ${{ github.sha }} | |
run: | | |
echo $GITHUB_SHA > dist/commit-sha | |
- name: Upload Release Assets | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.WGPU_NATIVE_VERSION }} | |
name: ${{ env.WGPU_NATIVE_VERSION }} | |
files: | | |
dist/*.zip | |
dist/commit-sha | |
body: | | |
Autogenerated binary modules. | |
The Linux builds are built on AlmaLinux 8 [manylinux_2_28](https://github.com/pypa/manylinux#manylinux). | |
The MacOS builds target MacOS 10.13 High Sierra and up. | |
draft: false | |
prerelease: false |