-
Notifications
You must be signed in to change notification settings - Fork 70
147 lines (130 loc) · 5 KB
/
test-packages.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
---
# Runs the test packages based on the provided files in test.yml
name: test-packages
on:
workflow_call:
inputs:
include:
required: true
type: string
max-parallel:
description: "Set the maximum number of jobs that can run simultaneously in the matrix"
default: 20
required: false
type: number
package-name:
description: "The artifact name with the binaries to be tested"
required: false
type: string
permissions:
contents: read
jobs:
test-packages:
timeout-minutes: 120
runs-on: ubuntu-latest
strategy:
max-parallel: ${{ inputs.max-parallel }}
fail-fast: false
matrix:
include: ${{ fromJSON(inputs.include) }}
env:
PHP_VERSION: ${{ matrix.item[0] }}
LINUX_PACKAGE_TYPE: ${{ matrix.item[1] }}
TESTING_TYPE: ${{ matrix.item[2] }}
ELASTIC_APM_PHP_TESTS_MATRIX_ROW: "${{ join(matrix.item, ',') }}"
BUILD_PACKAGES: build/packages
permissions:
contents: read
packages: read
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
if: ${{ inputs.package-name }}
with:
name: ${{ inputs.package-name }}
path: ${{ env.BUILD_PACKAGES }}
- uses: actions/download-artifact@v4
if: ${{ ! inputs.package-name }}
with:
pattern: 'package*'
merge-multiple: true
path: ${{ env.BUILD_PACKAGES }}
- name: Log in to the Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
## This will help with preparing the signed artifacts that were bundled in a zip file
- if: ${{ inputs.package-name == 'signed-artifacts' }}
name: Unzip signed packages
run: unzip ${PACKAGE_FILE} && rm ${PACKAGE_FILE}
working-directory: ${{ env.BUILD_PACKAGES }}
env:
PACKAGE_FILE: "${{ inputs.package-name }}.zip"
- uses: actions/download-artifact@v4
with:
name: package-parts-linux-x86-64
path: agent/native/_build/linux-x86-64-release
- uses: actions/download-artifact@v4
with:
name: package-parts-linuxmusl-x86-64
path: agent/native/_build/linuxmusl-x86-64-release
- name: Remove ARM64 artifacts
run: |
rm ${BUILD_PACKAGES}/apm-agent-php*arm64*
rm ${BUILD_PACKAGES}/apm-agent-php*aarch64*
- if: ${{ env.TESTING_TYPE == 'lifecycle' }}
name: lifecycle test
run: |
make -C packaging "prepare-${LINUX_PACKAGE_TYPE}"
make -C packaging "${LINUX_PACKAGE_TYPE}-lifecycle-testing"
- if: ${{ startsWith(env.TESTING_TYPE, 'lifecycle-') }}
name: lifecycle test on prod server
run: |
make -C packaging prepare-${LINUX_PACKAGE_TYPE}-${TESTING_TYPE#lifecycle-}
make -C packaging "${LINUX_PACKAGE_TYPE}-lifecycle-testing-in-${TESTING_TYPE#lifecycle-}"
- if: ${{ env.TESTING_TYPE == 'php-upgrade' }}
name: php upgrade test
run: |
make -C packaging "prepare-${LINUX_PACKAGE_TYPE}"
make -C packaging "${LINUX_PACKAGE_TYPE}-php-upgrade-testing"
## Agent upgrade requires to build the package with a different version
## Then download the packages for the current version.
## Run the upgrade testing.
- if: ${{ env.TESTING_TYPE == 'agent-upgrade' }}
name: agent upgrade test - prepare
run: |
mv ${{ env.BUILD_PACKAGES }} build/backup
VERSION=1.0.0 make -C packaging package
mv ${{ env.BUILD_PACKAGES }} build/local
mv build/backup ${{ env.BUILD_PACKAGES }}
make -C packaging "${LINUX_PACKAGE_TYPE}-agent-upgrade-testing-local"
- if: success() || failure()
name: Prepare test result files
run: >-
find build
-name "*junit.xml"
-exec bash -c 'mv {} "build/${ELASTIC_APM_PHP_TESTS_MATRIX_ROW}-$(basename {})"'
\;
- if: success() || failure()
uses: actions/upload-artifact@v4
with:
name: test-results-${{ env.ELASTIC_APM_PHP_TESTS_MATRIX_ROW }}
path: build/*junit.xml
if-no-files-found: error
# Store syslog
- if: failure()
name: Prepare syslog files
continue-on-error: true
run: |-
mkdir build/syslog-files
cd build/syslog || true
find . -name "syslog" -exec bash -c 'cp {} "../syslog-files/${ELASTIC_APM_PHP_TESTS_MATRIX_ROW//[^[:alnum:]]/-}-$(basename {})"' \;
find . -name "messages" -exec bash -c 'cp {} "../syslog-files/${ELASTIC_APM_PHP_TESTS_MATRIX_ROW//[^[:alnum:]]/-}-$(basename {})"' \;
- if: failure()
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: syslogs-${{ env.ELASTIC_APM_PHP_TESTS_MATRIX_ROW }}
path: build/syslog-files/