diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c0261d2..fdc0b9bb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -63,69 +63,6 @@ jobs: - name: Publish coverage report uses: codecov/codecov-action@v3 - generate-oas-files: - name: Generate and upload OAS files for all versions - needs: tests - runs-on: ubuntu-latest - strategy: - matrix: - version: ['v1', 'v2'] - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - with: - python-version: '3.10' - - uses: actions/setup-node@v4 - with: - node-version: '18' - - - name: Install system packages - run: | - sudo apt-get update \ - && sudo apt-get install -y --no-install-recommends \ - libgdal-dev \ - gdal-bin - - - name: Install dependencies - run: pip install -r requirements/ci.txt codecov - - - name: Generate OAS files - run: ./bin/generate_schema.sh ${{ matrix.version }} openapi-${{ matrix.version }}.yaml - env: - DJANGO_SETTINGS_MODULE: objects.conf.ci - - - name: Store generated OAS files - uses: actions/upload-artifact@v4 - with: - name: objects-api-${{ matrix.version }}-oas - path: openapi-${{ matrix.version }}.yaml - retention-days: 1 - - oas-up-to-date: - name: Check for unexepected OAS changes - needs: generate-oas-files - runs-on: ubuntu-latest - strategy: - matrix: - version: ['v1', 'v2'] - steps: - - uses: actions/checkout@v4 - - name: Download generated OAS - uses: actions/download-artifact@v4 - with: - name: objects-api-${{ matrix.version }}-oas - - name: Check for OAS changes - run: | - diff openapi-${{ matrix.version }}.yaml src/objects/api/${{ matrix.version }}/openapi.yaml - - name: Write failure markdown - if: ${{ failure() }} - run: | - echo 'Run the following command locally and commit the changes' >> $GITHUB_STEP_SUMMARY - echo '' >> $GITHUB_STEP_SUMMARY - echo '```bash' >> $GITHUB_STEP_SUMMARY - echo './bin/generate_schema.sh ${{ matrix.version }}' >> $GITHUB_STEP_SUMMARY - echo '```' >> $GITHUB_STEP_SUMMARY - docker: needs: tests diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 75d6fed5..084d0a53 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -33,3 +33,67 @@ jobs: - name: Run black run: | black --check src docs + + generate-oas-files: + name: Generate and upload OAS files for all versions + needs: tests + runs-on: ubuntu-latest + strategy: + matrix: + version: ['v1', 'v2'] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.10' + - uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Install system packages + run: | + sudo apt-get update \ + && sudo apt-get install -y --no-install-recommends \ + libgdal-dev \ + gdal-bin + + - name: Install dependencies + run: pip install -r requirements/ci.txt + + - name: Generate OAS files + run: ./bin/generate_schema.sh ${{ matrix.version }} openapi-${{ matrix.version }}.yaml + env: + DJANGO_SETTINGS_MODULE: objects.conf.ci + + - name: Store generated OAS files + uses: actions/upload-artifact@v4 + with: + name: objects-api-${{ matrix.version }}-oas + path: openapi-${{ matrix.version }}.yaml + retention-days: 1 + + oas-up-to-date: + name: Check for unexepected OAS changes + needs: generate-oas-files + runs-on: ubuntu-latest + strategy: + matrix: + version: ['v1', 'v2'] + steps: + - uses: actions/checkout@v4 + - name: Download generated OAS + uses: actions/download-artifact@v4 + with: + name: objects-api-${{ matrix.version }}-oas + - name: Check for OAS changes + run: | + diff openapi-${{ matrix.version }}.yaml src/objects/api/${{ matrix.version }}/openapi.yaml + - name: Write failure markdown + if: ${{ failure() }} + run: | + echo 'Run the following command locally and commit the changes' >> $GITHUB_STEP_SUMMARY + echo '' >> $GITHUB_STEP_SUMMARY + echo '```bash' >> $GITHUB_STEP_SUMMARY + echo './bin/generate_schema.sh ${{ matrix.version }}' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY +