-
-
Notifications
You must be signed in to change notification settings - Fork 47
169 lines (150 loc) · 4.59 KB
/
build.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
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
name: Build
on:
push:
branches: 'main'
pull_request:
branches: '*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Run build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.11]
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup conda
uses: conda-incubator/setup-miniconda@v2
with:
mamba-version: "*"
channels: conda-forge,defaults
channel-priority: true
environment-file: environment.yml
activate-environment: datalayer
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install the npm dependencies
run: |
yarn install
- name: Run the build
run: |
yarn build
visual-test:
runs-on: ubuntu-latest
needs: build
name: Stories visual tests
timeout-minutes: 60
env:
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
steps:
- name: Checkout 🛎️
uses: actions/checkout@v4
- name: Setup Node 💾
uses: actions/setup-node@v3
with:
node-version: '18'
-
run: |
corepack enable
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Setup yarn cache
uses: actions/cache@v3
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
yarn-
- name: Install Dependencies 📥
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
run: yarn install
- name: Set up browser cache
uses: actions/cache@v3
with:
path: |
${{ github.workspace }}/pw-browsers
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
- name: Install Playwright Browsers
run: yarn run playwright install chromium --with-deps
working-directory: packages/react
- name: Run Visual Tests 🧪
run: yarn run test:visual
working-directory: packages/react
- name: Update Snapshots
if: ${{ failure() }}
run: |
mv test-results test-assets
yarn run test:visual -u
working-directory: packages/react
- uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: jupyter-react-test
path: |
packages/react/test-assets/
packages/react/stories/**/*-snapshots/*
docker-dev:
# Don't run if the previous case fails
needs: build
name: Build on dev container
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
steps:
-
name: Checkout
uses: actions/checkout@v4
-
name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
-
name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ".devcontainer/Dockerfile"
target: "builder"
# For now never push
# push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}