Switching to Docker image of Specmatic for Backward Compatibility Check #160
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
name: Check API Contracts | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Get changed yaml files | |
id: changed-files-specific | |
uses: tj-actions/changed-files@v34 | |
with: | |
files: | | |
in/**/*.yaml | |
in/**/*.yml | |
in/**/*.json | |
files_ignore: kafka.yaml #skipping it as async is under private-beta | |
- name: Install Spectral Linter | |
if: steps.changed-files-specific.outputs.any_changed == 'true' | |
run: npm install -g @stoplight/spectral-cli | |
- name: Run Spectral linter on changed files | |
if: steps.changed-files-specific.outputs.any_changed == 'true' | |
run: | | |
echo "Running Spectral linter on: ${{ steps.changed-files-specific.outputs.all_changed_files }}" | |
spectral lint in/**/*.yaml | |
- name: Run backward compatibility check on changed files | |
if: steps.changed-files-specific.outputs.any_changed == 'true' | |
run: | | |
docker run -v "$(pwd):/central-contract-repo:rw" \ (git)-[BC-command-test] | |
--entrypoint /bin/sh znsio/specmatic \ | |
-c "cd /central-contract-repo && java -jar /usr/src/app/specmatic.jar backwardCompatibilityCheck" |