-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (42 loc) · 1.43 KB
/
ci.yml
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
name: CI
on:
push:
branches:
- main
pull_request:
permissions:
actions: read
contents: read
jobs:
main:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v1
with:
bun-version: latest
# Set NX_BASE and NX_HEAD explicitly for pull requests
- name: Set NX_BASE and NX_HEAD for PR
if: github.event_name == 'pull_request'
run: |
echo "NX_BASE=$GITHUB_BASE_REF" >> $GITHUB_ENV
echo "NX_HEAD=$GITHUB_HEAD_REF" >> $GITHUB_ENV
echo "NX_BASE="$NX_BASE
echo "NX_HEAD="$NX_HEAD
# Set NX_BASE and NX_HEAD for direct commits
- name: Set NX_BASE and NX_HEAD for direct commits
if: github.event_name == 'push'
run: |
BASE_SHA=$(git rev-parse HEAD~1)
HEAD_SHA=$(git rev-parse HEAD)
echo "NX_BASE=$BASE_SHA" >> $GITHUB_ENV
echo "NX_HEAD=$HEAD_SHA" >> $GITHUB_ENV
- run: bun install --no-cache
- uses: nrwl/nx-set-shas@v4
- run: bun run commitlint --from=$NX_BASE --to=$NX_HEAD
- run: bun run format:check
# Prepend any command with "nx-cloud record --" to record its logs to Nx Cloud
# - run: bun nx-cloud record -- echo Hello World
- run: bun nx affected -t lint test build test-feature --base=$NX_BASE --head=$NX_HEAD --parallel --maxParallel=3