Skip to content

Yrob/GitHub ci

Yrob/GitHub ci #8

name: Validate openapi spec
on:
push:
branches:
- features/**
pull_request:
branches:
- main
- master
jobs:
docker:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start containers
run: docker compose -f "docker-compose.yml" up -d --build
- name: Setup tests
run: |
mkdir spectral
echo 'extends: ["spectral:oas", "spectral:asyncapi"]' > ./spectral/.spectral.yaml
docker compose exec web curl 'http://web:8000/v1/bag/?format=json' > ./spectral/openapi.yaml
- name: Run spectral tests
run: docker run -v ./spectral:/mnt/spectral stoplight/spectral lint /mnt/spectral/openapi.yaml --ruleset /mnt/spectral/.spectral.yaml
- name: Stop containers
if: always()
run: docker compose -f "docker-compose.yml" down