Skip to content

Commit

Permalink
Refresh the build.
Browse files Browse the repository at this point in the history
- Building for x86 and ARM64 on macOS
- 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 2a910b3
Showing 1 changed file with 79 additions and 39 deletions.
118 changes: 79 additions & 39 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,32 @@ 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 cmake 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: Clone SwiftShader
uses: actions/checkout@v2
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand All @@ -42,17 +60,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 +87,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 +113,44 @@ 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 cmake 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: Clone SwiftShader
uses: actions/checkout@v2
uses: actions/checkout@v4.1.7
with:
repository: google/swiftshader
ref: ${{ env.COMMIT }}
Expand Down Expand Up @@ -157,22 +193,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-x64-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 @@ -192,6 +231,7 @@ jobs:
cmake \
-G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" \
-DSWIFTSHADER_BUILD_GLES_CM=OFF \
-DSWIFTSHADER_BUILD_GLESv2=ON \
-DSWIFTSHADER_BUILD_VULKAN=ON \
Expand Down Expand Up @@ -237,12 +277,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 +298,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 +363,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 2a910b3

Please sign in to comment.