diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 09887b676..afb8e5e27 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,8 +1,14 @@ name: main on: [push, pull_request] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + jobs: check-headers: + # PRs from branches of this repository are already tested by the push event + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository name: Check headers runs-on: ubuntu-latest steps: @@ -19,114 +25,29 @@ jobs: include name: Check public headers - Windows32: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test Windows (32bit) - with: - haxe: ${{ matrix.haxe }} - arch: 32 - sep: \ - ext: .dll - os: windows-latest - - Windows64: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test Windows (64bit) - with: - haxe: ${{ matrix.haxe }} - arch: 64 - sep: \ - ext: .dll - os: windows-latest - - WindowsArm64: + Test: + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository strategy: fail-fast: false matrix: + platform: [ Windows32, Windows64, WindowsArm64, MacOS64, MacOSArm, Linux32, Linux64, LinuxArm64 ] haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test Windows (Arm64) - with: - haxe: ${{ matrix.haxe }} - arch: Arm64 - sep: \ - ext: .dll - os: windows-11-arm - - MacOS64: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test MacOS (x86_64) - with: - haxe: ${{ matrix.haxe }} - arch: 64 - sep: / - ext: .dylib - os: macos-15-intel - - MacOSArm: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test MacOS (Arm64) - with: - haxe: ${{ matrix.haxe }} - arch: Arm64 - sep: / - ext: .dylib - os: macos-latest - - Linux32: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test Linux (32bit) - with: - haxe: ${{ matrix.haxe }} - arch: 32 - sep: / - ext: .dso - os: ubuntu-latest - - Linux64: - strategy: - fail-fast: false - matrix: - haxe: [ 4.3.7, latest ] - uses: ./.github/workflows/test.yml - name: Test Linux (64bit) - with: - haxe: ${{ matrix.haxe }} - arch: 64 - sep: / - ext: .dso - os: ubuntu-latest - - LinuxArm64: - strategy: - fail-fast: false - matrix: - haxe: [ latest ] # 4.3.7 doesn't have a linux arm build - uses: ./.github/workflows/test.yml - name: Test Linux (Arm64) - with: - haxe: ${{ matrix.haxe }} - arch: Arm64 - sep: / - ext: .dso - os: ubuntu-24.04-arm + exclude: + - platform: LinuxArm64 # 4.3.7 doesn't have a linux arm build + haxe: 4.3.7 + include: + - { platform: Windows32, name: Windows (32bit), arch: 32, ext: .dll, os: windows-latest } + - { platform: Windows64, name: Windows (64bit), arch: 64, ext: .dll, os: windows-latest } + - { platform: WindowsArm64, name: Windows (Arm64), arch: Arm64, ext: .dll, os: windows-11-arm } + - { platform: MacOS64, name: MacOS (x86_64), arch: 64, ext: .dylib, os: macos-15-intel } + - { platform: MacOSArm, name: MacOS (Arm64), arch: Arm64, ext: .dylib, os: macos-latest } + - { platform: Linux32, name: Linux (32bit), arch: 32, ext: .dso, os: ubuntu-latest } + - { platform: Linux64, name: Linux (64bit), arch: 64, ext: .dso, os: ubuntu-latest } + - { platform: LinuxArm64, name: Linux (Arm64), arch: Arm64, ext: .dso, os: ubuntu-24.04-arm } + uses: ./.github/workflows/test.yml + name: Test ${{ matrix.name }} (${{ matrix.haxe }}) + with: + haxe: ${{ matrix.haxe }} + arch: ${{ matrix.arch }} + ext: ${{ matrix.ext }} + os: ${{ matrix.os }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00386bd9f..25d241f7b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,9 +8,6 @@ on: arch: required: true type: string - sep: - required: true - type: string ext: required: true type: string @@ -21,163 +18,132 @@ on: env: HXCPP_ARCH_FLAG: ${{ inputs.arch == 'Arm64' && 'HXCPP_ARM64' || format('HXCPP_M{0}', inputs.arch) }} +defaults: + run: + shell: bash + +# Tests are grouped into a few jobs per platform to avoid paying the setup cost for each of them. +# Within a job, each test step runs as long as setup succeeded, so one failing test doesn't hide the others. jobs: - haxe: + runtime: runs-on: ${{ inputs.os }} - name: haxe - defaults: - run: - working-directory: test/haxe + name: runtime tests steps: - name: checkout uses: actions/checkout@v7 - name: setup + id: setup uses: ./.github/workflows/setup with: haxe: ${{ inputs.haxe }} arch: ${{ inputs.arch }} - - name: build - run: haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} - - name: run - run: bin${{ inputs.sep }}TestMain + - name: setup mariadb + if: runner.os == 'Linux' + run: | + set -ex + sudo apt-get update -qqy + sudo apt-get install -qqy mariadb-server + sudo systemctl start mariadb + sudo mariadb -u root -e "create database hxcpp; grant all privileges on hxcpp.* to hxcpp@localhost identified by 'hxcpp'; flush privileges;" + + - name: haxe + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/haxe + run: | + set -x + haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} + bin/TestMain + + - name: std + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/std + run: | + set -x + haxe compile${{ inputs.arch }}.hxml + ${{ inputs.arch == 'Arm64' && 'arm64' || format('cpp{0}', inputs.arch) }}/Test + + - name: native + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/native + run: | + set -x + haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} + bin/Native - cffi: + - name: regression + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/regression + run: haxe --run Run -D ${{ env.HXCPP_ARCH_FLAG }} + + tools: runs-on: ${{ inputs.os }} - name: cffi - defaults: - run: - working-directory: test/cffi + name: tooling tests steps: - name: checkout uses: actions/checkout@v7 - name: setup + id: setup uses: ./.github/workflows/setup with: haxe: ${{ inputs.haxe }} arch: ${{ inputs.arch }} - - name: build project - working-directory: test/cffi/project - run: haxelib run hxcpp build.xml -Ddebug -D${{ env.HXCPP_ARCH_FLAG }} - - name: build - run: haxe compile.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} - - name: build (utf8) - run: haxe compile-utf8.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} - - name: build (neko) - run: haxe compile-neko.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} - - name: copy - run: cp project/ndll/*/prime${{ inputs.ext }} bin/neko/prime.ndll - - name: run - run: bin${{ inputs.sep }}cpp${{ inputs.sep }}TestMain-debug - - name: run (utf8) - run: bin${{ inputs.sep }}cpp-utf8${{ inputs.sep }}TestMain-debug - - name: run (neko) - if: inputs.arch == '64' - working-directory: test/cffi/bin/neko - run: neko TestMain.n - telemetry: - strategy: - fail-fast: false - matrix: - mode: [ debug, release ] - include: - - suffix: -debug - mode: debug - runs-on: ${{ inputs.os }} - name: telemetry (${{ matrix.mode }}) - defaults: - run: + - name: cffi + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/cffi + run: | + set -x + (cd project && haxelib run hxcpp build.xml -Ddebug -D${{ env.HXCPP_ARCH_FLAG }}) + haxe compile.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} + haxe compile-utf8.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} + haxe compile-neko.hxml --debug -D ${{ env.HXCPP_ARCH_FLAG }} + cp project/ndll/*/prime${{ inputs.ext }} bin/neko/prime.ndll + bin/cpp/TestMain-debug + bin/cpp-utf8/TestMain-debug + if [ "${{ inputs.arch }}" = "64" ]; then + (cd bin/neko && neko TestMain.n) + fi + + - name: telemetry (debug) + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} working-directory: test/telemetry - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: build - run: haxe compile.hxml ${{ matrix.suffix }} -D ${{ env.HXCPP_ARCH_FLAG }} - - name: run - run: bin${{ inputs.sep }}TestMain${{ matrix.suffix }} + run: | + set -x + haxe compile.hxml -debug -D ${{ env.HXCPP_ARCH_FLAG }} + bin/TestMain-debug - debugger: - runs-on: ${{ inputs.os }} - name: debugger - defaults: - run: - working-directory: test/debugger - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: build - run: haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} - - name: run - run: bin${{ inputs.sep }}App-debug + - name: telemetry (release) + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/telemetry + run: | + set -x + haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} + bin/TestMain - native: - runs-on: ${{ inputs.os }} - name: native - defaults: - run: - working-directory: test/native - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: build - run: haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} - - name: run - run: bin${{ inputs.sep }}Native + - name: debugger + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/debugger + run: | + set -x + haxe compile.hxml -D ${{ env.HXCPP_ARCH_FLAG }} + bin/App-debug - std: - runs-on: ${{ inputs.os }} - name: std - defaults: - run: - working-directory: test/std - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: setup mariadb - if: runner.os == 'Linux' - run: | - set -ex - sudo apt-get update -qqy - sudo apt-get install -qqy mariadb-server - sudo systemctl start mariadb - sudo mariadb -u root -e "create database hxcpp; grant all privileges on hxcpp.* to hxcpp@localhost identified by 'hxcpp'; flush privileges;" - - name: build - run: haxe compile${{ inputs.arch }}.hxml - - name: run - run: ${{ inputs.arch == 'Arm64' && 'arm64' || format('cpp{0}', inputs.arch) }}${{ inputs.sep }}Test + - name: build tool + if: ${{ !cancelled() && steps.setup.outcome == 'success' }} + working-directory: test/cxx_standard + run: | + set -x + for xml in *.xml; do + haxelib run hxcpp $xml + haxelib run hxcpp $xml clean + done cppia: - strategy: - fail-fast: false - matrix: - mode: [ interp, jit ] - include: - - suffix: -jit - mode: jit runs-on: ${{ inputs.os }} - name: cppia (${{ matrix.mode }}) + name: cppia defaults: run: + shell: bash working-directory: test/cppia steps: - name: checkout @@ -191,14 +157,19 @@ jobs: run: haxe compile-host.hxml -D ${{ env.HXCPP_ARCH_FLAG }} - name: build client run: haxe compile-client.hxml -D ${{ env.HXCPP_ARCH_FLAG }} - - name: run - run: bin${{ inputs.sep }}CppiaHost bin${{ inputs.sep }}client.cppia ${{ matrix.suffix }} + - name: run (interp) + id: interp + run: bin/CppiaHost bin/client.cppia + - name: run (jit) + if: ${{ !cancelled() && steps.interp.outcome != 'skipped' }} + run: bin/CppiaHost bin/client.cppia -jit suite: runs-on: ${{ inputs.os }} name: haxe test suite defaults: run: + shell: bash working-directory: haxe/tests/unit steps: - name: checkout @@ -211,7 +182,6 @@ jobs: - name: Get Haxe commit SHA if: inputs.haxe == 'latest' id: haxe_sha - shell: bash working-directory: ${{github.workspace}} env: @@ -244,41 +214,4 @@ jobs: - name: build run: haxe compile-cpp.hxml -D ${{ env.HXCPP_ARCH_FLAG }} -D no_http - name: run - run: bin${{ inputs.sep }}cpp${{ inputs.sep }}TestMain-debug - - build_tool: - runs-on: ${{ inputs.os }} - name: build tool tests - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: test c/cxx_standard attributes - working-directory: test/cxx_standard - shell: bash - run: | - for xml in *.xml; do - haxelib run hxcpp $xml - haxelib run hxcpp $xml clean - done - - regression: - runs-on: ${{ inputs.os }} - name: regression tests - defaults: - run: - working-directory: test/regression - steps: - - name: checkout - uses: actions/checkout@v7 - - name: setup - uses: ./.github/workflows/setup - with: - haxe: ${{ inputs.haxe }} - arch: ${{ inputs.arch }} - - name: run - run: haxe --run Run -D ${{ env.HXCPP_ARCH_FLAG }} + run: bin/cpp/TestMain-debug