This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
generated from tophat/new-project-kit
-
Notifications
You must be signed in to change notification settings - Fork 7
124 lines (121 loc) · 3.96 KB
/
pull-request.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
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
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Continuous Integration
on:
push:
branches:
- master
pull_request:
env:
CI: 1
ARTIFACT_DIR: ./artifacts
jobs:
commit-watch:
name: Run Commit Watch
runs-on: ubuntu-22.04
if: "github.event_name == 'pull_request' && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4.1.1
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Run Commit Watch
env:
COMMIT_WATCH_OUTPUT_DIR: ${{ env.ARTIFACT_DIR }}/
COMMITWATCH_GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
CI_REPO_OWNER: ${{ github.repository_owner }}
CI_REPO_NAME: ${{ github.event.repository.name }}
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
CI_BASE_BRANCH: origin/${{ github.base_ref }}
run: yarn dlx commit-watch
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: commit-watch-artifacts
path: ${{ env.ARTIFACT_DIR }}
tests:
name: Lint & Tests
runs-on: ubuntu-22.04
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v3
with:
path: |
./.yarn
./.pnp.*
key: ${{ env.NODE_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Linting
run: yarn lint:ci
- name: Type Check
run: yarn types
- name: Set GitHub user for tests
run: |
git config --global user.email "opensource@tophat.com"
git config --global user.name "Top Hat Open Source"
- name: Tests
run: yarn test:ci
- name: Upload Coverage Report
run: ./.github/codecov.sh $GITHUB_EVENT_PATH
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: report-artifacts
path: ${{ env.ARTIFACT_DIR }}
build:
name: Build
runs-on: ubuntu-22.04
needs: [tests]
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v4.1.1
- uses: ./.github/actions/detect-env
- name: Setup Node.js
uses: actions/setup-node@v3.8.1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable Corepack
run: corepack enable
- name: Create artifacts directory
run: mkdir -p ${{ env.ARTIFACT_DIR }}
- name: Restore yarn cache
id: yarn-cache
uses: actions/cache@v3
with:
path: |
./.yarn
./.pnp.*
key: ${{ env.NODE_VERSION }}-${{ hashFiles('yarn.lock') }}
- name: Install dependencies
run: yarn install --immutable
- name: Build
run: yarn build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: ${{ env.ARTIFACT_DIR }}