Skip to content

Commit a304f70

Browse files
committed
wip
1 parent f7fbbc0 commit a304f70

1 file changed

Lines changed: 37 additions & 66 deletions

File tree

.github/workflows/test.yml

Lines changed: 37 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -85,76 +85,34 @@ jobs:
8585
needs: phar
8686
strategy:
8787
matrix:
88-
runs-on:
89-
- ubuntu-24.04-arm
90-
- ubuntu-24.04
91-
- macos-15
92-
- macos-15-intel
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
93101
runs-on: ${{ matrix.runs-on }}
94102
steps:
95103
- uses: actions/checkout@v5
96104
with:
97105
sparse-checkout: craft.yml
98106
sparse-checkout-cone-mode: false
99107

100-
- run: echo OS=linux >> $GITHUB_ENV
101-
if: runner.os == 'Linux'
102-
shell: bash
103-
- run: echo OS=darwin >> $GITHUB_ENV
104-
if: runner.os == 'macOS'
105-
shell: bash
106-
- run: |
107-
echo "::error title=Unable to determine OS::Unexpected runner.os '${RUNNER_OS}'"
108-
exit 1
109-
if: env.OS == ''
110-
env:
111-
RUNNER_OS: ${{ runner.os }}
112-
shell: bash
113-
114-
- run: echo ARCH=arm64 >> $GITHUB_ENV
115-
if: runner.arch == 'ARM64'
116-
shell: bash
117-
- run: echo ARCH=amd64 >> $GITHUB_ENV
118-
if: runner.arch == 'X64'
119-
shell: bash
120-
- run: |
121-
echo "::error title=Unable to determine ARCH::Unexpected runner.arch '${RUNNER_ARCH}'"
122-
exit 1
123-
if: env.ARCH == ''
124-
env:
125-
RUNNER_ARCH: ${{ runner.arch }}
126-
shell: bash
127-
128-
- run: echo SPC_OS=linux >> $GITHUB_ENV
129-
if: runner.os == 'Linux'
130-
- run: echo SPC_OS=macos >> $GITHUB_ENV
131-
if: runner.os == 'macOS'
132-
- run: |
133-
echo "::error title=Unable to determine SPC_OS::Unexpected runner.os '${RUNNER_OS}'"
134-
exit 1
135-
if: env.SPC_OS == ''
136-
env:
137-
RUNNER_OS: ${{ runner.os }}
138-
139-
- run: echo SPC_ARCH=aarch64 >> $GITHUB_ENV
140-
if: runner.arch == 'ARM64'
141-
- run: echo SPC_ARCH=x86_64 >> $GITHUB_ENV
142-
if: runner.arch == 'X64'
143-
- run: |
144-
echo "::error title=Unable to determine SPC_ARCH::Unexpected runner.arch '${RUNNER_ARCH}'"
145-
exit 1
146-
if: env.SPC_ARCH == ''
147-
env:
148-
RUNNER_ARCH: ${{ runner.arch }}
149-
150108
- name: Install spc
151109
run: |
152110
gh release download --repo crazywhalecc/static-php-cli --pattern "${PATTERN}" --output spc.tar.gz && \
153111
mkdir -p /tmp/spc && \
154112
tar -xvf spc.tar.gz --directory /tmp/spc && \
155113
echo "/tmp/spc" >> "$GITHUB_PATH"
156114
env:
157-
PATTERN: spc-${{ env.SPC_OS }}-${{ env.SPC_ARCH }}.tar.gz
115+
PATTERN: spc-${{ matrix.spc-variant }}.tar.gz
158116
GH_TOKEN: ${{ github.token }}
159117

160118
- uses: actions/download-artifact@v5
@@ -188,19 +146,23 @@ jobs:
188146

189147
- uses: actions/upload-artifact@v4
190148
with:
191-
name: php-matrix_${{ env.OS }}_${{ env.ARCH }}
149+
name: php-matrix_${{ matrix.variant }}
192150
path: out/php-matrix
193151
if-no-files-found: error
194152

195153
e2e:
196154
needs: build
197155
strategy:
198156
matrix:
199-
runs-on:
200-
- ubuntu-24.04-arm
201-
- ubuntu-24.04
202-
- macos-15
203-
- macos-15-intel
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
204166
runs-on: ${{ matrix.runs-on }}
205167
env:
206168
GOFLAGS: '-mod=mod'
@@ -211,15 +173,12 @@ jobs:
211173
with:
212174
go-version-file: 'go.mod'
213175

214-
# TODO!
215-
- run: echo "${GOOS}_${GOARCH}"
216-
217176
- run: echo OS="$(go env GOOS)" >> $GITHUB_ENV
218177
- run: echo ARCH="$(go env GOARCH)" >> $GITHUB_ENV
219178

220179
- uses: actions/download-artifact@v5
221180
with:
222-
name: php-matrix_${{ env.OS }}_${{ env.ARCH }}
181+
name: php-matrix_${{ matrix.variant }}
223182
path: out
224183

225184
- name: Grant php-matrix binary execute permission
@@ -234,3 +193,15 @@ jobs:
234193
run: go test -count=1 -v ./internal
235194

236195
- 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+
separate-directories: true
207+
delete-merged: true

0 commit comments

Comments
 (0)