Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions .github/workflows/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
!build-linux.yml
!build-linux-release.yml
!build-windows.yml
!build-windows-release.yml
2 changes: 1 addition & 1 deletion .github/workflows/branch_rules.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: branch_rules
name: branch-rules

on:
pull_request:
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/build-linux-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: build-linux-release

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: build-linux-release-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
name: build linux release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup Nix
uses: cachix/install-nix-action@v30

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Build (Linux)
run: |
eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)"
xmake f -m release -y
xmake --all -y
44 changes: 44 additions & 0 deletions .github/workflows/build-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: build-linux

on:
pull_request:
branches:
- dev
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: build-linux-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
name: build linux
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup Nix
uses: cachix/install-nix-action@v30

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Build (Linux)
run: |
eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)"
xmake f -m debug -y
xmake --all -y
45 changes: 45 additions & 0 deletions .github/workflows/build-windows-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: build-windows-release

on:
pull_request:
branches:
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: build-windows-release-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
name: build windows release
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Build (Windows)
run: xmake f -m release -y && xmake --all -y
46 changes: 46 additions & 0 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: build-windows

on:
pull_request:
branches:
- dev
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: build-windows-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
name: build windows
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Setup xmake
uses: xmake-io/github-action-setup-xmake@v1

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "10.0.x"

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Build (Windows)
run: xmake f -m debug -y && xmake --all -y
40 changes: 40 additions & 0 deletions .github/workflows/clang-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: clang-format

on:
pull_request:
branches:
- dev
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: clang-format-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
format:
name: clang-format
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install Nix
uses: cachix/install-nix-action@v30

- name: Run clang-format
run: |
eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)"
bash ./tools/ci/clang_format.sh
45 changes: 45 additions & 0 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: clang-tidy

on:
pull_request:
branches:
- dev
- main
types:
- opened
- reopened
- synchronize
- edited

permissions:
contents: read
pull-requests: read

concurrency:
group: clang-tidy-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
tidy:
name: clang-tidy
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
fetch-depth: 0

- name: Install Nix
uses: cachix/install-nix-action@v30

- name: Generate compile_commands
run: |
eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)"
xmake project -k compile_commands -y

- name: Run clang-tidy
run: |
eval "$(nix --extra-experimental-features 'nix-command flakes' print-dev-env .)"
bash ./tools/ci/clang_tidy.sh
103 changes: 103 additions & 0 deletions .github/workflows/draft-dev-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: draft-dev-to-main

on:
pull_request:
branches:
- dev
types:
- closed

permissions:
contents: read
pull-requests: write
issues: write

jobs:
draft:
name: create dev -> main draft
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.base.repo.fork == false && github.event.pull_request.base.repo.full_name == github.repository
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true

- name: Fetch main and dev
shell: bash
run: |
set -euo pipefail
git fetch origin main dev --prune --tags

- name: Determine next tag
id: version
shell: bash
run: |
set -euo pipefail

ahead_count="$(git rev-list --count origin/main..origin/dev)"
if [[ "${ahead_count}" -le 0 ]]; then
echo "dev is not ahead of main; skipping."
echo "create_pr=false" >> "${GITHUB_OUTPUT}"
exit 0
fi

latest_tag="$(git tag --list "2.*.*" --sort=-version:refname | head -n 1 || true)"
if [[ -z "${latest_tag}" ]]; then
new_tag="2.0.0"
else
IFS='.' read -r major minor patch <<< "${latest_tag}"
minor=$((minor + 1))
patch=0
new_tag="${major}.${minor}.${patch}"
fi

echo "new_tag=${new_tag}" >> "${GITHUB_OUTPUT}"
echo "create_pr=true" >> "${GITHUB_OUTPUT}"

- name: Create draft PR if missing
if: steps.version.outputs.create_pr == 'true'
uses: actions/github-script@v7
with:
script: |
const owner = context.repo.owner;
const repo = context.repo.repo;
const tag = "${{ steps.version.outputs.new_tag }}";

const existing = await github.rest.pulls.list({
owner,
repo,
state: "open",
base: "main",
head: `${owner}:dev`
});

if (existing.data.length > 0) {
core.info("Open dev -> main PR already exists; skipping.");
return;
}

const pr = await github.rest.pulls.create({
owner,
repo,
title: `Toast Engine v${tag}`,
head: "dev",
base: "main",
body: "",
draft: true
});

await github.rest.pulls.requestReviewers({
owner,
repo,
pull_number: pr.data.number,
reviewers: ["ynks"]
});

await github.rest.issues.addAssignees({
owner,
repo,
issue_number: pr.data.number,
assignees: ["ynks"]
});
Loading
Loading