Update toolings #363
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test | |
| on: | |
| workflow_call: | |
| workflow_dispatch: | |
| pull_request: | |
| branches: | |
| - main | |
| push: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| pest: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # master | |
| with: | |
| php-version: '8.5' | |
| coverage: xdebug | |
| - uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0 | |
| - run: composer pest:unit -- --coverage-clover coverage-unit.xml --ci | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| path: coverage-unit.xml | |
| archive: false | |
| if-no-files-found: error | |
| codecov: | |
| needs: pest | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: coverage-unit.xml | |
| - uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| use_oidc: true | |
| fail_ci_if_error: true | |
| disable_search: true | |
| files: coverage-unit.xml | |
| phar: | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| php-version: ${{ steps.setup-php.outputs.php-version }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 | |
| id: setup-php | |
| with: | |
| php-version: '8.5' | |
| coverage: none | |
| tools: box:4 | |
| - uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0 | |
| with: | |
| composer-options: --no-dev --prefer-dist | |
| - run: box compile | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| path: phar/php-matrix | |
| archive: false | |
| if-no-files-found: error | |
| build: | |
| name: build (${{ matrix.runs-on }}) | |
| needs: phar | |
| strategy: | |
| matrix: &matrix | |
| include: | |
| - runs-on: ubuntu-24.04-arm | |
| variant: linux_arm64 | |
| spc-variant: linux-aarch64 | |
| - runs-on: ubuntu-24.04 | |
| variant: linux_amd64 | |
| spc-variant: linux-x86_64 | |
| - runs-on: macos-15 | |
| variant: darwin_arm64 | |
| spc-variant: macos-aarch64 | |
| - runs-on: macos-15-intel | |
| variant: darwin_amd64 | |
| spc-variant: macos-x86_64 | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| sparse-checkout: craft.yml | |
| sparse-checkout-cone-mode: false | |
| - name: Install spc | |
| run: | | |
| gh release download --repo crazywhalecc/static-php-cli --pattern "${PATTERN}" --output spc.tar.gz && \ | |
| mkdir -p /tmp/spc && \ | |
| tar -xvf spc.tar.gz --directory /tmp/spc && \ | |
| echo "/tmp/spc" >> "$GITHUB_PATH" | |
| env: | |
| PATTERN: spc-${{ matrix.spc-variant }}.tar.gz | |
| GH_TOKEN: ${{ github.token }} | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: php-matrix | |
| path: phar | |
| - name: Restore cached micro.sfx | |
| id: restore-micro-sfx | |
| uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: buildroot/bin/micro.sfx | |
| key: micro-sfx-${{ runner.os }}-${{ runner.arch }}-${{ needs.phar.outputs.php-version }}-${{ hashFiles('craft.yml') }} | |
| - name: Build micro.sfx | |
| if: steps.restore-micro-sfx.outputs.cache-hit != 'true' | |
| run: spc craft | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} # Not a typo. | |
| - name: Cache micro.sfx | |
| id: cache-micro-sfx | |
| if: steps.restore-micro-sfx.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |
| with: | |
| path: buildroot/bin/micro.sfx | |
| key: ${{ steps.restore-micro-sfx.outputs.cache-primary-key }} | |
| - run: mkdir -p out | |
| - run: spc micro:combine phar/php-matrix --output out/php-matrix | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: php-matrix_${{ matrix.variant }} | |
| path: out/php-matrix | |
| if-no-files-found: error | |
| e2e: | |
| name: e2e (${{ matrix.runs-on }}) | |
| needs: build | |
| strategy: | |
| matrix: *matrix | |
| runs-on: ${{ matrix.runs-on }} | |
| env: | |
| GOFLAGS: '-mod=mod' | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |
| with: | |
| go-version-file: 'go.mod' | |
| - run: echo OS="$(go env GOOS)" >> "$GITHUB_ENV" | |
| - run: echo ARCH="$(go env GOARCH)" >> "$GITHUB_ENV" | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: php-matrix_${{ matrix.variant }} | |
| path: out | |
| - name: Grant the binary execute permission | |
| run: chmod +x out/php-matrix | |
| - name: Add the binary into PATH | |
| run: echo "${WORKSPACE}/out" >> "$GITHUB_PATH" | |
| env: | |
| WORKSPACE: ${{ github.workspace }} | |
| - name: Print the binary path | |
| run: go test -count=1 -v ./internal | |
| - run: go test -count=1 -shuffle=on ./... |