Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: refactor run-integration-tests to use larger runners #705

Merged
merged 5 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/make-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: _make-agent

on:
workflow_call:
inputs:
origin:
description: 'newrelic-php-agent origin'
required: true
default: 'newrelic'
type: string
ref:
description: 'Branch or tag'
required: true
type: string
arch:
description: 'Target architecture'
required: true
type: string
runs-on:
description: 'runner type'
required: true
type: string

jobs:
build-agent:
name: make agent (${{ matrix.platform }}, ${{ inputs.arch }}, ${{ matrix.php }})
runs-on: ${{inputs.runs-on}}
env:
IMAGE_NAME: newrelic/nr-php-agent-builder
IMAGE_TAG: make-php
IMAGE_VERSION: ${{vars.MAKE_PHP_VERSION}}
strategy:
matrix:
platform: [gnu, musl]
php: ['8.0', '8.1', '8.2']
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
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@v2
with:
image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}}
platforms: arm64
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build axiom
run: >
docker run --rm --platform linux/${{inputs.arch}}
-v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent"
$IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make axiom
- name: Build agent
run: >
docker run --rm --platform linux/${{inputs.arch}}
-v "${GITHUB_WORKSPACE}/php-agent":"/usr/local/src/newrelic-php-agent"
$IMAGE_NAME:$IMAGE_TAG-${{matrix.php}}-${{matrix.platform}}-$IMAGE_VERSION make agent
- name: Save newrelic.so for integration tests
uses: actions/upload-artifact@v3
with:
name: newrelic.so-${{matrix.platform}}-${{inputs.arch}}-${{matrix.php}}
path: php-agent/agent/modules/newrelic.so
84 changes: 84 additions & 0 deletions .github/workflows/make-for-platform-on-arch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: _make-target

on:
workflow_call:
inputs:
origin:
description: 'newrelic-php-agent origin'
required: true
default: 'newrelic'
type: string
ref:
description: 'Branch or tag'
required: true
type: string
make-variant:
description: 'Builder image tag'
required: true
type: string
make-variant-version:
description: 'Builder image version'
required: true
type: string
make-target:
description: 'make target'
required: true
type: string
artifact-name:
description: 'Build artifact name'
required: true
type: string
artifact-pattern:
description: 'Build artifact pattern'
required: true
type: string
arch:
description: 'Target architecture'
required: true
type: string
runs-on:
description: 'runner type'
required: true
type: string

jobs:
make-target:
name: make ${{ inputs.make-target }} using ${{inputs.make-variant}} (${{ matrix.platform }}, ${{inputs.arch}})
runs-on: ${{inputs.runs-on}}
env:
IMAGE_NAME: newrelic/nr-php-agent-builder
IMAGE_TAG: make-${{inputs.make-variant}}
IMAGE_VERSION: ${{inputs.make-variant-version}}
strategy:
matrix:
platform: [gnu, musl]
steps:
- name: Checkout newrelic-php-agent code
uses: actions/checkout@v3
with:
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@v2
with:
image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}}
platforms: arm64
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build ${{inputs.make-target}}
run: >
docker run --rm --platform linux/${{inputs.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 ${{inputs.make-target}}
- name: Save ${{inputs.make-target}} artifact
uses: actions/upload-artifact@v3
with:
name: ${{inputs.artifact-name}}-${{matrix.platform}}-${{inputs.arch}}
path: php-agent/${{ inputs.artifact-pattern }}
99 changes: 99 additions & 0 deletions .github/workflows/make-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: _make-integration-tests

on:
workflow_call:
inputs:
origin:
description: 'newrelic-php-agent origin'
required: true
default: 'newrelic'
type: string
ref:
description: 'Branch or tag'
required: true
type: string
arch:
description: 'Target architecture'
required: true
type: string
continue-on-error:
description: 'Continue on error'
required: true
type: boolean
runs-on:
description: 'runner type'
required: true
type: string

jobs:
test-agent:
name: test agent (${{ matrix.platform }}, ${{ inputs.arch }}, ${{ matrix.php }})
runs-on: ${{inputs.runs-on}}
continue-on-error: ${{inputs.continue-on-error}}
strategy:
fail-fast: true
matrix:
platform: [gnu, musl]
php: ['8.0', '8.1', '8.2']
steps:
- name: Checkout integration tests
uses: actions/checkout@v3
with:
path: php-agent
repository: ${{ inputs.origin }}/newrelic-php-agent
ref: ${{ inputs.ref }}
- name: Get integration_runner
uses: actions/download-artifact@v3
with:
name: integration_runner-${{matrix.platform}}-${{inputs.arch}}
path: php-agent/bin
- name: Get newrelic.so
uses: actions/download-artifact@v3
with:
name: newrelic.so-${{matrix.platform}}-${{inputs.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: Enable arm64 emulation
if: ${{ inputs.arch == 'arm64' }}
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:${{vars.BINFMT_IMAGE_VERSION}}
platforms: arm64
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Start services
env:
PHP: ${{matrix.php}}
LIBC: ${{matrix.platform}}
PLATFORM: linux/${{inputs.arch}}
AGENT_CODE: ${{github.workspace}}/php-agent
IMAGE_VERSION: ${{vars.MAKE_PHP_VERSION}}
working-directory: ./php-agent
run: |
make test-services-start
- 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
Loading
Loading