forked from NoiseByNorthwest/php-spx
-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (117 loc) · 4.33 KB
/
Copy pathmain.yml
File metadata and controls
137 lines (117 loc) · 4.33 KB
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
133
134
135
136
137
name: CI
on:
push:
branches:
- '**'
tags:
- '*'
paths-ignore:
- '**.md'
- '**.txt'
pull_request:
branches:
- master
jobs:
build:
name: build / php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.compiler }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php: [ '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5' ]
name:
- linux
- debian
- mac
include:
# Linux
- { name: linux, ts: 'nts', compiler: 'gcc', os: ubuntu-22.04 }
# Debian (docker)
- { name: debian, ts: 'nts', compiler: 'gcc', os: ubuntu-22.04 }
# macOS
- { name: mac, ts: 'nts', compiler: 'clang', os: macos-14 }
exclude:
# PHP 8.5 is temporarily excluded for Debian builds.
# Once it is available in the official packages from Ondřej Surý (packages.sury.org),
# this exclusion can be removed.
- { name: debian, php: '8.5' }
# PHP 5.4 and 5.5 are not compatible with macos-14 (ARM64) runners.
- { name: mac, php: '5.4' }
- { name: mac, php: '5.5' }
env:
DOCKER_BUILD_RECORD_UPLOAD: false # disable docker buildx record upload as build artifact
DOCKER_BUILD_SUMMARY: false # disable docker buildx summary
steps:
- uses: actions/checkout@v4
# configure spx artifact name in next format:
# {php}-{ts}-{os.name}-{compiler}
# spx-php-8.1-nts-linux-gcc
- name: Set artifact name
id: setup-artifact
run: |
echo "spx_file_name=spx-php-${{ matrix.php }}-${{ matrix.ts }}-${{ matrix.name }}-${{ matrix.compiler }}" >> $GITHUB_OUTPUT
- name: Build extension for Ubuntu and macOS
if: matrix.name != 'debian'
uses: ./.github/workflows/build-linux-mac-ext
- name: Build extension for Debian using docker
if: matrix.name == 'debian' && matrix.php != '5.4' && matrix.php != '5.5'
uses: ./.github/workflows/build-debian-ext
- name: Upload build artifacts after Failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: debug-${{ steps.setup-artifact.outputs.spx_file_name }}
path: |
${{ github.workspace }}/*.log
${{ github.workspace }}/tests/*.log
retention-days: 7
- name: Create ZIP archive with build artifact
run: |
zip -rvj ${{ steps.setup-artifact.outputs.spx_file_name }}.zip \
./modules/spx.so LICENSE $ZIP_EXCLUDE
zip -rv ${{ steps.setup-artifact.outputs.spx_file_name }}.zip \
./assets $ZIP_EXCLUDE
env:
ZIP_EXCLUDE: -x ".*" -x "__MACOSX" -x "*.DS_Store"
- name: Check Release notes
run: |
echo "-- Parsing Release Notes from CHANGELOG"
./.github/release-notes.sh ./CHANGELOG.md
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: ${{ steps.setup-artifact.outputs.spx_file_name }}.zip
path: ${{ steps.setup-artifact.outputs.spx_file_name }}.zip
release:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
needs: [ build ]
name: Create Release
runs-on: ubuntu-22.04
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Get the release version
id: get-version
run: |
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Download SPX build artifacts
id: download
uses: actions/download-artifact@v4
with:
path: ./build-artifacts
- name: Prepare Release notes
run: |
echo "-- Creating Release Notes"
./.github/release-notes.sh ./CHANGELOG.md > ./release-notes.md
- name: Create Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
name: ${{ steps.get-version.outputs.version }}
tag: ${{ steps.get-version.outputs.version }}
bodyFile: "./release-notes.md"
allowUpdates: true
artifacts: "./build-artifacts/*/*.zip"
artifactContentType: application/octet-stream