Skip to content

Commit

Permalink
Migrate Jenkinsfile to GH Actions Workflow (#41)
Browse files Browse the repository at this point in the history
* Migrate Jenkinsfile to GH Actions Workflow

* Add test-reporter

* Add release

* Remove jenkins related configs

* Remove unnecessary hooks

* Remove Jenkinsfile
  • Loading branch information
reakaleek authored Feb 22, 2023
1 parent 3f53ea1 commit 390bb2a
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 236 deletions.
167 changes: 0 additions & 167 deletions .ci/Jenkinsfile

This file was deleted.

59 changes: 0 additions & 59 deletions .ci/jobs/defaults.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .ci/jobs/ecs-logging-php-mbp.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/opentelemetry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ on:
workflow_run:
workflows:
- test
- test-reporter
- update-specs
- release
types: [completed]

jobs:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: release

on:
push:
tags:
- v?[0-9]+.[0-9]+.[0-9]+

permissions:
contents: write

jobs:
test:
uses: ./.github/workflows/test.yml
release:
needs:
- test
runs-on: ubuntu-latest
steps:
- name: release
run: make -f .ci/Makefile release
env:
GITHUB_TOKEN: ${{ github.token }}
TAG_NAME: ${{ github.ref_name }}
notify:
runs-on: ubuntu-latest
if: always()
needs:
- release
steps:
- run: test $(echo '${{ toJSON(needs) }}' | jq -s 'map(.[].result) | all(.=="success")') = 'true'
- if: always()
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
with:
vaultUrl: ${{ secrets.VAULT_ADDR }}
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
slackChannel: "#apm-agent-php"
20 changes: 20 additions & 0 deletions .github/workflows/test-reporter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
## Workflow to process the JUnit test results and add a report to the checks.
name: test-reporter
on:
workflow_run:
workflows:
- test
types:
- completed

jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: elastic/apm-pipeline-library/.github/actions/test-report@current
with:
artifact: test-results # artifact name
name: test-report # Name of the check run which will be created
path: "junit-*.xml" # Path to test results (inside artifact .zip)
reporter: java-junit # Format of test results
33 changes: 31 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,36 @@ permissions:
contents: read

jobs:
hello:
sanity-checks:
runs-on: ubuntu-latest
steps:
- run: echo "Hello, World!"
- uses: elastic/apm-pipeline-library/.github/actions/pre-commit@current
test:
strategy:
fail-fast: false
matrix:
php-image:
- 7.2-alpine
- 7.3-alpine
- 7.4-alpine
- 8.0-alpine
- 8.1-alpine
- 8.2-alpine
runs-on: ubuntu-latest
container: php:${{ matrix.php-image }}
steps:
- uses: actions/checkout@v3
- name: Append PATH
run: echo "${GITHUB_WORKSPACE}" >> $GITHUB_PATH
- name: Install composer
run: .ci/scripts/install-composer.sh
- name: Install dependencies
run: composer --no-progress install
- name: Run tests
env:
VERSION: ${{ matrix.php-image }}
run: composer test
- uses: actions/upload-artifact@v3
with:
name: test-results
path: junit-*.xml
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ repos:
- id: check-executables-have-shebangs
- id: check-merge-conflict

- repo: git@github.com:elastic/apm-pipeline-library
- repo: https://github.com/elastic/apm-pipeline-library
rev: current
hooks:
- id: check-bash-syntax
- id: check-jenkins-pipelines
- id: check-jjbb

0 comments on commit 390bb2a

Please sign in to comment.