@@ -77,6 +77,135 @@ jobs:
7777
7878 - uses : actions/upload-artifact@v4
7979 with :
80- name : php-matrix. phar
80+ name : phar
8181 path : phar/php-matrix
8282 if-no-files-found : error
83+
84+ build :
85+ name : build (${{ matrix.runs-on }})
86+ needs : phar
87+ strategy :
88+ matrix :
89+ include :
90+ - runs-on : ubuntu-24.04-arm
91+ variant : linux_arm64
92+ spc-variant : linux-aarch64
93+ - runs-on : ubuntu-24.04
94+ variant : linux_amd64
95+ spc-variant : linux-x86_64
96+ - runs-on : macos-15
97+ variant : darwin_arm64
98+ spc-variant : macos-aarch64
99+ - runs-on : macos-15-intel
100+ variant : darwin_amd64
101+ spc-variant : macos-x86_64
102+ runs-on : ${{ matrix.runs-on }}
103+ steps :
104+ - uses : actions/checkout@v5
105+ with :
106+ sparse-checkout : craft.yml
107+ sparse-checkout-cone-mode : false
108+
109+ - name : Install spc
110+ run : |
111+ gh release download --repo crazywhalecc/static-php-cli --pattern "${PATTERN}" --output spc.tar.gz && \
112+ mkdir -p /tmp/spc && \
113+ tar -xvf spc.tar.gz --directory /tmp/spc && \
114+ echo "/tmp/spc" >> "$GITHUB_PATH"
115+ env :
116+ PATTERN : spc-${{ matrix.spc-variant }}.tar.gz
117+ GH_TOKEN : ${{ github.token }}
118+
119+ - uses : actions/download-artifact@v5
120+ with :
121+ name : phar
122+ path : phar
123+
124+ - name : Restore cached micro.sfx
125+ id : restore-micro-sfx
126+ uses : actions/cache/restore@v4
127+ with :
128+ path : buildroot/bin/micro.sfx
129+ key : micro-sfx-${{ runner.os }}-${{ runner.arch }}-${{ needs.phar.outputs.php-version }}-${{ hashFiles('craft.yml') }}
130+
131+ - name : Build micro.sfx
132+ if : steps.restore-micro-sfx.outputs.cache-hit != 'true'
133+ run : spc craft
134+ env :
135+ GITHUB_TOKEN : ${{ github.token }} # Not a typo.
136+
137+ - name : Cache micro.sfx
138+ id : cache-micro-sfx
139+ if : steps.restore-micro-sfx.outputs.cache-hit != 'true'
140+ uses : actions/cache/save@v4
141+ with :
142+ path : buildroot/bin/micro.sfx
143+ key : ${{ steps.restore-micro-sfx.outputs.cache-primary-key }}
144+
145+ - run : mkdir -p out
146+ - run : spc micro:combine phar/php-matrix --output out/php-matrix
147+
148+ - uses : actions/upload-artifact@v4
149+ with :
150+ name : php-matrix_${{ matrix.variant }}
151+ path : out/php-matrix
152+ if-no-files-found : error
153+
154+ e2e :
155+ name : e2e (${{ matrix.runs-on }})
156+ needs : build
157+ strategy :
158+ matrix :
159+ include :
160+ - runs-on : ubuntu-24.04-arm
161+ variant : linux_arm64
162+ - runs-on : ubuntu-24.04
163+ variant : linux_amd64
164+ - runs-on : macos-15
165+ variant : darwin_arm64
166+ - runs-on : macos-15-intel
167+ variant : darwin_amd64
168+ runs-on : ${{ matrix.runs-on }}
169+ env :
170+ GOFLAGS : ' -mod=mod'
171+ steps :
172+ - uses : actions/checkout@v5
173+
174+ - uses : actions/setup-go@v6
175+ with :
176+ go-version-file : ' go.mod'
177+
178+ - run : echo OS="$(go env GOOS)" >> $GITHUB_ENV
179+ - run : echo ARCH="$(go env GOARCH)" >> $GITHUB_ENV
180+
181+ - uses : actions/download-artifact@v5
182+ with :
183+ name : php-matrix_${{ matrix.variant }}
184+ path : out
185+
186+ - name : Grant the binary execute permission
187+ run : chmod +x out/php-matrix
188+
189+ - name : Add the binary into PATH
190+ run : echo "${WORKSPACE}/out" >> "$GITHUB_PATH"
191+ env :
192+ WORKSPACE : ${{ github.workspace }}
193+
194+ - name : Print the binary path
195+ run : go test -count=1 -v ./internal
196+
197+ - run : go test -count=1 ./...
198+
199+ merge :
200+ needs :
201+ - build
202+ - e2e
203+ runs-on : ubuntu-24.04
204+ steps :
205+ - name : Merge binary artifacts
206+ uses : actions/upload-artifact/merge@v4
207+ with :
208+ name : binaries
209+ pattern : php-matrix_*
210+ separate-directories : true
211+ delete-merged : true
0 commit comments