-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (127 loc) · 3.63 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: CI
on:
pull_request:
branches:
- forked/master
push:
branches:
- forked/master
- issue/*
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
wp-multisite:
- '0'
- '1'
wp-version:
- latest
- trunk
steps:
- uses: actions/checkout@main
- name: set PHP_VERSION
run: echo "PHP_VERSION=${{matrix.php-version}}" >> $GITHUB_ENV
- name: set WP_VERSION
run: echo "WP_VERSION=${{matrix.wp-version}}" >> $GITHUB_ENV
- name: set WP_MULTISITE
run: echo "WP_MULTISITE=${{matrix.wp-multisite}}" >> $GITHUB_ENV
- run: build/build-image
- run: build/run-test
- name: Upload Test Logs
if: always()
uses: actions/upload-artifact@main
with:
name: test-logs-php${{matrix.php-version}}-wp${{matrix.wp-version}}-ms${{matrix.wp-multisite}}
path: work/test-logs
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@main
with:
name: test-result-php${{matrix.php-version}}-wp${{matrix.wp-version}}-ms${{matrix.wp-multisite}}
path: work/test-result.xml
publish-test:
name: Publish Unit Tests Results
needs: test
runs-on: ubuntu-latest
if: success() || failure()
steps:
- uses: actions/download-artifact@main
with:
path: artifacts
- name: Show artifacts
run: ls -laR ./
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@master
with:
check_name: Unit Test Results
github_token: ${{secrets.GITHUB_TOKEN}}
files: ./**/test-result.xml
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Generate build number
uses: onyxmueller/build-tag-number@main
with:
token: ${{secrets.GITHUB_TOKEN}}
prefix: build_number_generator
- name: Print new build number
run: echo "Build number is $BUILD_NUMBER"
- name: Save the build number
run: echo "$BUILD_NUMBER" > work/BUILD_NUMBER
- name: Print new build number
run: echo "build-$BUILD_NUMBER" > ./VERSION
- run: build/build-image
- run: build/run-package
- uses: actions/upload-artifact@main
with:
name: artifact
path: work/cavalcade-runner.zip
- uses: actions/upload-artifact@main
with:
name: build-number
path: work/BUILD_NUMBER
release:
env:
# Hide warning: "Context access might be invalid: BUILD_NUMBER"
BUILD_NUMBER: null
needs:
- test
- build
if: github.ref == 'refs/heads/forked/master'
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@main
with:
name: artifact
- uses: actions/download-artifact@main
with:
name: build-number
- name: Show artifacts
run: ls -laR ./
- name: set BUILD_NUMBER
run: echo "BUILD_NUMBER=$(< ./BUILD_NUMBER)" >> $GITHUB_ENV
- id: create_release
uses: actions/create-release@main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
tag_name: build-${{env.BUILD_NUMBER}}
release_name: Build ${{env.BUILD_NUMBER}}
draft: false
prerelease: false
- uses: actions/upload-release-asset@main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
upload_url: ${{steps.create_release.outputs.upload_url}}
asset_path: ./cavalcade-runner.zip
asset_name: cavalcade-runner.build-${{env.BUILD_NUMBER}}.zip
asset_content_type: application/zip