-
Notifications
You must be signed in to change notification settings - Fork 60
Expand file tree
/
Copy pathcontinuous-integration-workflow.yml
More file actions
145 lines (120 loc) · 5.19 KB
/
continuous-integration-workflow.yml
File metadata and controls
145 lines (120 loc) · 5.19 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
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
# 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
with:
fetch-depth: 1
# 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
# Install and start KinD cluster
- name: Start KinD cluster
if: (success() || failure()) && runner.os == 'Linux'
uses: helm/kind-action@v1.14.0
with:
version: v0.31.0
node_image: kindest/node:v1.34.0
# Configure cluster
- name: Configure cluster
if: (success() || failure()) && runner.os == 'Linux'
run: |
set -euo pipefail
echo "Installing CloudNativePG..."
kubectl create -f https://raw.githubusercontent.com/cloudnative-pg/cloudnative-pg/release-1.28/releases/cnpg-1.28.1.yaml
echo "Installing OLM (for SBO)..."
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.42.0/crds.yaml
kubectl create -f https://github.com/operator-framework/operator-lifecycle-manager/releases/download/v0.42.0/olm.yaml
kubectl wait --for=condition=Available deployment -n olm --all --timeout=180s
echo "Installing Service Binding Operator via OLM..."
kubectl apply -f https://operatorhub.io/install/service-binding-operator.yaml
echo "Waiting for operators..."
# CNPG
kubectl wait --for=condition=Available deployment -n cnpg-system --all --timeout=180s
# OLM async flow
echo "Waiting for Service Binding Operator CSV to appear..."
until kubectl get csv -n operators | grep -q service-binding-operator; do
sleep 2
done
echo "Waiting for Service Binding Operator CSV to succeed..."
kubectl wait --for=jsonpath='{.status.phase}'=Succeeded \
csv -n operators --all --timeout=300s
# Now safe
kubectl wait --for=condition=Available deployment -n operators --all --timeout=180s
echo "Extracting cluster URL..."
echo "CLUSTER_URL=$(kubectl config view --minify -o jsonpath='{.clusters[0].cluster.server}')" >> $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/settings/logs/**/*.log
/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