Skip to content

Commit 9a8835e

Browse files
authored
Merge pull request #2 from context-labs/feat/engine
Feat/engine
2 parents cf20315 + 01d5c10 commit 9a8835e

132 files changed

Lines changed: 11568 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.githooks/pre-commit

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(git rev-parse --show-toplevel)"
5+
export GIT_WORK_TREE="$REPO_ROOT"
6+
7+
ENGINE_HOOK="$REPO_ROOT/engine/scripts/git-hooks/pre-commit"
8+
9+
if [[ -x "$ENGINE_HOOK" ]]; then
10+
"$ENGINE_HOOK"
11+
fi

.githooks/pre-push

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
REPO_ROOT="$(git rev-parse --show-toplevel)"
5+
export GIT_WORK_TREE="$REPO_ROOT"
6+
7+
REFS_FILE="$(mktemp)"
8+
9+
cleanup() {
10+
rm -f "$REFS_FILE"
11+
}
12+
13+
trap cleanup EXIT
14+
cat > "$REFS_FILE"
15+
16+
REMOTE="${1:-}"
17+
URL="${2:-}"
18+
ENGINE_HOOK="$REPO_ROOT/engine/scripts/git-hooks/pre-push"
19+
20+
if [[ -x "$ENGINE_HOOK" ]]; then
21+
"$ENGINE_HOOK" "$REMOTE" "$URL" < "$REFS_FILE"
22+
fi
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "[Engine] E2E Tests"
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
secrets:
7+
INFISICAL_CLIENT_ID:
8+
required: true
9+
INFISICAL_CLIENT_SECRET:
10+
required: true
11+
12+
env:
13+
PYTHON_VERSION: "3.12"
14+
INFISICAL_CLI_VERSION: "0.41.2"
15+
16+
permissions:
17+
checks: write
18+
contents: read
19+
20+
jobs:
21+
e2e-tests:
22+
name: E2E Tests
23+
runs-on: depot-ubuntu-latest
24+
timeout-minutes: 45
25+
defaults:
26+
run:
27+
working-directory: engine
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v4
40+
with:
41+
enable-cache: true
42+
cache-dependency-glob: "engine/uv.lock"
43+
44+
- name: Install go-task
45+
uses: arduino/setup-task@v2
46+
with:
47+
version: 3.x
48+
49+
- name: Install Infisical CLI
50+
run: |
51+
curl -fsSL "https://github.com/Infisical/infisical/releases/download/infisical-cli%2Fv${INFISICAL_CLI_VERSION}/infisical_${INFISICAL_CLI_VERSION}_linux_amd64.deb" -o /tmp/infisical.deb
52+
sudo dpkg -i /tmp/infisical.deb
53+
rm /tmp/infisical.deb
54+
55+
- name: Install engine dependencies
56+
run: task ci:setup
57+
58+
- name: Authenticate Infisical
59+
env:
60+
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
61+
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
62+
run: |
63+
TOKEN=$(infisical login --method=universal-auth \
64+
--client-id="$INFISICAL_CLIENT_ID" \
65+
--client-secret="$INFISICAL_CLIENT_SECRET" \
66+
--silent --plain)
67+
echo "::add-mask::$TOKEN"
68+
echo "INFISICAL_TOKEN=$TOKEN" >> "$GITHUB_ENV"
69+
70+
- name: Run E2E tests
71+
run: task test:e2e
72+
73+
- name: Publish Test Report
74+
uses: mikepenz/action-junit-report@v5
75+
if: always()
76+
with:
77+
report_paths: "engine/test-results/e2e/junit.xml"
78+
update_check: true
79+
detailed_summary: true
80+
include_passed: true
81+
include_time_in_summary: true
82+
fail_on_failure: true
83+
84+
- name: Upload artifacts
85+
uses: actions/upload-artifact@v4
86+
if: always()
87+
with:
88+
name: engine-e2e-test-results
89+
path: engine/test-results/e2e/
90+
retention-days: 14
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: "[Engine] Integration Tests"
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
secrets:
7+
INFISICAL_CLIENT_ID:
8+
required: true
9+
INFISICAL_CLIENT_SECRET:
10+
required: true
11+
12+
env:
13+
PYTHON_VERSION: "3.12"
14+
INFISICAL_CLI_VERSION: "0.41.2"
15+
16+
permissions:
17+
checks: write
18+
contents: read
19+
20+
jobs:
21+
integration-tests:
22+
name: Integration Tests
23+
runs-on: depot-ubuntu-latest
24+
timeout-minutes: 30
25+
defaults:
26+
run:
27+
working-directory: engine
28+
29+
steps:
30+
- name: Checkout code
31+
uses: actions/checkout@v4
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: ${{ env.PYTHON_VERSION }}
37+
38+
- name: Install uv
39+
uses: astral-sh/setup-uv@v4
40+
with:
41+
enable-cache: true
42+
cache-dependency-glob: "engine/uv.lock"
43+
44+
- name: Install go-task
45+
uses: arduino/setup-task@v2
46+
with:
47+
version: 3.x
48+
49+
- name: Install Infisical CLI
50+
run: |
51+
curl -fsSL "https://github.com/Infisical/infisical/releases/download/infisical-cli%2Fv${INFISICAL_CLI_VERSION}/infisical_${INFISICAL_CLI_VERSION}_linux_amd64.deb" -o /tmp/infisical.deb
52+
sudo dpkg -i /tmp/infisical.deb
53+
rm /tmp/infisical.deb
54+
55+
- name: Install engine dependencies
56+
run: task ci:setup
57+
58+
- name: Authenticate Infisical
59+
env:
60+
INFISICAL_CLIENT_ID: ${{ secrets.INFISICAL_CLIENT_ID }}
61+
INFISICAL_CLIENT_SECRET: ${{ secrets.INFISICAL_CLIENT_SECRET }}
62+
run: |
63+
TOKEN=$(infisical login --method=universal-auth \
64+
--client-id="$INFISICAL_CLIENT_ID" \
65+
--client-secret="$INFISICAL_CLIENT_SECRET" \
66+
--silent --plain)
67+
echo "::add-mask::$TOKEN"
68+
echo "INFISICAL_TOKEN=$TOKEN" >> "$GITHUB_ENV"
69+
70+
- name: Run integration tests
71+
run: task test:integration
72+
73+
- name: Publish Test Report
74+
uses: mikepenz/action-junit-report@v5
75+
if: always()
76+
with:
77+
report_paths: "engine/test-results/integration.xml"
78+
update_check: true
79+
detailed_summary: true
80+
include_passed: true
81+
include_time_in_summary: true
82+
fail_on_failure: true
83+
84+
- name: Upload artifacts
85+
uses: actions/upload-artifact@v4
86+
if: always()
87+
with:
88+
name: engine-integration-test-results
89+
path: engine/test-results/
90+
retention-days: 14
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "[Engine] Lint, Format & Typecheck"
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
paths:
7+
- "engine/**"
8+
- ".github/workflows/engine--lint-format-typecheck.yml"
9+
push:
10+
branches: [main]
11+
paths:
12+
- "engine/**"
13+
- ".github/workflows/engine--lint-format-typecheck.yml"
14+
workflow_call:
15+
16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
20+
env:
21+
PYTHON_VERSION: "3.12"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
lint-format-typecheck:
28+
name: Lint, Format & Typecheck
29+
runs-on: depot-ubuntu-latest
30+
defaults:
31+
run:
32+
working-directory: engine
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Python
39+
uses: actions/setup-python@v5
40+
with:
41+
python-version: ${{ env.PYTHON_VERSION }}
42+
43+
- name: Install uv
44+
uses: astral-sh/setup-uv@v4
45+
with:
46+
enable-cache: true
47+
cache-dependency-glob: "engine/uv.lock"
48+
49+
- name: Install go-task
50+
uses: arduino/setup-task@v2
51+
with:
52+
version: 3.x
53+
54+
- name: Install engine dependencies
55+
run: task ci:setup
56+
57+
- name: Validate pinned versions
58+
run: task pinned-versions
59+
60+
- name: Lint (ruff)
61+
run: task lint
62+
63+
- name: Format check (ruff)
64+
run: task format
65+
66+
- name: Type check (basedpyright)
67+
run: task typecheck

0 commit comments

Comments
 (0)