Skip to content

Commit

Permalink
Refresh the build.
Browse files Browse the repository at this point in the history
- Building for ARM64 on macOS, upgrading to version 12, which means it
  can't build for x86 anymore FFS
- Using a docker image for Ubuntu 18.04
- Cancelling in-progress builds
- Various other insane updates because of the software development race
  to the bottom, FFS
  • Loading branch information
mosra committed Jun 30, 2024
1 parent 48ca0bf commit 90142f7
Showing 1 changed file with 107 additions and 43 deletions.
150 changes: 107 additions & 43 deletions .github/workflows/build.yml → .github/workflows/swiftshader.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ name: SwiftShader

on: [push, pull_request]

# Cancel in-progress builds on push to same branch / PR
# https://stackoverflow.com/a/72408109
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
# Ideally use a commit that's verified to work well elsewhere (Arch
# swiftshader-git package, for example)
Expand All @@ -12,20 +18,39 @@ env:
jobs:
ubuntu-gles:
name: GLES, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
strategy:
matrix:
# On 16.04 it uses GCC 5, not GCC 4.8, because it can't build on that
# one. That's fine however, there are no issues when linking Magnum
# built with GCC 4.8 against SwiftShader built with GCC 5.
#
# As of 2021-09-20, 16.04 is no more on GitHub Actions.
os: [ubuntu-18.04]
include:
- os: ubuntu-18.04
runs-on: ubuntu-latest
container: ubuntu:bionic-20220427
steps:
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Install base build tools
# apt update is needed to fetch package lists; software-properties-common
# is the add-apt-repository command (why that isn't included by
# default?!)
run: |
apt update
apt install -y ninja-build wget g++ software-properties-common
- name: Install a newer Git version from a PPA
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04
# ships only with 2.17. Ultimately that means the "clones" are not
# actually clones, so I can't do git submodule update.
run: |
add-apt-repository ppa:git-core/ppa
apt update
apt install -y git
- name: Install CMake 3.13
run: |
mkdir -p $HOME/cmake && cd $HOME/cmake
wget --no-check-certificate https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz
tar --strip-components=1 -xzf cmake-3.13.5-Linux-x86_64.tar.gz
echo $HOME/cmake/bin >> $GITHUB_PATH
- name: Clone SwiftShader
uses: actions/checkout@v2
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04
uses: actions/checkout@v3.6.0
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand All @@ -42,17 +67,18 @@ jobs:
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Build & install Debug
run: |
cmake \
-G Ninja \
mkdir build-debug && cd build-debug
cmake ../swiftshader \
-DCMAKE_BUILD_TYPE=Debug \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=OFF \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-S swiftshader -B build-debug
ninja -C build-debug
-G Ninja
ninja
cd ..
install -dm755 install-debug/lib
install -dm755 install-debug/include
install -dm755 install-debug/include/EGL
Expand All @@ -68,17 +94,18 @@ jobs:
swiftshader/include/KHR/khrplatform.h
- name: Build & install Release
run: |
cmake \
-G Ninja \
mkdir build && cd build
cmake ../swiftshader \
-DCMAKE_BUILD_TYPE=Release \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=OFF \
-DSWIFTSHADER_BUILD_PVR=OFF \
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-S swiftshader -B build
ninja -C build
-G Ninja
ninja
cd ..
install -dm755 install/lib
install -dm755 install/include
install -dm755 install/include/EGL
Expand All @@ -93,28 +120,51 @@ jobs:
install -m644 -t install/include/KHR \
swiftshader/include/KHR/khrplatform.h
- name: Upload Debug artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}-debug
path: install-debug
- name: Upload Release artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install

