Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader compilation in GitHub Actions #178

Merged
merged 4 commits into from
Jul 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/actions/shader/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: compile shaders

runs:
using: 'composite'
steps:
- uses: seanmiddleditch/gha-setup-ninja@master

- name: setup SPIRV tools
# consider install-vulkan-sdk instead
uses: humbletim/[email protected]
with:
vulkan-query-version: 1.3.204.0
vulkan-components: Glslang, SPIRV-Cross
vulkan-use-cache: true

- name: install DXC
uses: napokue/[email protected]

- name: run shader compilers
run: ninja
shell: pwsh
working-directory: piet-gpu/shader
27 changes: 27 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
on:
push:
branches:
- main
- dev
pull_request:

jobs:
rustfmt:
runs-on: ubuntu-latest
name: cargo fmt
steps:
- uses: actions/checkout@v2

- name: install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
components: rustfmt
override: true

- name: cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
37 changes: 37 additions & 0 deletions .github/workflows/push-shader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
branches:
- dev

jobs:
push-shaders:
runs-on: windows-latest
name: compile shaders and push to main
steps:
- uses: actions/checkout@v3
with:
# need history to make the merge work
# possibly we can optimize this and set
# allow-unrelated-histories on merge
fetch-depth: 0
- name: prepare repo for compilation
run: |
git fetch origin main
git switch main
git merge dev -m "merge from dev branch"
git rm -r --ignore-unmatch piet-gpu/shader/gen
mkdir piet-gpu/shader/gen
- uses: ./.github/actions/shader
- name: commit
id: commit
continue-on-error: true
run: |
git add piet-gpu/shader/gen
git config user.name "Commit by GitHub Action"
git config user.email "[email protected]"
git commit -m "commit compiled shaders"
- name: push
if: steps.commit.outcome == 'success'
run: |
git show-ref
git push origin main
13 changes: 13 additions & 0 deletions .github/workflows/shader.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
pull_request:
branches-ignore:
- main

jobs:
push-shaders:
runs-on: windows-latest
name: compile shaders
steps:
- uses: actions/checkout@v3
- run: mkdir piet-gpu/shader/gen
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding -force here should suppress the error if the directory already exists. It might be worth not doing this though and just rejecting any PRs that contain the gen directory?

- uses: ./.github/actions/shader