Do not build linux binaries on release #1
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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| check-dev-version: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/master' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Check PHP_RAR_VERSION ends in -dev | |
| run: | | |
| HEADER_VERSION=$(grep -oP '(?<=#define PHP_RAR_VERSION ")[^"]+' php_rar.h) | |
| echo "Header version: $HEADER_VERSION" | |
| if [[ "$HEADER_VERSION" != *-dev ]]; then | |
| echo "ERROR: PHP_RAR_VERSION ($HEADER_VERSION) does not end in -dev on master" | |
| exit 1 | |
| fi | |
| generate-matrix: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.set-matrix.outputs.matrix }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - id: set-matrix | |
| run: | | |
| python3 <<'EOF' | |
| import yaml, json, os | |
| with open('.github/docker-image-shas.yml') as f: | |
| data = yaml.safe_load(f) | |
| image = 'datadog/dd-appsec-php-ci' | |
| includes = [] | |
| for tag, sha in data[image].items(): | |
| # tag: "php-7.0-debug" or "php-7.0-release-zts" | |
| ver, variant = tag[len('php-'):].split('-', 1) | |
| includes.append({'php': ver, 'variant': variant, 'image_sha': sha}) | |
| with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | |
| f.write('matrix=' + json.dumps({'include': includes}) + '\n') | |
| EOF | |
| linux: | |
| name: PHP ${{ matrix.php }} (${{ matrix.variant }}) | |
| needs: generate-matrix | |
| runs-on: ubuntu-latest | |
| container: | |
| image: datadog/dd-appsec-php-ci@${{ matrix.image_sha }} | |
| options: --user root | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build and test | |
| run: bash .github/scripts/build-and-test.sh | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-php${{ matrix.php }}-${{ matrix.variant }} | |
| path: report.xml | |
| windows: | |
| name: Windows PHP 8.1 TS | |
| runs-on: windows-2022 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Build and test | |
| uses: php/php-windows-builder/extension@v1 | |
| with: | |
| php-version: '8.1' | |
| arch: x64 | |
| ts: ts | |
| args: --enable-rar=shared | |
| test-runner: ${{ github.workspace }}/run-tests-rar.php | |
| test-workers: 1 | |
| - name: Upload test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-windows-php8.1-ts | |
| path: '*.xml' |