Skip to content

Testing bcc new command #271

Testing bcc new command

Testing bcc new command #271

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: |
io/**/*.yaml
io/**/*.yml
io/**/*.json
files_ignore: kafka.yaml #skipping it as async is under private-beta
- name: Get changed GraphQLS files
id: changed-graphqls-files
uses: tj-actions/changed-files@v34
with:
files: |
io/**/*.graphqls
- 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 io/**/*.yaml
- name: Create environment file
run: |
# echo "GITHUB_REF=${{ github.ref }}" >> env.list
echo "GITHUB_SHA=${{ github.sha }}" >> env.list
echo "GITHUB_REPOSITORY=${{ github.repository }}" >> env.list
echo "GITHUB_ACTOR=${{ github.actor }}" >> env.list
echo "GITHUB_WORKFLOW=${{ github.workflow }}" >> env.list
echo "GITHUB_HEAD_REF=${{ github.head_ref }}" >> env.list
if [ -z "${{ github.base_ref }}" ]; then
echo "GITHUB_BASE_REF=${{ github.ref }}" | sed 's/refs\/heads\///' >> env.list
else
echo "GITHUB_BASE_REF=${{ github.base_ref }}" >> env.list
fi
- name: Run OpenAPI backward compatibility check on changed files
if: steps.changed-files-specific.outputs.any_changed == 'true'
run: |
docker run -v "$(pwd):/central-contract-repo:rw" \
--env-file env.list \
--entrypoint /bin/sh znsio/specmatic \
-c "git config --global --add safe.directory /central-contract-repo && cd /central-contract-repo && java -jar /usr/src/app/specmatic.jar backward-compatibility-check --base-branch origin/main"
- name: Run GraphQL backward compatibility check on changed files
if: steps.changed-graphqls-files.outputs.any_changed == 'true'
run: |
docker run -v "$(pwd):/central-contract-repo:rw" \
--env-file env.list \
--entrypoint /bin/sh \
znsio/specmatic-graphql-trial \
-c "git config --global --add safe.directory /central-contract-repo && cd /central-contract-repo && java -jar /usr/src/app/specmatic-graphql.jar backward-compatibility-check --base-branch origin/main"