gpu-dawn: have CI build gpu-dawn for Linux & macOS

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2022-02-11 15:21:17 -07:00 committed by Stephen Gutekanst
parent db86678809
commit e6e5c7f14a
5 changed files with 86 additions and 0 deletions

1
gpu-dawn/.github/FUNDING.yml vendored Normal file
View file

@ -0,0 +1 @@
github: slimsag

View file

@ -0,0 +1,5 @@
Please send your change to [the main repository](https://github.com/hexops/mach/tree/main/gpu-dawn) instead, sorry for the trouble!
This helps us avoid some complex merge conflicts we run into when changes are made to both repositories and history needs to be reconciled. Keeping PRs in just that repository enables us to use `git subtree` to trivially keep the two repositories in sync.
Once your PR is merged over there, it'll automatically sync to this repository.

54
gpu-dawn/.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,54 @@
name: CI
on:
- push
- pull_request
jobs:
x86_64-linux:
runs-on: ubuntu-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
sudo apt install xz-utils
sudo sh -c 'wget -c https://ziglang.org/builds/zig-linux-x86_64-0.9.0-dev.2023+16b753549.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: test
run: zig build test && find zig-out/
# TODO(build-system): enable windows CI here once gpu-dawn builds under Windows
# x86_64-windows:
# runs-on: windows-latest
# # We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# # to the branch.
# if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
# steps:
# - name: Checkout
# uses: actions/checkout@v2
# - name: Install Git
# run: choco install git
# - name: Setup Zig
# run: |
# Invoke-WebRequest -Uri "https://ziglang.org/builds/zig-windows-x86_64-0.9.0-dev.2023+16b753549.zip" -OutFile "C:\zig.zip"
# cd C:\
# 7z x zig.zip
# Add-Content $env:GITHUB_PATH "C:\zig-windows-x86_64-0.9.0-dev.2023+16b753549\"
# - name: test
# run: zig build test && find zig-out/
x86_64-macos:
runs-on: macos-latest
# We want to run on external PRs, but not on our own internal PRs as they'll be run by the push
# to the branch.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
brew install xz
sudo sh -c 'wget -c https://ziglang.org/builds/zig-macos-x86_64-0.9.0-dev.2023+16b753549.tar.xz -O - | tar -xJ --strip-components=1 -C /usr/local/bin'
- name: test
run: zig build test && find zig-out/
env:
AGREE: true

25
gpu-dawn/.github/workflows/m1_ci.yml vendored Normal file
View file

@ -0,0 +1,25 @@
name: CI
on:
# SECURITY: This must be a push event only, otherwise our M1 mac runner would be compromised by
# third-party pull requests which could run arbitrary code. This way, we can restrict it to
# collaborators of the repository only.
#
# Whenever GitHub Actions gets official M1 support, we can use that for PRs and get rid of this
# self-hosted runner: https://github.com/actions/virtual-environments/issues/2187
- push
jobs:
aarch64-macos:
runs-on: [self-hosted, macOS, ARM64]
defaults:
run:
shell: "/usr/bin/arch -arch arm64e /bin/bash --noprofile --norc -eo pipefail {0}"
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Zig
run: |
zig version
- name: test
run: zig build test && find zig-out/
env:
AGREE: true

View file

@ -15,6 +15,7 @@ pub fn build(b: *Builder) void {
const main_tests = b.addTest("src/main.zig");
main_tests.setBuildMode(mode);
link(b, main_tests, .{});
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step);