-
-
Notifications
You must be signed in to change notification settings - Fork 4
154 lines (135 loc) · 5.05 KB
/
cache.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Cache PHP
on:
- push
- workflow_dispatch
jobs:
cache:
container: ubuntu:${{ matrix.container }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container: [22.04, 20.04]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
builds: ['debug', 'release']
libs: ['true', 'false']
if: "!contains(github.event.head_commit.message, 'skip-cache')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install requirements
run: bash scripts/install-requirements.sh
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
LIBS: ${{ matrix.libs }}
- name: Get ZSTD_DIR
id: zstd
run: echo "ZSTD_DIR=zstd-$(curl -sL https://github.com/facebook/zstd/releases/latest | grep -Po "tree/v(\d+\.\d+\.\d+)" | cut -d'v' -f 2 | head -n 1)" | tee -a "$GITHUB_OUTPUT"
- name: Add ZSTD
env:
CONTAINER: ${{ matrix.container }}
REPO: ${{ github.repository }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}
USER: ${{ github.repository_owner }}
ZSTD_DIR: ${{ steps.zstd.outputs.ZSTD_DIR }}
run: bash scripts/install-zstd.sh
- name: Configure git
run: bash scripts/configure-git.sh
- name: Setup PHP
env:
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
run: bash scripts/install-php.sh
- name: Build package
env:
GITHUB_WORKSPACE: ${{ github.workspace }}
PHP_VERSION: ${{ matrix.php-versions }}
BUILDS: ${{ matrix.builds }}
LIBS: ${{ matrix.libs }}
run: bash scripts/package.sh
- name: Upload zstd Artifact
if: matrix.php-versions == '8.0'
uses: actions/upload-artifact@v3
with:
name: ${{ steps.zstd.outputs.zstd_dir }}-ubuntu${{ matrix.container }}
path: /opt/zstd
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.php-versions }}
path: builds
tests:
runs-on: ${{ matrix.os }}
needs: cache
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
builds: ['debug', 'release']
if: "!contains(github.event.head_commit.message, 'skip-tests')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: ${{ matrix.php-versions }}
path: /tmp
- name: Patch script
run: sed -i -e '/releases/d' -e '1s/$/\n\nset -x/' scripts/install.sh
- name: Setup PHP
run: bash scripts/install.sh ${{ matrix.php-versions }} ${{ matrix.builds }}
- name: Switch versions
run: |
sudo update-alternatives --set php-cgi-bin /usr/lib/cgi-bin/php${{ matrix.php-versions }}
sudo update-alternatives --set php-fpm /usr/sbin/php-fpm${{ matrix.php-versions }}
sudo update-alternatives --set php-fpm.sock /run/php/php${{ matrix.php-versions }}-fpm.sock
for tool in phpize php-config phpdbg php-cgi php phar.phar phar; do
sudo update-alternatives --set "$tool" /usr/bin/"$tool"${{ matrix.php-versions }}
done
- name: Test PHP
run: |
file /usr/bin/php${{ matrix.php-versions }}
php -v
php-config --version
php-fpm -v
php-cgi -v
phpize -v
php -m
sudo service php${{ matrix.php-versions }}-fpm status || exit 1
php -v | grep -q '${{ matrix.php-versions }}' || exit 1
php-config --version | grep -q '${{ matrix.php-versions }}' || exit 1
phpize -v | grep -q "$(php-config --phpapi)" || exit 1
php-fpm -v | grep -q '${{ matrix.php-versions }}' || exit 1
php-cgi -v | grep -q '${{ matrix.php-versions }}' || exit 1
- name: Test broken packages
run: sudo apt-get check
release:
runs-on: ubuntu-latest
needs: [cache, tests]
if: "!contains(github.event.head_commit.message, 'skip-release')"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create builds directory
run: mkdir builds
- name: Download artifacts
uses: actions/download-artifact@v3
with:
path: builds
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Install cloudsmith-cli
run: pip install --upgrade cloudsmith-cli
- name: Release
run: bash scripts/release.sh
env:
CLOUDSMITH_API_KEY: ${{ secrets.CLOUDSMITH_API_KEY }}
GITHUB_MESSAGE: ${{ github.event.head_commit.message }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKSPACE: ${{ github.workspace }}