-
Notifications
You must be signed in to change notification settings - Fork 6
97 lines (92 loc) · 3.72 KB
/
push-actions.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
name: Tracer Testing
on: [push]
jobs:
build-package:
name: Validation ${{ matrix.npm-task }}
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false # We don't want linting to prevent unit testing
matrix:
npm-task: ['prettier:ci', 'lint', 'test:unit', 'build']
steps:
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: 16
architecture: x64
- run: sudo apt-get update && sudo apt-get install build-essential libsdl-pango-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev || true # Node.js 18 does not carry pango
- run: npm ci
- run: npm run ${{ matrix.npm-task }}
- name: Upload distro as artifact
uses: actions/upload-artifact@v4
if: ${{ matrix.npm-task == 'build' }}
with:
name: distro-package
path: distro.tgz
retention-days: 5
instrumentations-to-test:
name: List instrumentations to test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: list_instrumentations
run: |
instrumentations_as_json_list=$(ls -1 test/instrumentations | jq --raw-input --slurp 'split("\n") | map(select(. != ""))' | jq -r tostring)
echo "instrumentations=${instrumentations_as_json_list}" >> "${GITHUB_OUTPUT}"
echo "instrumentations=${instrumentations_as_json_list}"
outputs:
instrumentations: ${{ steps.list_instrumentations.outputs.instrumentations }}
supported-node-versions-testing:
name: 'Node ${{ matrix.node_cimg_tag }} ${{ matrix.instrumentations_to_test }} tests'
runs-on: ubuntu-latest
needs: [build-package, instrumentations-to-test]
strategy:
fail-fast: false # We want to see all tests being tried, rather than stop when the first fails
matrix:
node_cimg_tag: [ 14, 16, 18, 20 ]
instrumentations_to_test: ${{ fromJson(needs.instrumentations-to-test.outputs.instrumentations) }}
steps:
- name: Set Swap Space
uses: pierotofy/set-swap-space@master
with:
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners for
# runner specs, default swap space is only 2GB
swap-size-gb: 10
- uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_cimg_tag }}
architecture: x64
- run: sudo apt-get update && sudo apt-get install build-essential libsdl-pango-dev libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev || true # Node.js 18 does not carry pango
- run: npm ci
- run: npm run test:instrumentations:ci
env:
INSTRUMENTATION_UNDER_TEST: ${{ matrix.instrumentations_to_test }}
unsupported-node-versions-testing:
name: 'Node ${{ matrix.node_cimg_tag }} unsupported'
runs-on: ubuntu-latest
needs: [build-package]
strategy:
matrix:
node_cimg_tag: [ 10, 12 ]
steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node_cimg_tag }}
architecture: x64
- name: Download distro
uses: actions/download-artifact@v4
continue-on-error: true # when there aren't changes the artifact won't be uploaded and this step will fail
with:
name: distro-package
- run: npm i ./distro.tgz
- run: |
output=$(node -e "require('@lumigo/opentelemetry')" 2>&1)
if [[ "${output}" != "@lumigo/opentelemetry: Node.js version '$(node --version)' is not supported"* ]]; then
echo "Unexpected output: ${output}"
exit 1
fi