46 lines
1.1 KiB
YAML
46 lines
1.1 KiB
YAML
|
|
version: 2.1
|
||
|
|
|
||
|
|
orbs:
|
||
|
|
node: circleci/node@5
|
||
|
|
|
||
|
|
jobs:
|
||
|
|
contract-tests:
|
||
|
|
docker:
|
||
|
|
- image: cimg/node:20.0
|
||
|
|
steps:
|
||
|
|
- checkout
|
||
|
|
- node/install-packages:
|
||
|
|
pkg-manager: npm
|
||
|
|
- restore_cache:
|
||
|
|
keys:
|
||
|
|
- apophis-cache-{{ .Branch }}
|
||
|
|
- apophis-cache-main
|
||
|
|
- run:
|
||
|
|
name: Determine changed routes
|
||
|
|
command: |
|
||
|
|
# Extract changed routes from git diff
|
||
|
|
CHANGED=$(git diff --name-only HEAD~1 HEAD | \
|
||
|
|
grep -E 'src/routes|src/schemas' | \
|
||
|
|
sed 's|src/routes||; s|\.ts$||' | \
|
||
|
|
paste -sd ',' -)
|
||
|
|
echo "export APOPHIS_CHANGED_ROUTES=$CHANGED" >> $BASH_ENV
|
||
|
|
- run:
|
||
|
|
name: Run contract tests
|
||
|
|
command: npm test
|
||
|
|
environment:
|
||
|
|
APOPHIS_LOG_LEVEL: info
|
||
|
|
- save_cache:
|
||
|
|
paths:
|
||
|
|
- .apophis-cache.json
|
||
|
|
key: apophis-cache-{{ .Branch }}-{{ epoch }}
|
||
|
|
- store_test_results:
|
||
|
|
path: test-results
|
||
|
|
- store_artifacts:
|
||
|
|
path: test-results
|
||
|
|
destination: test-results
|
||
|
|
|
||
|
|
workflows:
|
||
|
|
test:
|
||
|
|
jobs:
|
||
|
|
- contract-tests
|