Skip to content

Commit adda3ac

Browse files
Jens-Gclaude
andcommitted
CI: replace Travis with GitHub Actions multi-target matrix
Adds .github/workflows/ci.yml that runs tests on JS, Neko, PHP, and Java via a parallel matrix (fail-fast: false) on push to master/release-* and on pull requests. C++ is included as a commented-out entry. Removes the defunct .travis.yml and adds per-target hxml files for local use. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 009646a commit adda3ac

12 files changed

Lines changed: 328 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 'release-*'
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
name: Test (${{ matrix.target }})
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
- target: js
19+
hxml: tests.hxml
20+
- target: neko
21+
hxml: tests-neko.hxml
22+
- target: php
23+
hxml: tests-php.hxml
24+
apt: php-cli
25+
- target: java
26+
hxml: tests-java.hxml
27+
# C++ is slow (3-5 min compile via hxcpp) — uncomment to enable:
28+
# - target: cpp
29+
# hxml: tests-cpp.hxml
30+
# haxelib: hxcpp
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Set up Haxe
36+
uses: krdlab/setup-haxe@v1
37+
with:
38+
haxe-version: latest
39+
40+
- name: Install utest
41+
run: haxelib install utest
42+
43+
- name: Install system dependencies
44+
if: matrix.apt
45+
run: sudo apt-get install -y ${{ matrix.apt }}
46+
47+
- name: Install haxelib dependencies
48+
if: matrix.haxelib
49+
run: haxelib install ${{ matrix.haxelib }}
50+
51+
- name: Run tests
52+
run: haxe ${{ matrix.hxml }}

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
schema: spec-driven
2+
created: 2026-05-07
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Context
2+
3+
The project currently has a `.travis.yml` targeting Haxe 3.2.1 and `development`, running only `tests.hxml` (JS). Travis CI's free tier for open-source projects has been effectively discontinued. The recent migration from `haxe.unit` to `utest` makes the old config incompatible anyway. GitHub Actions is the natural replacement — it's free, integrated, and widely supported.
4+
5+
The test suite compiles Haxe to multiple targets and runs the output. Each target has slightly different system requirements (Node.js, PHP CLI, JDK, Neko, g++/hxcpp).
6+
7+
## Goals / Non-Goals
8+
9+
**Goals:**
10+
- Replace `.travis.yml` with a working GitHub Actions workflow
11+
- Run tests on JS, Neko, PHP, and Java in a parallel matrix
12+
- Trigger on push to `master` and `release-*` branches, and on all pull requests
13+
- Include C++ in the matrix config but leave it commented out (too slow for default CI)
14+
- Keep per-target build config in hxml files, not inline in the workflow YAML
15+
16+
**Non-Goals:**
17+
- Publishing/deployment automation (handled separately by `deploy.sh`)
18+
- Cross-OS matrix (linux is sufficient for a crypto library with no platform-specific code)
19+
- Caching Haxe compilation output (low value for this size of project)
20+
- Code coverage or artifact upload
21+
22+
## Decisions
23+
24+
### Per-target hxml files over inline YAML flags
25+
26+
**Decision**: Create `tests-neko.hxml`, `tests-php.hxml`, `tests-java.hxml`, `tests-cpp.hxml` alongside the existing `tests.hxml`.
27+
28+
**Rationale**: The project already uses hxml files as the canonical build config (`tests.hxml`, `tests_all.hxml`, `tests_native.hxml`). Keeping target definitions in hxml is consistent with that pattern and allows developers to run any single target locally without reading the CI YAML. Inline YAML flags would split build config across two systems.
29+
30+
### `krdlab/setup-haxe` with `haxe-version: latest`
31+
32+
**Decision**: Use the `krdlab/setup-haxe` community action pinned to a recent version, requesting latest stable Haxe.
33+
34+
**Rationale**: This is the established action for Haxe CI. It installs both Haxe and Neko. `latest` tracks the stable release without requiring manual version bumps.
35+
36+
### C++ commented out, not removed
37+
38+
**Decision**: Include the C++ matrix entry as a YAML comment block rather than omitting it entirely.
39+
40+
**Rationale**: C++ compilation via `hxcpp` takes 3–5 minutes and requires `haxelib install hxcpp`. Leaving it commented preserves the config for anyone who wants to enable it, without slowing down every CI run.
41+
42+
### `strategy.fail-fast: false`
43+
44+
**Decision**: Set `fail-fast: false` on the matrix.
45+
46+
**Rationale**: A failure on one target (e.g. PHP) shouldn't cancel the other in-flight jobs. All failures should be visible in one run.
47+
48+
## Risks / Trade-offs
49+
50+
- **PHP version drift** → ubuntu-latest ships with a specific PHP version; future runner image updates could change behavior. Mitigation: none needed at this scale — pin only if a problem arises.
51+
- **`krdlab/setup-haxe` maintenance** → community action, not officially maintained by Haxe Foundation. Mitigation: pin to a specific action version (e.g. `v1`) rather than `main`.
52+
- **C++ latent breakage** → With C++ commented out, target-specific bugs on that backend won't be caught. Mitigation: documented trade-off; can be re-enabled any time.
53+
54+
## Migration Plan
55+
56+
1. Create per-target hxml files
57+
2. Create `.github/workflows/ci.yml`
58+
3. Delete `.travis.yml`
59+
4. Push to a PR branch — GitHub Actions triggers automatically
60+
5. Verify all matrix jobs pass before merging
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## Why
2+
3+
The existing `.travis.yml` CI is effectively dead — Travis CI's free tier for open-source has been gutted and the config targets Haxe 3.2.1 which is no longer relevant after the migration to `utest`. Replacing it with GitHub Actions gives reliable, integrated CI that runs on PRs and protected branches.
4+
5+
## What Changes
6+
7+
- Add `.github/workflows/ci.yml` — multi-target test matrix triggered on push to `master`/`release-*` and on pull requests
8+
- Add `tests-neko.hxml`, `tests-php.hxml`, `tests-java.hxml`, `tests-cpp.hxml` — per-target hxml files for use by the matrix
9+
- Remove `.travis.yml`
10+
11+
## Capabilities
12+
13+
### New Capabilities
14+
15+
- `github-actions-ci`: GitHub Actions workflow that compiles and runs the test suite across JS, Neko, PHP, and Java targets (C++ present but commented out); triggered on push to `master`/`release-*` and all pull requests
16+
17+
### Modified Capabilities
18+
19+
_(none — no existing spec-level behavior changes)_
20+
21+
## Impact
22+
23+
- **CI infrastructure**: Replaces Travis with GitHub Actions; no code changes to the library itself
24+
- **Dependencies**: Adds `krdlab/setup-haxe` GitHub Action (latest stable Haxe); `utest` and `hxcpp` installed via `haxelib install` in the workflow
25+
- **New files**: 5 files added (1 workflow YAML + 4 hxml), 1 removed (`.travis.yml`)
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## ADDED Requirements
2+
3+
### Requirement: CI runs on relevant push and PR events
4+
The workflow SHALL trigger on push to `master` and any branch matching `release-*`, and on all pull request events regardless of base branch.
5+
6+
#### Scenario: Push to master triggers CI
7+
- **WHEN** a commit is pushed to the `master` branch
8+
- **THEN** the CI workflow runs all active matrix jobs
9+
10+
#### Scenario: Push to release branch triggers CI
11+
- **WHEN** a commit is pushed to a branch matching `release-*`
12+
- **THEN** the CI workflow runs all active matrix jobs
13+
14+
#### Scenario: Pull request triggers CI
15+
- **WHEN** a pull request is opened, synchronized, or reopened
16+
- **THEN** the CI workflow runs all active matrix jobs
17+
18+
### Requirement: Tests run across multiple Haxe targets in parallel
19+
The workflow SHALL run the test suite independently for each active target (js, neko, php, java) as parallel matrix jobs using the latest stable Haxe release.
20+
21+
#### Scenario: Each target compiles and runs independently
22+
- **WHEN** the CI workflow runs
23+
- **THEN** js, neko, php, and java each compile and execute in a separate job without waiting for each other
24+
25+
#### Scenario: One target failure does not cancel others
26+
- **WHEN** one matrix job fails
27+
- **THEN** the remaining matrix jobs continue to completion (`fail-fast: false`)
28+
29+
#### Scenario: JS target passes
30+
- **WHEN** the js matrix job runs
31+
- **THEN** `haxe tests.hxml` compiles to `tests.js` and `node tests.js` exits with code 0
32+
33+
#### Scenario: Neko target passes
34+
- **WHEN** the neko matrix job runs
35+
- **THEN** `haxe tests-neko.hxml` compiles to `tests.n` and `neko tests.n` exits with code 0
36+
37+
#### Scenario: PHP target passes
38+
- **WHEN** the php matrix job runs
39+
- **THEN** `haxe tests-php.hxml` compiles to `tests.php/` and `php tests.php/index.php` exits with code 0
40+
41+
#### Scenario: Java target passes
42+
- **WHEN** the java matrix job runs
43+
- **THEN** `haxe tests-java.hxml` compiles to `tests.java/` and `java -jar tests.java/HaxeCryptoTests-Debug.jar` exits with code 0
44+
45+
### Requirement: C++ target is present but inactive
46+
The workflow config SHALL include a C++ matrix entry in commented-out form so it can be enabled without writing new config.
47+
48+
#### Scenario: C++ does not run by default
49+
- **WHEN** the CI workflow runs
50+
- **THEN** no C++ compilation or execution job is active
51+
52+
#### Scenario: C++ can be enabled by uncommenting
53+
- **WHEN** the commented C++ matrix entry is uncommented
54+
- **THEN** the workflow compiles with `haxe tests-cpp.hxml` (which installs `hxcpp`) and runs `tests.cpp/HaxeCryptoTests-debug`
55+
56+
### Requirement: Travis CI config is removed
57+
The `.travis.yml` file SHALL be deleted as part of this change.
58+
59+
#### Scenario: No Travis config present after change
60+
- **WHEN** the change is applied
61+
- **THEN** `.travis.yml` no longer exists in the repository root
62+
63+
### Requirement: Per-target hxml files exist for all matrix targets
64+
Each matrix target SHALL have a dedicated hxml file that can also be run locally.
65+
66+
#### Scenario: Developer runs a single target locally
67+
- **WHEN** a developer runs `haxe tests-neko.hxml` (or php/java/cpp variant) locally
68+
- **THEN** the target compiles and the tests run for that target only
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## 1. Per-target hxml files
2+
3+
- [x] 1.1 Create `tests-neko.hxml` with common flags and `-neko tests.n` / `-cmd neko tests.n`
4+
- [x] 1.2 Create `tests-php.hxml` with common flags and `-php tests.php` / `-cmd php tests.php/index.php`
5+
- [x] 1.3 Create `tests-java.hxml` with common flags and `-java tests.java` / `-cmd java -jar tests.java/HaxeCryptoTests-Debug.jar`
6+
- [x] 1.4 Create `tests-cpp.hxml` with common flags and `-cpp tests.cpp` / `-cmd tests.cpp/HaxeCryptoTests-debug`
7+
8+
## 2. GitHub Actions workflow
9+
10+
- [x] 2.1 Create `.github/workflows/ci.yml` with triggers: push to `master` and `release-*`, plus `pull_request`
11+
- [x] 2.2 Add matrix with `fail-fast: false` covering js (`tests.hxml`), neko (`tests-neko.hxml`), php (`tests-php.hxml`, apt: `php-cli`), java (`tests-java.hxml`)
12+
- [x] 2.3 Add C++ matrix entry as a YAML comment block (target: cpp, hxml: tests-cpp.hxml, extra haxelib: hxcpp)
13+
- [x] 2.4 Add workflow steps: checkout → setup-haxe (latest) → `haxelib install utest` → conditional apt install → `haxe <matrix.hxml>`
14+
15+
## 3. Cleanup
16+
17+
- [x] 3.1 Delete `.travis.yml`
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# github-actions-ci Specification
2+
3+
## Purpose
4+
TBD - created by archiving change add-github-actions-ci. Update Purpose after archive.
5+
## Requirements
6+
### Requirement: CI runs on relevant push and PR events
7+
The workflow SHALL trigger on push to `master` and any branch matching `release-*`, and on all pull request events regardless of base branch.
8+
9+
#### Scenario: Push to master triggers CI
10+
- **WHEN** a commit is pushed to the `master` branch
11+
- **THEN** the CI workflow runs all active matrix jobs
12+
13+
#### Scenario: Push to release branch triggers CI
14+
- **WHEN** a commit is pushed to a branch matching `release-*`
15+
- **THEN** the CI workflow runs all active matrix jobs
16+
17+
#### Scenario: Pull request triggers CI
18+
- **WHEN** a pull request is opened, synchronized, or reopened
19+
- **THEN** the CI workflow runs all active matrix jobs
20+
21+
### Requirement: Tests run across multiple Haxe targets in parallel
22+
The workflow SHALL run the test suite independently for each active target (js, neko, php, java) as parallel matrix jobs using the latest stable Haxe release.
23+
24+
#### Scenario: Each target compiles and runs independently
25+
- **WHEN** the CI workflow runs
26+
- **THEN** js, neko, php, and java each compile and execute in a separate job without waiting for each other
27+
28+
#### Scenario: One target failure does not cancel others
29+
- **WHEN** one matrix job fails
30+
- **THEN** the remaining matrix jobs continue to completion (`fail-fast: false`)
31+
32+
#### Scenario: JS target passes
33+
- **WHEN** the js matrix job runs
34+
- **THEN** `haxe tests.hxml` compiles to `tests.js` and `node tests.js` exits with code 0
35+
36+
#### Scenario: Neko target passes
37+
- **WHEN** the neko matrix job runs
38+
- **THEN** `haxe tests-neko.hxml` compiles to `tests.n` and `neko tests.n` exits with code 0
39+
40+
#### Scenario: PHP target passes
41+
- **WHEN** the php matrix job runs
42+
- **THEN** `haxe tests-php.hxml` compiles to `tests.php/` and `php tests.php/index.php` exits with code 0
43+
44+
#### Scenario: Java target passes
45+
- **WHEN** the java matrix job runs
46+
- **THEN** `haxe tests-java.hxml` compiles to `tests.java/` and `java -jar tests.java/HaxeCryptoTests-Debug.jar` exits with code 0
47+
48+
### Requirement: C++ target is present but inactive
49+
The workflow config SHALL include a C++ matrix entry in commented-out form so it can be enabled without writing new config.
50+
51+
#### Scenario: C++ does not run by default
52+
- **WHEN** the CI workflow runs
53+
- **THEN** no C++ compilation or execution job is active
54+
55+
#### Scenario: C++ can be enabled by uncommenting
56+
- **WHEN** the commented C++ matrix entry is uncommented
57+
- **THEN** the workflow compiles with `haxe tests-cpp.hxml` (which installs `hxcpp`) and runs `tests.cpp/HaxeCryptoTests-debug`
58+
59+
### Requirement: Travis CI config is removed
60+
The `.travis.yml` file SHALL be deleted as part of this change.
61+
62+
#### Scenario: No Travis config present after change
63+
- **WHEN** the change is applied
64+
- **THEN** `.travis.yml` no longer exists in the repository root
65+
66+
### Requirement: Per-target hxml files exist for all matrix targets
67+
Each matrix target SHALL have a dedicated hxml file that can also be run locally.
68+
69+
#### Scenario: Developer runs a single target locally
70+
- **WHEN** a developer runs `haxe tests-neko.hxml` (or php/java/cpp variant) locally
71+
- **THEN** the target compiles and the tests run for that target only
72+

tests-cpp.hxml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-debug
2+
-cp src
3+
-cp test
4+
-lib utest
5+
-main com.hurlant.tests.HaxeCryptoTests
6+
7+
-cpp tests.cpp
8+
-cmd tests.cpp/HaxeCryptoTests-debug

tests-java.hxml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-debug
2+
-cp src
3+
-cp test
4+
-lib utest
5+
-main com.hurlant.tests.HaxeCryptoTests
6+
7+
-java tests.java
8+
-cmd java -jar tests.java/HaxeCryptoTests-Debug.jar

0 commit comments

Comments
 (0)