Skip to content

Commit 390bb2a

Browse files
authored
Migrate Jenkinsfile to GH Actions Workflow (#41)
* Migrate Jenkinsfile to GH Actions Workflow * Add test-reporter * Add release * Remove jenkins related configs * Remove unnecessary hooks * Remove Jenkinsfile
1 parent 3f53ea1 commit 390bb2a

File tree

8 files changed

+91
-236
lines changed

8 files changed

+91
-236
lines changed

.ci/Jenkinsfile

Lines changed: 0 additions & 167 deletions
This file was deleted.

.ci/jobs/defaults.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.

.ci/jobs/ecs-logging-php-mbp.yml

Lines changed: 0 additions & 5 deletions
This file was deleted.

.github/workflows/opentelemetry.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ on:
55
workflow_run:
66
workflows:
77
- test
8+
- test-reporter
89
- update-specs
10+
- release
911
types: [completed]
1012

1113
jobs:

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- v?[0-9]+.[0-9]+.[0-9]+
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
test:
13+
uses: ./.github/workflows/test.yml
14+
release:
15+
needs:
16+
- test
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: release
20+
run: make -f .ci/Makefile release
21+
env:
22+
GITHUB_TOKEN: ${{ github.token }}
23+
TAG_NAME: ${{ github.ref_name }}
24+
notify:
25+
runs-on: ubuntu-latest
26+
if: always()
27+
needs:
28+
- release
29+
steps:
30+
- run: test $(echo '${{ toJSON(needs) }}' | jq -s 'map(.[].result) | all(.=="success")') = 'true'
31+
- if: always()
32+
uses: elastic/apm-pipeline-library/.github/actions/notify-build-status@current
33+
with:
34+
vaultUrl: ${{ secrets.VAULT_ADDR }}
35+
vaultRoleId: ${{ secrets.VAULT_ROLE_ID }}
36+
vaultSecretId: ${{ secrets.VAULT_SECRET_ID }}
37+
slackChannel: "#apm-agent-php"

.github/workflows/test-reporter.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
## Workflow to process the JUnit test results and add a report to the checks.
3+
name: test-reporter
4+
on:
5+
workflow_run:
6+
workflows:
7+
- test
8+
types:
9+
- completed
10+
11+
jobs:
12+
report:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: elastic/apm-pipeline-library/.github/actions/test-report@current
16+
with:
17+
artifact: test-results # artifact name
18+
name: test-report # Name of the check run which will be created
19+
path: "junit-*.xml" # Path to test results (inside artifact .zip)
20+
reporter: java-junit # Format of test results

.github/workflows/test.yml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,36 @@ permissions:
1313
contents: read
1414

1515
jobs:
16-
hello:
16+
sanity-checks:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- run: echo "Hello, World!"
19+
- uses: elastic/apm-pipeline-library/.github/actions/pre-commit@current
20+
test:
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
php-image:
25+
- 7.2-alpine
26+
- 7.3-alpine
27+
- 7.4-alpine
28+
- 8.0-alpine
29+
- 8.1-alpine
30+
- 8.2-alpine
31+
runs-on: ubuntu-latest
32+
container: php:${{ matrix.php-image }}
33+
steps:
34+
- uses: actions/checkout@v3
35+
- name: Append PATH
36+
run: echo "${GITHUB_WORKSPACE}" >> $GITHUB_PATH
37+
- name: Install composer
38+
run: .ci/scripts/install-composer.sh
39+
- name: Install dependencies
40+
run: composer --no-progress install
41+
- name: Run tests
42+
env:
43+
VERSION: ${{ matrix.php-image }}
44+
run: composer test
45+
- uses: actions/upload-artifact@v3
46+
with:
47+
name: test-results
48+
path: junit-*.xml

.pre-commit-config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@ repos:
66
- id: check-executables-have-shebangs
77
- id: check-merge-conflict
88

9-
- repo: git@github.com:elastic/apm-pipeline-library
9+
- repo: https://github.com/elastic/apm-pipeline-library
1010
rev: current
1111
hooks:
1212
- id: check-bash-syntax
13-
- id: check-jenkins-pipelines
14-
- id: check-jjbb

0 commit comments

Comments
 (0)