Skip to content

Latest commit

 

History

History
100 lines (67 loc) · 2.96 KB

File metadata and controls

100 lines (67 loc) · 2.96 KB

Contributing

Feel free to fork this project. We will happily merge bug fixes or other small improvements. For bigger changes you should probably get in touch with us before you start to avoid not seeing them merged.

Testing

Basic Tests

make test

System Tests

System tests require:

  1. Valid Transloadit credentials in environment:
export TRANSLOADIT_KEY='your-auth-key'
export TRANSLOADIT_SECRET='your-auth-secret'

Then run:

make test-all

Node.js Reference Implementation Parity Assertions

The SDK includes assertions that compare Smart CDN URL signatures and regular request signatures with our reference Node.js implementation. To run these tests:

  1. Requirements:

    • Node.js 20+ with npm
    • Ability to execute npx transloadit smart_sig (the CLI is downloaded on demand)
    • Ability to execute npx transloadit sig (the CLI is downloaded on demand)
  2. Run the tests:

export TRANSLOADIT_KEY='your-auth-key'
export TRANSLOADIT_SECRET='your-auth-secret'
TEST_NODE_PARITY=1 make test-all

If you want to warm the CLI cache ahead of time you can run:

npx --yes transloadit smart_sig --help

For regular request signatures, you can also prime the CLI by running:

TRANSLOADIT_KEY=... TRANSLOADIT_SECRET=... \
  npx --yes transloadit sig --algorithm sha1 --help

CI opts into TEST_NODE_PARITY=1, and you can optionally do this locally as well.

Run Tests in Docker

Use scripts/test-in-docker.sh for a reproducible environment:

./scripts/test-in-docker.sh

This builds the local image, runs composer install, and executes make test-all (unit + integration tests). Pass a custom command to run something else (composer install still runs first):

./scripts/test-in-docker.sh vendor/bin/phpunit --filter signedSmartCDNUrl

Environment variables such as TEST_NODE_PARITY or the credentials in .env are forwarded, so you can combine parity checks and integration tests with Docker:

TEST_NODE_PARITY=1 ./scripts/test-in-docker.sh

Releasing a new version

To release, say 3.3.0 Packagist, follow these steps:

  1. Make sure PACKAGIST_TOKEN is set in your .env file
  2. Make sure you are in main: git checkout main
  3. Make sure CHANGELOG.md and composer.json have been updated
  4. Commit: git add CHANGELOG.md composer.json && git commit -m "Release v3.3.0"
  5. Tag: git tag v3.3.0
  6. Push: git push --tags
  7. Notify Packagist (runs via Docker): VERSION=3.3.0 ./scripts/notify-registry.sh
  8. Publish a GitHub release (include the changelog). This triggers the release workflow. (via the GitHub UI, gh release creates v3.3.0 --title "v3.3.0" --notes-file <(cat CHANGELOG.md section))

The notify script reuses the same Docker image as ./scripts/test-in-docker.sh, so Docker is the only requirement on your workstation.

This project implements the Semantic Versioning guidelines.