This repository has been archived by the owner on May 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
194 lines (160 loc) · 6.65 KB
/
nusight.yaml
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# Continuous Integration tests for NUsight
name: NUsight CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
# Trigger for merge queue
merge_group:
types: [checks_requested]
# Ensure that only one instance of the workflow is run at a time for each branch/tag.
# Jobs currently running on the branch/tag will be cancelled when new commits are pushed.
# See https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#concurrency.
concurrency:
# `github.workflow` is the workflow name, `github.ref` is the current branch/tag identifier
group: ${{ format('{0}:{1}', github.workflow, github.ref) }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
# Set the yarn cache folder to a writable folder
env:
HOME: ${{ github.workspace }}
YARN_CACHE_FOLDER: ${{ github.workspace }}/.yarn
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# Detects changes to NUsight related files, for conditionally running other jobs
check_for_changes:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Output the detected changes for conditionally running other jobs
outputs:
has_workflow_changes: ${{ steps.filter.outputs.workflow_changes }}
has_nusight_changes: ${{ steps.filter.outputs.nusight_changes }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Check for NUsight Changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
workflow_changes:
- '.github/workflows/nusight.yaml'
nusight_changes:
- 'nusight2/**'
- 'shared/message/**/*.proto'
- 'nuclear/message/proto/**/*.proto'
# Build the NUsight code
build-nusight:
name: Build NUsight
needs: check_for_changes
# Run only if the workflow or NUsight related files have changed
if: >
needs.check_for_changes.outputs.has_workflow_changes == 'true' ||
needs.check_for_changes.outputs.has_nusight_changes == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Run on the Node 14 (LTS) container
container:
image: node:lts-fermium
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3
# Get our yarn cache if it exists
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# Check if the yarn cache directory is valid
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit`
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Check dependencies from cache and install any which weren't cached or were corrupted
- name: Install Dependencies
working-directory: nusight2
run: yarn --prefer-offline
- name: Build NUsight
working-directory: nusight2
run: yarn build:ci
# Build the NUsight Storybook code
build-nusight-storybook:
name: Build NUsight Storybook
needs: check_for_changes
# Run only if the workflow or NUsight related files have changed
if: >
needs.check_for_changes.outputs.has_workflow_changes == 'true' ||
needs.check_for_changes.outputs.has_nusight_changes == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Run on the Node 14 (LTS) container
container:
image: node:lts-fermium
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3
# Get our yarn cache if it exists
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# Check if the yarn cache directory is valid
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit`
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Check dependencies from cache and install any which weren't cached or were corrupted
- name: Install Dependencies
working-directory: nusight2
run: yarn --prefer-offline
- name: Build NUsight
working-directory: nusight2
run: yarn storybook:build
# Test the NUsight code
test-nusight:
name: Test NUsight
needs: check_for_changes
# Run only if the workflow or NUsight related files have changed
if: >
needs.check_for_changes.outputs.has_workflow_changes == 'true' ||
needs.check_for_changes.outputs.has_nusight_changes == 'true'
# The type of runner that the job will run on
runs-on: ubuntu-20.04
# Run on the Node 14 (LTS) container
container:
image: node:lts-fermium
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3
# Get our yarn cache if it exists
# See https://github.com/actions/cache/blob/master/examples.md#node---yarn
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
# Check if the yarn cache directory is valid
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit`
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
# Check dependencies from cache and install any which weren't cached or were corrupted
- name: Install Dependencies
working-directory: nusight2
run: yarn --prefer-offline
- name: Build NUsight
working-directory: nusight2
run: yarn test:ci