diff --git a/.github/workflows/make-agent.yml b/.github/workflows/make-agent.yml index 6508fcaf3..4db0bc9af 100644 --- a/.github/workflows/make-agent.yml +++ b/.github/workflows/make-agent.yml @@ -40,12 +40,6 @@ jobs: path: php-agent repository: ${{ inputs.origin }}/newrelic-php-agent ref: ${{ inputs.ref }} - - name: Enable arm64 emulation - if: ${{ inputs.arch == 'arm64' }} - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} - platforms: arm64 - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/make-integration-tests.yml b/.github/workflows/make-integration-tests.yml index 0b6660575..32c28ad7d 100644 --- a/.github/workflows/make-integration-tests.yml +++ b/.github/workflows/make-integration-tests.yml @@ -56,12 +56,6 @@ jobs: run: | chmod 755 php-agent/bin/integration_runner chmod 755 php-agent/agent/modules/newrelic.so - - name: Enable arm64 emulation - if: ${{ inputs.arch == 'arm64' }} - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} - platforms: arm64 - name: Login to Docker Hub uses: docker/login-action@v3 with: diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 1274d2683..1294a9973 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -21,14 +21,11 @@ on: runner-type: description: 'Type of a runner to use for integration tests on arm64' required: true - default: 'ubuntu-20.04-4core' + default: 'ubuntu-24.04-arm' type: choice options: - - ubuntu-20.04-4core - - ubuntu-20.04-8core - - ubuntu-20.04-16core - - ubuntu-22.04-4core - - ubuntu-latest + - ubuntu-22.04-arm + - ubuntu-24.04-arm jobs: build-test-runner-amd64: @@ -55,7 +52,7 @@ jobs: artifact-name: integration_runner artifact-pattern: bin/integration_runner arch: arm64 - runs-on: ubuntu-latest + runs-on: ${{inputs.runner-type}} secrets: inherit build-agent-amd64: @@ -72,7 +69,7 @@ jobs: origin: ${{ inputs.origin }} ref: ${{ inputs.ref }} arch: arm64 - runs-on: ubuntu-latest + runs-on: ${{inputs.runner-type}} secrets: inherit test-amd64: diff --git a/.github/workflows/test-agent.yml b/.github/workflows/test-agent.yml index efb68d872..afb7252f0 100644 --- a/.github/workflows/test-agent.yml +++ b/.github/workflows/test-agent.yml @@ -77,7 +77,8 @@ jobs: - name: Run go vet run: go vet -C ./php-agent/daemon ./... shell: bash - daemon-unit-tests: + + daemon-unit-tests-amd64: runs-on: ubuntu-latest env: IMAGE_NAME: newrelic/nr-php-agent-builder @@ -86,18 +87,50 @@ jobs: strategy: matrix: platform: [gnu, musl] - arch: [amd64, arm64] + arch: [amd64] steps: - name: Checkout newrelic-php-agent code uses: actions/checkout@v4 with: path: php-agent - - name: Enable arm64 emulation - if: ${{ matrix.arch == 'arm64' }} - uses: docker/setup-qemu-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} - platforms: arm64 + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Build daemon + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ACCOUNT_supportability=${{secrets.ACCOUNT_SUPPORTABILITY}} + -e APP_supportability=${{secrets.APP_SUPPORTABILITY}} + $IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION daemon + - name: Run daemon tests + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + $IMAGE_NAME:$IMAGE_TAG-${{ matrix.platform }}-$IMAGE_VERSION daemon_test + - name: Save integration_runner for integration tests + uses: actions/upload-artifact@v4 + with: + name: integration_runner-${{matrix.platform}}-${{matrix.arch}} + path: php-agent/bin/integration_runner + + daemon-unit-tests-arm64: + runs-on: ubuntu-24.04-arm + env: + IMAGE_NAME: newrelic/nr-php-agent-builder + IMAGE_TAG: make-go + IMAGE_VERSION: ${{vars.MAKE_GO_VERSION}} + strategy: + matrix: + platform: [gnu, musl] + arch: [arm64] + steps: + - name: Checkout newrelic-php-agent code + uses: actions/checkout@v4 + with: + path: php-agent - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -120,7 +153,8 @@ jobs: with: name: integration_runner-${{matrix.platform}}-${{matrix.arch}} path: php-agent/bin/integration_runner - agent-unit-test: + + agent-unit-test-amd64: runs-on: ubuntu-latest env: IMAGE_NAME: newrelic/nr-php-agent-builder @@ -129,15 +163,8 @@ jobs: strategy: matrix: platform: [gnu, musl] - arch: [amd64, arm64] + arch: [amd64] php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] - exclude: - - arch: arm64 - php: '7.2' - - arch: arm64 - php: '7.3' - - arch: arm64 - php: '7.4' include: - codecov: 0 - platform: gnu @@ -148,12 +175,6 @@ jobs: uses: actions/checkout@v4 with: path: php-agent - - name: Enable arm64 emulation - if: ${{ matrix.arch == 'arm64' }} - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} - platforms: arm64 - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -162,18 +183,12 @@ jobs: - name: Determine if valgrind can be used id: get-check-variant run: | - if [[ ${{ matrix.platform }} = 'gnu' && ${{matrix.arch}} = 'amd64' ]]; then + if [[ ${{ matrix.platform }} = 'gnu' ]]; then echo "AXIOM_CHECK_VARIANT=valgrind" >> $GITHUB_OUTPUT else echo "AXIOM_CHECK_VARIANT=check" >> $GITHUB_OUTPUT fi - if [[ ${{matrix.arch}} = 'arm64' ]]; then - echo "AGENT_CHECK_VARIANT=check" >> $GITHUB_OUTPUT - elif [[ ${{ matrix.platform }} = 'gnu' ]]; then - echo "AGENT_CHECK_VARIANT=valgrind" >> $GITHUB_OUTPUT - else - echo "AGENT_CHECK_VARIANT=valgrind" >> $GITHUB_OUTPUT - fi + echo "AGENT_CHECK_VARIANT=valgrind" >> $GITHUB_OUTPUT - name: Build axiom run: > docker run --rm --platform linux/${{matrix.arch}} @@ -228,22 +243,86 @@ jobs: name: agent.gcov-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}} include-hidden-files: true path: php-agent/agent/.libs/*.gc* - integration-tests: - needs: [daemon-unit-tests, agent-unit-test] + + agent-unit-test-arm64: + runs-on: ubuntu-24.04-arm + env: + IMAGE_NAME: newrelic/nr-php-agent-builder + IMAGE_TAG: make-php + IMAGE_VERSION: ${{vars.MAKE_PHP_VERSION}} + strategy: + matrix: + platform: [gnu, musl] + arch: [arm64] + php: ['8.0', '8.1', '8.2', '8.3', '8.4'] + include: + - codecov: 0 + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + path: php-agent + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Determine if valgrind can be used + id: get-check-variant + run: | + echo "AXIOM_CHECK_VARIANT=check" >> $GITHUB_OUTPUT + echo "AGENT_CHECK_VARIANT=check" >> $GITHUB_OUTPUT + - name: Build axiom + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make axiom + - name: Build agent + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent + - name: Build axiom unit tests + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make axiom-tests + - name: Run axiom unit tests + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make axiom-${{ steps.get-check-variant.outputs.AXIOM_CHECK_VARIANT }} + - name: Build agent unit tests + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent-tests + - name: Run agent unit tests + run: > + docker run --rm --platform linux/${{matrix.arch}} + -v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent" + -e ENABLE_COVERAGE=${{matrix.codecov}} + $IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent-${{ steps.get-check-variant.outputs.AGENT_CHECK_VARIANT }} + - name: Save newrelic.so for integration tests + uses: actions/upload-artifact@v4 + with: + name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}} + path: php-agent/agent/modules/newrelic.so + + integration-tests-amd64: + needs: [daemon-unit-tests-amd64, agent-unit-test-amd64] runs-on: ubuntu-latest strategy: fail-fast: false matrix: platform: [gnu, musl] - arch: [amd64, arm64] + arch: [amd64] php: ['7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] - exclude: - - arch: arm64 - php: '7.2' - - arch: arm64 - php: '7.3' - - arch: arm64 - php: '7.4' include: - codecov: 0 - platform: gnu @@ -280,12 +359,6 @@ jobs: run: | chmod 755 php-agent/bin/integration_runner chmod 755 php-agent/agent/modules/newrelic.so - - name: Enable arm64 emulation - if: ${{ matrix.arch == 'arm64' }} - uses: docker/setup-qemu-action@v3 - with: - image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} - platforms: arm64 - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -323,7 +396,6 @@ jobs: -e LICENSE_lasp_suite_random_3=${{secrets.LICENSE_LASP_SUITE_RANDOM_3}} \ nr-php make lasp-test-all - name: Run integration tests - if: ${{ matrix.arch == 'amd64' }} working-directory: ./php-agent shell: bash run: | @@ -358,3 +430,93 @@ jobs: working-directory: ./php-agent run: | make test-services-stop + + integration-tests-arm64: + needs: [daemon-unit-tests-arm64, agent-unit-test-arm64] + runs-on: ubuntu-24.04-arm + strategy: + fail-fast: false + matrix: + platform: [gnu, musl] + arch: [arm64] + php: ['8.0', '8.1', '8.2', '8.3', '8.4'] + steps: + - name: Checkout integration tests + uses: actions/checkout@v4 + with: + path: php-agent + - name: Get integration_runner + uses: actions/download-artifact@v4 + with: + name: integration_runner-${{matrix.platform}}-${{matrix.arch}} + path: php-agent/bin + - name: Get newrelic.so + uses: actions/download-artifact@v4 + with: + name: newrelic.so-${{matrix.platform}}-${{matrix.arch}}-${{matrix.php}} + path: php-agent/agent/modules + - name: Prep artifacts for use + run: | + chmod 755 php-agent/bin/integration_runner + chmod 755 php-agent/agent/modules/newrelic.so + - name: Emable amd64 emulation + uses: docker/setup-qemu-action@v3 + with: + image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}} + platforms: amd64 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Start services + env: + PHP: ${{matrix.php}} + LIBC: ${{matrix.platform}} + PLATFORM: linux/${{matrix.arch}} + AGENT_CODE: ${{github.workspace}}/php-agent + IMAGE_VERSION: ${{vars.MAKE_PHP_VERSION}} + working-directory: ./php-agent + run: | + make test-services-start + - name: Test events limits + working-directory: ./php-agent + shell: bash + run: | + docker exec \ + -e PHPS=${{matrix.php}} \ + -e INTEGRATION_ARGS="-license ${{secrets.NR_TEST_LICENSE}} -collector ${{secrets.NR_COLLECTOR_HOST}} -agent agent/modules/newrelic.so" \ + nr-php make integration-events-limits + - name: Test LASP + working-directory: ./php-agent + shell: bash + run: | + docker exec \ + -e PHPS=${{matrix.php}} \ + -e INTEGRATION_ARGS="-license ${{secrets.NR_TEST_LICENSE}} -collector ${{secrets.NR_COLLECTOR_HOST}} -agent agent/modules/newrelic.so" \ + -e LICENSE_lasp_suite_most_secure=${{secrets.LICENSE_LASP_SUITE_MOST_SECURE}} \ + -e LICENSE_lasp_suite_least_secure=${{secrets.LICENSE_LASP_SUITE_LEAST_SECURE}} \ + -e LICENSE_lasp_suite_random_1=${{secrets.LICENSE_LASP_SUITE_RANDOM_1}} \ + -e LICENSE_lasp_suite_random_2=${{secrets.LICENSE_LASP_SUITE_RANDOM_2}} \ + -e LICENSE_lasp_suite_random_3=${{secrets.LICENSE_LASP_SUITE_RANDOM_3}} \ + nr-php make lasp-test-all + - name: Run integration tests + working-directory: ./php-agent + shell: bash + run: | + docker exec \ + -e PHPS=${{matrix.php}} \ + -e INTEGRATION_ARGS="-license ${{secrets.NR_TEST_LICENSE}} -collector ${{secrets.NR_COLLECTOR_HOST}} -agent agent/modules/newrelic.so" \ + -e APP_supportability=${{secrets.APP_SUPPORTABILITY}} \ + -e ACCOUNT_supportability=${{secrets.ACCOUNT_SUPPORTABILITY}} \ + -e ACCOUNT_supportability_trusted=${{secrets.ACCOUNT_SUPPORTABILITY_TRUSTED}} \ + -e SYNTHETICS_HEADER_supportability=${{secrets.SYNTHETICS_HEADER_SUPPORTABILITY}} \ + nr-php make integration-tests + - name: Stop services + env: + PHP: ${{matrix.php}} + LIBC: ${{matrix.platform}} + AGENT_CODE: ${{github.workspace}}/php-agent + working-directory: ./php-agent + run: | + make test-services-stop