Added configuration for WordPress supportability #369
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: test | |
on: | |
pull_request: | |
paths-ignore: | |
- "**/*.asciidoc" | |
- "**/*.md" | |
- "**/*.png" | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "**/*.asciidoc" | |
- "**/*.md" | |
- "**/*.png" | |
permissions: | |
contents: read | |
## Concurrency only allowed in the main branch. | |
## So old builds running for old commits within the same Pull Request are cancelled | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} | |
jobs: | |
test: | |
name: static-checks-unit-tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 30 | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- "7.2" | |
- "7.3" | |
- "7.4" | |
- "8.0" | |
- "8.1" | |
- "8.2" | |
dockerfile: | |
- "Dockerfile" | |
- "Dockerfile.alpine" | |
env: | |
PHP_VERSION: ${{ matrix.php-version }} | |
DOCKERFILE: ${{ matrix.dockerfile }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Prepare | |
run: make -f .ci/Makefile prepare | |
- name: Build | |
run: make -f .ci/Makefile build | |
- name: Static Check / Unit tests | |
run: make -f .ci/Makefile static-check-unit-test | |
- name: Build parts for packages | |
run: make -f .ci/Makefile generate-for-package | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: package-parts | |
path: src/ext/modules/*.so | |
- if: success() || failure() | |
name: Prepare Upload | |
run: >- | |
find build | |
-name "*junit.xml" | |
-exec bash -c 'mv {} "build/${PHP_VERSION}-${DOCKERFILE}-$(basename {})"' | |
\; | |
- if: success() || failure() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: test-results | |
path: build/*junit.xml | |
if-no-files-found: error | |
build-packages: | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: package-parts | |
path: src/ext/modules | |
- name: package | |
run: make -C packaging package | |
- name: package info | |
run: make -C packaging info | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: package | |
path: | | |
build/packages/* | |
!build/packages/**/*.sha512 | |
generate-test-packages-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
include: ${{ steps.generate.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: generate | |
run: | | |
MATRIX=$(.ci/generate_package_lifecycle_test_matrix.sh | jq --raw-input --slurp -c 'split("\n") | map(select(length > 0)) | map(split(",")) | map({ "item": . } )') | |
echo "matrix=${MATRIX}" >> $GITHUB_OUTPUT | |
test-packages: | |
timeout-minutes: 120 | |
needs: | |
- build-packages | |
- generate-test-packages-matrix | |
- test | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 20 | |
fail-fast: false | |
matrix: | |
include: ${{ fromJSON(needs.generate-test-packages-matrix.outputs.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, ',') }}" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: package | |
path: build/packages | |
- uses: actions/download-artifact@v3 | |
with: | |
name: package-parts | |
path: src/ext/modules | |
- 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 build/packages build/backup | |
VERSION=1.0.0 make -C packaging package | |
mv build/packages build/local | |
mv build/backup 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@v3 | |
with: | |
name: test-results | |
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@v3 | |
continue-on-error: true | |
with: | |
name: syslogs | |
path: build/syslog-files/ |