-
-
Notifications
You must be signed in to change notification settings - Fork 16
111 lines (95 loc) · 4.17 KB
/
utils-ci-lint-test.yml
File metadata and controls
111 lines (95 loc) · 4.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: CI - Lint and Test
on:
workflow_call:
inputs:
base-ref:
required: true
type: string
description: 'Base ref for nx affected (e.g., origin/main)'
head-ref:
required: true
type: string
description: 'Head ref for nx affected (e.g., origin/dev)'
check-conflicts:
required: false
type: boolean
default: false
description: 'Run merge conflict check before tests'
jobs:
lint-and-test:
name: 'Lint and Test'
runs-on: ubuntu-latest
timeout-minutes: 120
env:
NX_NO_CLOUD: true
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for conflicts
if: ${{ inputs.check-conflicts }}
run: |
echo "Checking for merge conflicts..."
git config user.name "CI Bot"
git config user.email "ci@example.com"
if git merge --no-commit --no-ff origin/main; then
echo "No merge conflicts detected"
git merge --abort 2>/dev/null || git reset --hard HEAD
else
echo "Merge conflicts detected! Please resolve before merging."
git merge --abort 2>/dev/null || git reset --hard HEAD
exit 1
fi
- name: Setup Node v24
uses: actions/setup-node@v6
with:
node-version: 24
- name: Setup pnpm v10
uses: pnpm/action-setup@v4
with:
version: 10
run_install: false
- name: Get pnpm Store Path
id: pnpm-store
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
- name: Setup pnpm Cache
uses: actions/cache@v5
with:
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml', 'package.json') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install pnpm Dependencies
run: pnpm install
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Setup Rust 1.94
uses: dtolnay/rust-toolchain@stable
with:
toolchain: '1.94'
components: clippy
- name: Install system libraries for wry/webkit2gtk
run: |
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
pkg-config libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev
- name: Setup PostgreSQL 17 for pgrx
run: |
sudo install -d /usr/share/postgresql-common/pgdg
sudo curl -o /usr/share/postgresql-common/pgdg/apt.postgresql.org.asc --fail https://www.postgresql.org/media/keys/ACCC4CF8.asc
echo "deb [signed-by=/usr/share/postgresql-common/pgdg/apt.postgresql.org.asc] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y postgresql-server-dev-17 libclang-dev
mkdir -p ~/.pgrx
printf '[configs]\npg17 = "/usr/lib/postgresql/17/bin/pg_config"\n' > ~/.pgrx/config.toml
- name: Lint affected projects
run: pnpm nx affected --target=lint --base=${{ inputs.base-ref }} --head=${{ inputs.head-ref }} --no-cloud
- name: Test affected projects
run: pnpm nx affected --target=test --base=${{ inputs.base-ref }} --head=${{ inputs.head-ref }} --no-cloud