Skip to content

Commit 9abee0a

Browse files
julianrichieclaude
andcommitted
ci: add GitHub Actions workflow for tests
Runs unit + integration suites on PHP 8.1-8.4 for every push and PR. Adds an opt-in live job (push/dispatch only) that runs composer test:live against the real gateway using the ODX_* repo secrets. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e619b09 commit 9abee0a

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: read
12+
13+
concurrency:
14+
group: ${{ github.workflow }}-${{ github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
# Unit + integration suites. No credentials needed: the integration suite
19+
# boots a local `php -S` mock gateway, so this runs on every push and PR
20+
# (forks included) across the PHP range the library supports.
21+
test:
22+
name: PHP ${{ matrix.php }}
23+
runs-on: ubuntu-latest
24+
strategy:
25+
fail-fast: false
26+
matrix:
27+
php: ['8.1', '8.2', '8.3', '8.4']
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- name: Setup PHP
32+
uses: shivammathur/setup-php@v2
33+
with:
34+
php-version: ${{ matrix.php }}
35+
extensions: curl, json
36+
coverage: none
37+
38+
- name: Install dependencies
39+
uses: ramsey/composer-install@v3
40+
41+
- name: Run unit + integration suites
42+
run: composer test
43+
44+
# Opt-in live suite against the real gateway. Only runs on pushes to main and
45+
# manual dispatch — never on PRs, where secrets are unavailable (forks) and we
46+
# don't want to hit a real Odoo on every proposed change. The suite self-skips
47+
# if any ODX_* var is missing, so a misconfigured secret degrades to a skip.
48+
live:
49+
name: Live (real gateway)
50+
runs-on: ubuntu-latest
51+
needs: test
52+
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
53+
steps:
54+
- uses: actions/checkout@v4
55+
56+
- name: Setup PHP
57+
uses: shivammathur/setup-php@v2
58+
with:
59+
php-version: '8.3'
60+
extensions: curl, json
61+
coverage: none
62+
63+
- name: Install dependencies
64+
uses: ramsey/composer-install@v3
65+
66+
- name: Run live suite
67+
env:
68+
ODX_GATEWAY_URL: ${{ secrets.ODX_GATEWAY_URL }}
69+
ODX_GATEWAY_API_KEY: ${{ secrets.ODX_GATEWAY_API_KEY }}
70+
ODX_ODOO_URL: ${{ secrets.ODX_ODOO_URL }}
71+
ODX_USER_ID: ${{ secrets.ODX_USER_ID }}
72+
ODX_DB: ${{ secrets.ODX_DB }}
73+
ODX_API_KEY: ${{ secrets.ODX_API_KEY }}
74+
run: composer test:live

0 commit comments

Comments
 (0)