✨ [#16] Add URN reference #138
This file contains hidden or 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: Run build pipeline | |
| # Run this workflow every time a new commit pushed to your repository | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| IMAGE_NAME: maykinmedia/open-vtb | |
| DJANGO_SETTINGS_MODULE: openvtb.conf.ci | |
| DOCKER_BUILDKIT: '1' | |
| DB_PASSWORD: '' | |
| DB_USER: postgres | |
| jobs: | |
| # determine changed files to decide if certain jobs can be skipped or not | |
| changed-files: | |
| runs-on: ubuntu-latest # windows-latest | macos-latest | |
| name: Determine changed files | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Get changed PY files | |
| id: changed-py-files | |
| run: bin/check_changed_files.sh ^src/.*\.py$ | |
| - name: Get changed requirements files | |
| id: changed-requirements | |
| run: bin/check_changed_files.sh ^requirements/.*\.txt$ | |
| outputs: | |
| changed-py-files: ${{ steps.changed-py-files.outputs.any_changed }} | |
| changed-requirements: ${{ steps.changed-requirements.outputs.any_changed }} | |
| tests: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changed-files | |
| # only run tests if source files have changed (e.g. skip for PRs that only update docs) | |
| if: ${{ needs.changed-files.outputs.changed-py-files == 'true'|| needs.changed-files.outputs.changed-requirements == 'true'|| needs.changed-files.outputs.changed-templates|| github.event_name == 'push' }} | |
| strategy: | |
| matrix: | |
| postgres: ["14", "15", "16", "17"] | |
| postgis: ["3.2", "3.5"] | |
| use_pooling: [false] | |
| exclude: | |
| # postgis 3.2 is not compatible with recent postgres versions | |
| - postgres: "17" | |
| postgis: "3.2" | |
| - postgres: "16" | |
| postgis: "3.2" | |
| - postgres: "15" | |
| postgis: "3.2" | |
| include: | |
| - postgres: "17" | |
| postgis: "3.5" | |
| use_pooling: true | |
| name: Tests (PG ${{ matrix.postgres }}, postgis ${{ matrix.postgis }}) ${{matrix.use_pooling && 'with connection pooling' || ''}} | |
| services: | |
| postgres: | |
| image: postgis/postgis:${{ matrix.postgres }}-${{ matrix.postgis }} | |
| env: | |
| POSTGRES_HOST_AUTH_METHOD: trust | |
| ports: | |
| - 5432:5432 | |
| # needed because the postgres container does not provide a healthcheck | |
| options: | |
| --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
| --name postgres | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up backend environment | |
| uses: maykinmedia/[email protected] | |
| with: | |
| apt-packages: "libxml2 libxmlsec1 libxmlsec1-openssl gettext postgresql-client libgdal-dev gdal-bin" | |
| python-version: "3.12" | |
| optimize-postgres: "yes" | |
| pg-service: "postgres" | |
| setup-node: "yes" | |
| - name: Run tests | |
| run: | | |
| python src/manage.py collectstatic --noinput --link | |
| coverage run src/manage.py test src | |
| env: | |
| SECRET_KEY: dummy | |
| - name: Publish coverage report | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| check-envvar-docs: | |
| runs-on: ubuntu-latest | |
| name: Documentation build | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up backend environment | |
| uses: maykinmedia/[email protected] | |
| with: | |
| python-version: '3.12' | |
| apt-packages: "libgdal-dev gdal-bin" | |
| setup-node: false | |
| - name: Generate environment variable documentation using OAf and check if it was updated | |
| run: | | |
| bin/generate_envvar_docs.sh | |
| changes=$(git diff docs/installation/config/env_configuration.rst) | |
| if [ ! -z "$changes" ]; then | |
| echo $changes | |
| echo "Please update the environment documentation by running \`bin/generate_envvar_docs.sh\`" | |
| exit 1 | |
| fi | |
| store-reusable-workflow-vars: | |
| name: create values which can be passed through a reusable workflow | |
| runs-on: ubuntu-latest | |
| outputs: | |
| image-name: ${{ steps.image-name.outputs.image-name }} | |
| steps: | |
| - run: echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT | |
| name: 'Store the docker image name' | |
| id: image-name | |
| open-api-ci: | |
| uses: maykinmedia/open-api-workflows/.github/workflows/ci.yml@v6 | |
| needs: | |
| - store-reusable-workflow-vars | |
| with: | |
| apt-packages: "libgdal-dev gdal-bin graphviz graphviz-dev" | |
| main-branch: "main" | |
| run-docs: true | |
| python-version: "3.12" | |
| django-settings-module: openvtb.conf.ci | |
| docker-image-name: ${{ needs.store-reusable-workflow-vars.outputs.image-name }} | |
| docs-ssl-conf: ${{ needs.store-reusable-workflow-vars.outputs.sphinx-ssl-conf }} | |
| # open-api-publish: | |
| # uses: maykinmedia/open-api-workflows/.github/workflows/publish.yml@v6 | |
| # needs: | |
| # - store-reusable-workflow-vars | |
| # - open-api-ci | |
| # - tests | |
| # with: | |
| # docker-image-name: ${{ needs.store-reusable-workflow-vars.outputs.image-name }} | |
| # repository-owner: 'maykinmedia' | |
| # secrets: | |
| # docker-username: ${{ secrets.DOCKER_USERNAME }} | |
| # docker-token: ${{ secrets.DOCKER_TOKEN }} |