-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathcontinuous-integration-workflow.yml
More file actions
116 lines (102 loc) · 4.14 KB
/
continuous-integration-workflow.yml
File metadata and controls
116 lines (102 loc) · 4.14 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
112
113
114
115
116
# This is a basic workflow
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [main]
pull_request:
branches: [main]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [ 22 ]
# 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
- uses: actions/checkout@v6
# Set up Node
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
# Run install dependencies
- name: Install dependencies
run: npm ci
# Run tests without xvfb, if not running on ubuntu
- name: Build and Test (non-Linux)
if: (success() || failure()) && runner.os != 'Linux'
env:
NODE_OPTIONS: --max_old_space_size=16384
run: npm run test:coverage --silent
# Run tests directly running xvfb, if running on ubuntu
- name: Build and Test (Linux)
if: (success() || failure()) && runner.os == 'Linux'
env:
NODE_OPTIONS: --max_old_space_size=16384
run: xvfb-run npm run test:coverage --silent
- name: Start KinD cluster
if: (success() || failure()) && runner.os == 'Linux'
uses: helm/kind-action@v1.14.0
with:
version: v0.24.0
- name: Configure cluster
if: (success() || failure()) && runner.os == 'Linux'
run: |
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.19.1/install.sh | bash -s v0.19.1
kubectl create -f https://operatorhub.io/install/service-binding-operator.yaml
kubectl create -f https://operatorhub.io/install/cloudnative-pg.yaml
nb=0
echo -n "Waiting for operator to show up "
while [ "$nb" != "2" ]
do
echo -n "."
sleep 1
nb=`kubectl get pods -n operators --no-headers --ignore-not-found | grep Running | wc -l`
done
echo CLUSTER_URL=`kubectl cluster-info | sed -n -e "s/\x1B\[[0-9;]*[a-zA-Z]//g" -e '1s/.*running at \(.*\)$/\1/p'` >> $GITHUB_ENV
# UI tests fail under linux
# Run UI tests
- name: Run UI Tests
env:
NODE_OPTIONS: --max_old_space_size=16384
if: runner.os == 'Linux'
run: |
# Patch vscode:prepublish to reinstall secretlint AFTER prune
node -e "
const fs = require('fs');
const pkg = JSON.parse(fs.readFileSync('package.json'));
pkg.scripts['vscode:prepublish'] += ' && npm install @secretlint/node';
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2));
"
xvfb-run --server-args="-screen 0 1920x1080x24" npm run public-ui-test
- name: Build and run integration tests
if: (success() || failure()) && runner.os == 'Linux'
env:
NODE_OPTIONS: --max_old_space_size=16384
run: xvfb-run npm run test-integration:coverage --silent
# Archiving integration tests artifacts
- name: Upload test artifacts
uses: actions/upload-artifact@v7
if: failure() && runner.os == 'Linux'
with:
name: artifacts-${{ matrix.os }}
path: |
/tmp/test-resources/screenshots/**/*.png
retention-days: 2
# Upload coverage to codecov.io
- name: Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 #v6.0.0
if: (success() || failure()) && runner.os == 'Linux'
with:
files: ./coverage/unit/coverage-final.json,./coverage/integration/coverage-final.json