Patterns
CI/CD pipeline for e-invoicing integration
Automated sandbox tests before production deployment
Any Scell.io integration must run a 4-stage CI pipeline: (1) lint + typecheck, (2) unit tests (SDK mocks), (3) integration tests in sandbox with real `sk_test_*` key (Factur-X invoice creation, EN 16931 validation, SES signature, webhook verification), (4) production deployment conditional on 100% green tests. Scell.io sandbox (`https://api.scell.io` with `sk_test_*` keys) is an isolated DB (`pgsql_sandbox`) accepting the same payloads as prod without real billing. Mandatory pattern: a distinct CI secret for sandbox key (never the live one). Pipeline should also validate generated XML against EN 16931 schema via xsd-validator or Schematron. Failed sandbox test = blocked merge to main, no exception.
Key facts
- 4 stages: lint → unit → sandbox integration → deploy
- Scell.io sandbox: sk_test_* on api.scell.io, isolated DB
- Distinct CI secret for sandbox (GitHub Secrets / Vault)
- Mandatory EN 16931 XML validation (xsd or Schematron)
- Failed sandbox test = blocked merge, no exception
Code example
# .github/workflows/scell-integration.yml
name: Scell.io Integration CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
- run: pnpm install --frozen-lockfile
- run: pnpm lint && pnpm typecheck
- run: pnpm test:unit
- name: Sandbox integration tests
env:
SCELL_API_KEY: ${{ secrets.SCELL_SANDBOX_KEY }} # sk_test_*
SCELL_API_URL: https://api.scell.io/api/v1
run: pnpm test:integration
- name: Validate EN 16931 XML
run: pnpm exec xsd-validator schemas/EN16931.xsd output/*.xml
deploy:
needs: test
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- run: echo "Deploy to prod with sk_live_*"