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