From db155393d32027493dfb3c059f7d01d8430bb0dd Mon Sep 17 00:00:00 2001 From: horsenuggets Date: Mon, 12 Jan 2026 21:34:53 -0800 Subject: [PATCH 1/3] Refactor CI/CD workflow for new release process - Add ci.yml for PR checks to main (branch naming, format, test, analyze) - Update release-checks.yml with PR title validation and diff check with main - Remove separate format.yml and test.yml (now combined in ci.yml) - Enforce squash merge only via GitHub settings - Add branch protection for main and release branches --- .github/workflows/ci.yml | 82 ++++++++++++++++++++++++++++ .github/workflows/format.yml | 23 -------- .github/workflows/release-checks.yml | 72 +++++++++++++++++++++--- .github/workflows/test.yml | 26 --------- 4 files changed, 146 insertions(+), 57 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/format.yml delete mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cbff12d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,82 @@ +name: CI + +on: + pull_request: + branches: + - main + +jobs: + branch-naming: + name: Validate branch name + runs-on: ubuntu-latest + steps: + - name: Check branch name format + run: | + BRANCH="${{ github.head_ref }}" + echo "Checking branch name: $BRANCH" + + # Must start with a valid prefix + if [[ ! "$BRANCH" =~ ^(feature|bugfix|hotfix|chore|docs|refactor|test)/ ]]; then + echo "::error::Branch name must start with a valid prefix (feature/, bugfix/, hotfix/, chore/, docs/, refactor/, test/)" + exit 1 + fi + + # After prefix, must be lowercase kebab-case + SUFFIX="${BRANCH#*/}" + if [[ ! "$SUFFIX" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then + echo "::error::Branch name after prefix must be lowercase kebab-case (e.g., feature/my-new-feature)" + exit 1 + fi + + echo "Branch name is valid." + + format: + name: Check formatting + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rokit + uses: CompeyDev/setup-rokit@v0.1.2 + + - name: Check formatting + run: lune run ./Submodules/luau-cicd/Scripts/CheckFormatting.luau + + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rokit + uses: CompeyDev/setup-rokit@v0.1.2 + + - name: Install dependencies + run: wally install + + - name: Run tests + run: lune run ./Scripts/RunTests.luau + + analyze: + name: Static analysis + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rokit + uses: CompeyDev/setup-rokit@v0.1.2 + + - name: Setup Lune typedefs + run: lune setup --no-update-luaurc + + - name: Run static analysis + run: luau-lsp analyze --ignore "Source/Testable/init.luau" --platform standard . diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 7abce0d..0000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Format - -on: - push: - branches: - - main - -jobs: - format: - name: Check formatting - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup Rokit - uses: CompeyDev/setup-rokit@v0.1.2 - - - name: Check formatting - run: lune run ./Submodules/luau-cicd/Scripts/CheckFormatting.luau diff --git a/.github/workflows/release-checks.yml b/.github/workflows/release-checks.yml index 76f74b8..a02b2a4 100644 --- a/.github/workflows/release-checks.yml +++ b/.github/workflows/release-checks.yml @@ -6,23 +6,48 @@ on: - release jobs: - test: - name: Run tests + pr-title: + name: Validate PR title + runs-on: ubuntu-latest + steps: + - name: Check PR title format + run: | + TITLE="${{ github.event.pull_request.title }}" + echo "Checking PR title: $TITLE" + + # Must be exactly "Release X.Y.Z" + if [[ ! "$TITLE" =~ ^Release\ [0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "::error::PR title must be exactly 'Release X.Y.Z' (e.g., 'Release 1.2.3')" + exit 1 + fi + + echo "PR title is valid." + + diff-check: + name: Verify diff matches main runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 with: + fetch-depth: 0 submodules: true - - name: Setup Rokit - uses: CompeyDev/setup-rokit@v0.1.2 + - name: Check diff with main + run: | + git fetch origin main - - name: Install dependencies - run: wally install + # Get the diff between the PR branch and main + DIFF=$(git diff origin/main..HEAD) - - name: Run tests - run: lune run ./Scripts/RunTests.luau + if [ -n "$DIFF" ]; then + echo "::error::PR branch has changes that differ from main. The release branch must contain exactly what is in main." + echo "Diff:" + echo "$DIFF" + exit 1 + fi + + echo "PR branch matches main exactly." format: name: Check formatting @@ -39,6 +64,24 @@ jobs: - name: Check formatting run: lune run ./Submodules/luau-cicd/Scripts/CheckFormatting.luau + test: + name: Run tests + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + + - name: Setup Rokit + uses: CompeyDev/setup-rokit@v0.1.2 + + - name: Install dependencies + run: wally install + + - name: Run tests + run: lune run ./Scripts/RunTests.luau + analyze: name: Static analysis runs-on: ubuntu-latest @@ -78,3 +121,16 @@ jobs: - name: Check changelog entry run: lune run ./Submodules/luau-cicd/Scripts/CheckChangelogVersion.luau + + - name: Verify PR title matches VERSION + run: | + VERSION=$(cat VERSION | tr -d '[:space:]') + EXPECTED_TITLE="Release $VERSION" + ACTUAL_TITLE="${{ github.event.pull_request.title }}" + + if [ "$EXPECTED_TITLE" != "$ACTUAL_TITLE" ]; then + echo "::error::PR title '$ACTUAL_TITLE' does not match VERSION file. Expected '$EXPECTED_TITLE'" + exit 1 + fi + + echo "PR title matches VERSION file." diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 378aebc..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Test - -on: - push: - branches: - - main - -jobs: - test: - name: Run tests - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - submodules: true - - - name: Setup Rokit - uses: CompeyDev/setup-rokit@v0.1.2 - - - name: Install dependencies - run: wally install - - - name: Run tests - run: lune run ./Scripts/RunTests.luau From 302ee6564407b6b18fdf9d00e04f2de41d765994 Mon Sep 17 00:00:00 2001 From: horsenuggets Date: Mon, 12 Jan 2026 21:37:42 -0800 Subject: [PATCH 2/3] Add wally install to static analysis jobs Static analysis requires dependencies to be installed for type checking. --- .github/workflows/ci.yml | 3 +++ .github/workflows/release-checks.yml | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cbff12d..d7d5057 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -75,6 +75,9 @@ jobs: - name: Setup Rokit uses: CompeyDev/setup-rokit@v0.1.2 + - name: Install dependencies + run: wally install + - name: Setup Lune typedefs run: lune setup --no-update-luaurc diff --git a/.github/workflows/release-checks.yml b/.github/workflows/release-checks.yml index a02b2a4..78c3f6f 100644 --- a/.github/workflows/release-checks.yml +++ b/.github/workflows/release-checks.yml @@ -94,6 +94,9 @@ jobs: - name: Setup Rokit uses: CompeyDev/setup-rokit@v0.1.2 + - name: Install dependencies + run: wally install + - name: Setup Lune typedefs run: lune setup --no-update-luaurc From d4f9ee02b43b176f73d20c9e82bacb5aee824f0b Mon Sep 17 00:00:00 2001 From: horsenuggets Date: Mon, 12 Jan 2026 21:38:57 -0800 Subject: [PATCH 3/3] Ignore Submodules directory in static analysis Submodules have their own dependencies that aren't installed in the parent repo. --- .github/workflows/ci.yml | 2 +- .github/workflows/release-checks.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d7d5057..7da7c2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -82,4 +82,4 @@ jobs: run: lune setup --no-update-luaurc - name: Run static analysis - run: luau-lsp analyze --ignore "Source/Testable/init.luau" --platform standard . + run: luau-lsp analyze --ignore "Source/Testable/init.luau" --ignore "Submodules/**" --platform standard . diff --git a/.github/workflows/release-checks.yml b/.github/workflows/release-checks.yml index 78c3f6f..f51eaad 100644 --- a/.github/workflows/release-checks.yml +++ b/.github/workflows/release-checks.yml @@ -101,7 +101,7 @@ jobs: run: lune setup --no-update-luaurc - name: Run static analysis - run: luau-lsp analyze --ignore "Source/Testable/init.luau" --platform standard . + run: luau-lsp analyze --ignore "Source/Testable/init.luau" --ignore "Submodules/**" --platform standard . version: name: Validate version