[object Object]

← back to Exo

Overhaul CI Design

e4c4b3e95a07fb0a53ac9e97f7d0dcfcf4645905 · 2025-06-28 12:29:01 +0100 · Arbion Halili

Files touched

Diff

commit e4c4b3e95a07fb0a53ac9e97f7d0dcfcf4645905
Author: Arbion Halili <99731180+ToxicPine@users.noreply.github.com>
Date:   Sat Jun 28 12:29:01 2025 +0100

    Overhaul CI Design
---
 .../conditional-commit/conditional-commit.yml      | 16 ++++++
 .github/actions/format/action.yml                  | 10 ++++
 .github/actions/lint/action.yml                    | 10 ++++
 .github/actions/regenerate-protobufs/action.yml    | 10 ++++
 .github/actions/setup-python-uv/action.yml         | 20 +++++++
 .github/actions/typecheck/action.yml               | 10 ++++
 .github/workflows/format.yml                       | 49 ----------------
 .github/workflows/lint.yml                         | 49 ----------------
 .github/workflows/pipeline.yml                     | 67 ++++++++++++++++++++++
 .github/workflows/type-check.yml                   | 38 ------------
 10 files changed, 143 insertions(+), 136 deletions(-)

diff --git a/.github/actions/conditional-commit/conditional-commit.yml b/.github/actions/conditional-commit/conditional-commit.yml
new file mode 100644
index 00000000..43c31c61
--- /dev/null
+++ b/.github/actions/conditional-commit/conditional-commit.yml
@@ -0,0 +1,16 @@
+name: Commit if changed
+description: "Create a commit when the working tree is dirty"
+
+inputs:
+  message:
+    description: "Commit message"
+    required: true
+
+runs:
+  using: composite
+  steps:
+    - name: Commit changed files
+      shell: bash
+      run: |
+        git diff --quiet && exit 0
+        git commit -am "${{ inputs.message }}"
\ No newline at end of file
diff --git a/.github/actions/format/action.yml b/.github/actions/format/action.yml
new file mode 100644
index 00000000..aec7bb98
--- /dev/null
+++ b/.github/actions/format/action.yml
@@ -0,0 +1,10 @@
+name: Format Code
+
+description: "Run code formatter"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Format code
+      run: uv run poe fmt
+      shell: bash 
\ No newline at end of file
diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml
new file mode 100644
index 00000000..be5d738f
--- /dev/null
+++ b/.github/actions/lint/action.yml
@@ -0,0 +1,10 @@
+name: Lint Code
+
+description: "Run code linter"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Lint code
+      run: uv run poe lint
+      shell: bash 
\ No newline at end of file
diff --git a/.github/actions/regenerate-protobufs/action.yml b/.github/actions/regenerate-protobufs/action.yml
new file mode 100644
index 00000000..0db43cab
--- /dev/null
+++ b/.github/actions/regenerate-protobufs/action.yml
@@ -0,0 +1,10 @@
+name: Regenerate Protobufs
+
+description: "Regenerate protobuf files"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Regenerate protobufs
+      run: nix develop -c just regenerate-protobufs
+      shell: bash 
\ No newline at end of file
diff --git a/.github/actions/setup-python-uv/action.yml b/.github/actions/setup-python-uv/action.yml
new file mode 100644
index 00000000..3b531ed0
--- /dev/null
+++ b/.github/actions/setup-python-uv/action.yml
@@ -0,0 +1,20 @@
+name: Setup Python & uv
+
+description: "Regenerate Python environment from uv.lock"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Install uv
+      uses: astral-sh/setup-uv@v6
+      with:
+        enable-cache: true
+        cache-dependency-glob: uv.lock
+
+    - name: Install Python
+      run: uv python install
+      shell: bash 
+
+    - name: Sync
+      run: uv sync --locked --all-extras --dev
+      shell: bash
\ No newline at end of file
diff --git a/.github/actions/typecheck/action.yml b/.github/actions/typecheck/action.yml
new file mode 100644
index 00000000..96b4c2e8
--- /dev/null
+++ b/.github/actions/typecheck/action.yml
@@ -0,0 +1,10 @@
+name: Type Check
+
+description: "Run static type checker"
+
+runs:
+  using: "composite"
+  steps:
+    - name: Run type checker
+      run: uv run poe check
+      shell: bash 
\ No newline at end of file
diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml
deleted file mode 100644
index a8eedcd6..00000000
--- a/.github/workflows/format.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: format
-
-on:
-  push:
-    branches:
-      - staging
-      - main
-  pull_request:
-    branches:
-      - staging
-      - main
-
-jobs:
-  format:
-    runs-on: ubuntu-22.04
-
-    permissions:
-      contents: write
-
-    steps:
-      - uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
-          token: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Install uv
-        uses: astral-sh/setup-uv@v6
-        with:
-          enable-cache: true
-          cache-dependency-glob: uv.lock
-
-      - name: Install Python
-        run: uv python install
-
-      - name: Sync dependencies
-        run: uv sync --locked --all-extras --dev
-
-      - name: Format code
-        run: uv run poe fmt
-
-      - name: Push formatted code
-        run: |
-          git diff --quiet && exit 0
-          git config --local user.email "github-actions@users.noreply.github.com"
-          git config --local user.name  "github-actions bot"
-          git commit -am "chore(format)"
-          git push
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml
deleted file mode 100644
index 49c3689d..00000000
--- a/.github/workflows/lint.yml
+++ /dev/null
@@ -1,49 +0,0 @@
-name: lint
-
-on:
-  push:
-    branches:
-      - staging
-      - main
-  pull_request:
-    branches:
-      - staging
-      - main
-
-jobs:
-  format:
-    runs-on: ubuntu-22.04
-
-    permissions:
-      contents: write
-
-    steps:
-      - uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
-          token: ${{ secrets.GITHUB_TOKEN }}
-
-      - name: Install uv
-        uses: astral-sh/setup-uv@v6
-        with:
-          enable-cache: true
-          cache-dependency-glob: uv.lock
-
-      - name: Install Python
-        run: uv python install
-
-      - name: Sync dependencies
-        run: uv sync --locked --all-extras --dev
-
-      - name: Lint code
-        run: uv run poe lint
-
-      - name: Push linted code
-        run: |
-          git diff --quiet && exit 0
-          git config --local user.email "github-actions@users.noreply.github.com"
-          git config --local user.name  "github-actions bot"
-          git commit -am "chore(lint)"
-          git push
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml
new file mode 100644
index 00000000..cb6860b3
--- /dev/null
+++ b/.github/workflows/pipeline.yml
@@ -0,0 +1,67 @@
+name: ci-pipeline
+
+on:
+  push:
+    branches:
+      - staging
+      - main
+  pull_request:
+    branches:
+      - staging
+      - main
+
+jobs:
+  typecheck:
+    runs-on: ubuntu-22.04
+    steps:
+      - uses: ./.github/workflows/type-check.yml
+  ci:
+    needs: typecheck
+    runs-on: ubuntu-22.04
+    permissions:
+      contents: write
+    env:
+      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+    steps:
+      - uses: actions/checkout@v4
+        with:
+          fetch-depth: 0
+          token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Configure git user
+        run: |
+          git config --local user.email "github-actions@users.noreply.github.com"
+          git config --local user.name  "github-actions bot"
+        shell: bash
+
+      - uses: cachix/install-nix-action@v31
+        with:
+          github_access_token: ${{ secrets.GITHUB_TOKEN }}
+
+      - name: Setup Python and uv
+        uses: ./.github/actions/setup-python-uv
+
+      - uses: ./.github/actions/regenerate-protobufs
+
+      - name: Commit regenerated protobufs
+        uses: ./.github/actions/conditional-commit
+        with:
+          message: "chore(proto) regenerate protobufs"
+
+      - uses: ./.github/actions/format
+
+      - name: Commit formatted code
+        uses: ./.github/actions/conditional-commit
+        with:
+          message: "chore(format): format code"
+
+      - uses: ./.github/actions/lint
+
+      - name: Commit lint fixes
+        uses: ./.github/actions/conditional-commit
+        with:
+          message: "chore(lint): fix linting errors"
+
+      - name: Push changes
+        run: git push
+        shell: bash
\ No newline at end of file
diff --git a/.github/workflows/type-check.yml b/.github/workflows/type-check.yml
deleted file mode 100644
index eb2289e0..00000000
--- a/.github/workflows/type-check.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: type-check
-
-on:
-  push:
-    branches:
-      - staging
-      - main
-  pull_request:
-    branches:
-      - staging
-      - main
-
-jobs:
-  typecheck:
-    runs-on: ubuntu-22.04
-
-    permissions:
-      contents: read
-
-    steps:
-      - uses: actions/checkout@v4
-        with:
-          fetch-depth: 0
-
-      - name: Install uv
-        uses: astral-sh/setup-uv@v6
-        with:
-          enable-cache: true
-          cache-dependency-glob: uv.lock
-
-      - name: Install Python
-        run: uv python install
-
-      - name: Sync dependencies
-        run: uv sync --locked --all-extras --dev
-
-      - name: Run type checker
-        run: uv run poe check

← f7f779da Fix Type Checker; Improve Protobuf Generation  ·  back to Exo  ·  Add RULES.md and .cursorrules 885c7d5c →