ubuntu-vulkan:
name: Vulkan, ${{ matrix.os }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
strategy:
matrix:
# Vulkan libs don't build with GCC 5 on 16.04, use just 18.04
os: [ubuntu-18.04]
include:
- os: ubuntu-18.04
runs-on: ubuntu-latest
container: ubuntu:bionic-20220427
steps:
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Install base build tools
# apt update is needed to fetch package lists; software-properties-common
# is the add-apt-repository command (why that isn't included by
# default?!)
run: |
apt update
apt install -y ninja-build wget g++ software-properties-common
- name: Install a newer Git version from a PPA
# The actions/checkout FOR SOME REASON requires Git 2.18+, while 18.04
# ships only with 2.17. Ultimately that means the "clones" are not
# actually clones, so I can't so git submodule update.
run: |
add-apt-repository ppa:git-core/ppa
apt update
apt install -y git
- name: Install CMake 3.13
run: |
mkdir -p $HOME/cmake && cd $HOME/cmake
wget --no-check-certificate https://cmake.org/files/v3.13/cmake-3.13.5-Linux-x86_64.tar.gz
tar --strip-components=1 -xzf cmake-3.13.5-Linux-x86_64.tar.gz
echo $HOME/cmake/bin >> $GITHUB_PATH
- name: Clone SwiftShader
uses: actions/checkout@v2
# checkout v4 uses Node 20 which doesn't work on Ubuntu 18.04
uses: actions/checkout@v3.6.0
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand All @@ -131,8 +181,8 @@ jobs:
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Configure
run: |
cmake \
-G Ninja \
mkdir build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=OFF \
Expand All @@ -141,10 +191,11 @@ jobs:
-DSWIFTSHADER_BUILD_TESTS=OFF \
-DSWIFTSHADER_WARNINGS_AS_ERRORS=OFF \
-DSPIRV_WERROR=OFF \
-S swiftshader -B build
-G Ninja
- name: Build
run: |
ninja -C build
cd build
ninja
- name: Install
run: |
install -dm755 install/lib
Expand All @@ -157,22 +208,25 @@ jobs:
sed 's#./libvk_swiftshader.so#../../../lib/libvk_swiftshader.so#' \
-i install/share/vulkan/icd.d/vk_swiftshader_icd.json
- name: Upload artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install

mac:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
os: [macos-10.15]
include:
- os: macos12-arm64
runs-on: macos-12
steps:
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
- name: Install base build tools
run: |
brew install ninja
- name: Clone SwiftShader
uses: actions/checkout@v2
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand All @@ -187,11 +241,21 @@ jobs:
SWIFTSHADER_VERSION="r$(git -C swiftshader rev-list --count HEAD).$(git -C swiftshader rev-parse --short=10 HEAD)"
echo "version: $SWIFTSHADER_VERSION"
echo "SWIFTSHADER_VERSION=$SWIFTSHADER_VERSION" >> $GITHUB_ENV
- name: Patch CMakeLists to not force x86_64
# Even with CMAKE_OSX_ARCHITECTURES="arm64" I get
# clang: error: the clang compiler does not support '-march=x86-64'
# No idea what's off, whether it's CMake being broken on this image or
# the old version doing something silly, so just replacing everything to
# build just an ARM variant always. Additionally, on
# macOS sed -i is weird: https://stackoverflow.com/a/4247319
run: |
sed -i'' -e "s/set(ARCH \"x86_64\")/set(ARCH \"aarch64\")/g" swiftshader/CMakeLists.txt
- name: Configure
run: |
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="arm64" \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=ON \
Expand Down Expand Up @@ -237,12 +301,12 @@ jobs:
-i'.old' install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json
rm install-vulkan/share/vulkan/icd.d/vk_swiftshader_icd.json.old
- name: Upload GLES artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-gles
- name: Upload Vulkan artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-vulkan
Expand All @@ -258,11 +322,11 @@ jobs:
os: [windows-2019]
steps:
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v3
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Set up Visual Studio environment
uses: seanmiddleditch/gha-setup-vsdevenv@v3
uses: compnerd/gha-setup-vsdevenv@v6
- name: Clone SwiftShader
uses: actions/checkout@v2
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand Down Expand Up @@ -323,12 +387,12 @@ jobs:
-replace '\.\\\\vk_swiftshader\.dll', '..\\..\\..\\bin\\vk_swiftshader.dll' `
| Out-File -encoding UTF8 install-vulkan\share\vulkan\icd.d\vk_swiftshader_icd.json
- name: Upload GLES artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-gles-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-gles
- name: Upload Vulkan artifacts
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v4.3.3
with:
name: swiftshader-vulkan-${{ env.SWIFTSHADER_VERSION }}-${{ matrix.os }}
path: install-vulkan

0 comments on commit 90142f7

Please sign in to comment.