diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml deleted file mode 100644 index 017bb6391..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ /dev/null @@ -1,90 +0,0 @@ -name: Probleem melden / Bug report -description: Meldt een probleem om ons te helpen verbeteren / Create a report to help us improve -title: "Title here" -labels: ["bug", "triage"] -assignees: [] -body: - - type: input - id: product-version - attributes: - label: Product versie / Product version - description: Welke versie gebruikt u? / Which version do you use? - placeholder: "1.1.0" - validations: - required: true - - type: textarea - id: what-happened - attributes: - label: Omschrijf het probleem / Describe the bug - description: Een duidelijke omschrijving van het probleem (de "bug") / A clear and concise description of what the bug is. - validations: - required: true - - type: textarea - id: steps-to-reproduce - attributes: - label: Stappen om te reproduceren / Steps to reproduce - description: Stappen die leiden tot het probleem / Steps to reproduce the behavior - placeholder: | - 1. Go to '...' - 2. Click on '....' - 3. Scroll down to '....' - 4. See error - validations: - required: false - - type: textarea - id: expected-behaviour - attributes: - label: Verwacht gedrag / Expected behavior - description: Een duidelijke omschrijving van wat de verwachting is / A clear and concise description of what you expected to happen. - validations: - required: false - - type: dropdown - id: screen-resolution - attributes: - label: Screen resolution - options: - - "smaller" - - "1024 x 768" - - "1366 x 768" - - "1920 x 1080" - - "bigger" - - "unknown" - validations: - required: false - - type: dropdown - id: device - attributes: - label: Device - options: - - Desktop - - Mobile - - Tablet - - Anders / Other - validations: - required: false - - type: dropdown - id: os - attributes: - label: OS - options: - - Windows - - Linux - - MacOS - - iOS - - Android - - Anders / Other - validations: - required: false - - type: dropdown - id: browsers - attributes: - label: Browser - multiple: true - options: - - Edge - - Chrome - - Safari - - Firefox - - Anders / Other - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml deleted file mode 100644 index dd605f8f1..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Verzoek tot verbetering / Feature request -description: Stel een idee voor om het project beter te maken / Suggest an idea for this project -title: "Title here" -labels: ["enhancement", "triage"] -assignees: [] -body: - - type: dropdown - id: theme - attributes: - label: Thema / Theme - options: - - "Frontend" - - "API" - - "Admin" - - "Other" - validations: - required: true - - type: textarea - id: description - attributes: - label: Omschrijving / Description - description: Omschrijf duidelijk het idee of de behoefte, eventueel aangevuld met een bepaalde oplossingsrichting / Clearly describe the idea or need, possibly supplemented with a specific solution direction - validations: - required: true - - type: textarea - id: added-value - attributes: - label: Added value / Toegevoegde waarde - description: Omschrijf de toegevoegde waarde voor de bedrijfsvoering of dienstverlening / Describe the added value for business operations or services - validations: - required: false - - type: textarea - id: remarks - attributes: - label: Aanvullende opmerkingen / Additional context - description: Voeg aanvullingen of mockups toe voor deze verbetering / Add any other context or screenshots about the feature request - validations: - required: false diff --git a/.github/ISSUE_TEMPLATE/prepare-release.md b/.github/ISSUE_TEMPLATE/prepare-release.md deleted file mode 100644 index b6114e444..000000000 --- a/.github/ISSUE_TEMPLATE/prepare-release.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: Prepare release -about: Checklist for new releases -title: Prepare release x.y.z -labels: '' ---- - -- [ ] Resolve release blockers - - [ ] ... -- [ ] Check translations - - [ ] Backend - - [ ] Frontend -- [ ] Bump API version number - - [ ] Version bump - - [ ] Regenerate API spec - - [ ] Update READMEs with release dates + links -- [ ] Bump version number (including package-lock.json) -- [ ] Update changelog diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ad6a0f28..04da6b5be 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: Run build pipeline +name: Run CI # Run this workflow every time a new commit pushed to your repository on: @@ -12,15 +12,19 @@ on: workflow_dispatch: env: - IMAGE_NAME: maykinmedia/openarchiefbeheer + IMAGE_NAME: maykinmedia/open-archiefbeheer DJANGO_SETTINGS_MODULE: openarchiefbeheer.conf.ci DOCKER_BUILDKIT: '1' jobs: - tests: + backend-tests: name: Run the Django test suite runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + services: postgres: image: postgres:14 @@ -31,6 +35,7 @@ jobs: # 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 redis: image: redis:6 ports: @@ -38,69 +43,82 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up backend environment - uses: maykinmedia/setup-django-backend@v1 + uses: maykinmedia/setup-django-backend@v1.1 with: - python-version: '3.10.9' + apt-packages: 'gettext postgresql-client' + python-version: '3.12' optimize-postgres: 'yes' pg-service: 'postgres' setup-node: 'yes' - # apt-packages: 'gettext postgresql-client' # the default - # npm-ci-flags: '--legacy-peer-deps' -> preferably use a .npmrc file - - # Any additional services -> create docker-compose setups in a (new) `docker` - # subdirectory. - # - name: Start CI docker services - # run: | - # docker-compose -f docker-compose.ci.yml up -d - # working-directory: docker + npm-ci-flags: '--legacy-peer-deps' + working-directory: backend + nvmrc-custom-dir: backend - name: Run tests + working-directory: backend run: | python src/manage.py compilemessages python src/manage.py collectstatic --noinput --link - coverage run src/manage.py test src + coverage run src/manage.py test openarchiefbeheer + coverage xml -o coverage.xml env: + DJANGO_SETTINGS_MODULE: openarchiefbeheer.conf.ci SECRET_KEY: dummy DB_USER: postgres DB_PASSWORD: '' - name: Publish coverage report - uses: codecov/codecov-action@v3 - - # API projects: implement the necessary scripts for this. You can take a look - # at open-forms for inspiration, using drf-spectacular. - # - name: Generate OAS - # run: ./bin/generate_oas.sh openapi.yaml - - # - name: Store generated OAS - # uses: actions/upload-artifact@v3 - # with: - # name: openarchiefbeheer-oas - # path: openapi.yaml - # retention-days: 1 - - # docs: - # name: Build and check documentation - # runs-on: ubuntu-latest - - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-python@v4 - # with: - # python-version: '3.9' - - # # - name: Install OS dependencies - # # run: | - # # sudo apt-get update - # # sudo apt-get install libxml2-dev libxmlsec1-dev libxmlsec1-openssl - - # - name: Install dependencies - # run: | - # pip install -r requirements/ci.txt - - # - name: Build and test docs - # working-directory: docs - # run: pytest check_sphinx.py -v --tb=auto + uses: codecov/codecov-action@v3.1.4 + with: + working-directory: backend + files: ./coverage.xml + + frontend-build: + name: Create 'production' build + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ui + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: 'ui/.nvmrc' + + - name: Build Javascript + run: | + npm ci --legacy-peer-deps + npm run build + + - name: Store build artifact + uses: actions/upload-artifact@v3 + with: + name: open-archiefbeheer-ui-build + path: dist/ + retention-days: 1 + + docs: + name: Build and check documentation + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + with: + path: open-archiefbeheer + + - name: Set up backend environment + uses: maykinmedia/setup-django-backend@v1 + with: + apt-packages: 'gettext postgresql-client' + python-version: '3.12' + setup-node: 'no' + working-directory: open-archiefbeheer/backend + + - name: Build and test docs + run: pytest check_sphinx.py -v --tb=auto + working-directory: open-archiefbeheer/backend/docs docker_build: name: Build Docker image @@ -143,120 +161,10 @@ jobs: path: image.tar retention-days: 1 - # API projects: implement the necessary scripts for this. You can take a look - # at open-forms for inspiration, using drf-spectacular. - # oas-up-to-date: - # needs: tests - # name: Check for unexepected OAS changes - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Download generated OAS - # uses: actions/download-artifact@v3 - # with: - # name: openarchiefbeheer-oas - # - name: Check for OAS changes - # run: | - # diff openapi.yaml src/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_oas.sh' >> $GITHUB_STEP_SUMMARY - # echo '```' >> $GITHUB_STEP_SUMMARY - # - # oas-lint: - # needs: oas-up-to-date - # name: Validate OAS - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Download generated OAS - # uses: actions/download-artifact@v3 - # with: - # name: openarchiefbeheer-oas - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # - name: Install spectral - # run: npm install -g @stoplight/spectral@5.9.2 - # - name: Run OAS linter - # run: spectral lint ./openapi.yaml - - # oas-postman: - # needs: oas-up-to-date - # name: Generate Postman collection from OAS - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Download generated OAS - # uses: actions/download-artifact@v3 - # with: - # name: openarchiefbeheer-oas - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # - name: Install dependencies - # run: npm install -g openapi-to-postmanv2 - # - name: Create tests folder - # run: mkdir -p ./tests/postman - # - name: Generate Postman collection - # run: openapi2postmanv2 -s ./openapi.yaml -o ./tests/postman/collection.json --pretty - - # oas-generate-sdks: - # needs: oas-up-to-date - # name: Generate SDKs from OAS - # runs-on: ubuntu-latest - # steps: - # - uses: actions/checkout@v3 - # - name: Download generated OAS - # uses: actions/download-artifact@v3 - # with: - # name: openarchiefbeheer-oas - # - name: Use Node.js - # uses: actions/setup-node@v3 - # with: - # node-version-file: '.nvmrc' - # - name: Install dependencies - # run: npm install -g @openapitools/openapi-generator-cli@2.4.2 - # - name: Validate schema - # run: openapi-generator-cli validate -i ./openapi.yaml - # - name: Generate Java client - # run: - # openapi-generator-cli generate -i ./openapi.yaml - # --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \ -o - # ./sdks/java -g java - # --additional-properties=dateLibrary=java8,java8=true,optionalProjectFile=false,optionalAssemblyInfo=false - # - name: Generate .NET Core client - # run: - # openapi-generator-cli generate -i ./openapi.yaml - # --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \ -o - # ./sdks/netcore -g csharp-netcore - # --additional-properties=optionalProjectFile=false,optionalAssemblyInfo=false - # - name: Generate .NET Full Framework client - # run: - # openapi-generator-cli generate -i ./openapi.yaml - # --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \ -o - # ./sdks/net -g csharp - # --additional-properties=optionalProjectFile=false,optionalAssemblyInfo=false - # - name: Generate Python client - # run: - # openapi-generator-cli generate -i ./openapi.yaml - # --global-property=modelTests=false,apiTests=false,modelDocs=false,apiDocs=false \ -o - # ./sdks/python -g python - # --additional-properties=optionalProjectFile=false,optionalAssemblyInfo=false+ - docker_push: needs: - - tests + - backend-tests - docker_build - # - oas-lint - # - oas-postman - # - oas-generate-sdks name: Push Docker image runs-on: ubuntu-latest diff --git a/.github/workflows/code_quality.yml b/.github/workflows/code_quality.yml index 24f807299..b2efe3d14 100644 --- a/.github/workflows/code_quality.yml +++ b/.github/workflows/code_quality.yml @@ -30,12 +30,13 @@ jobs: - name: Set up backend environment uses: maykinmedia/setup-django-backend@v1 with: - python-version: '3.10' + python-version: '3.12' setup-node: 'no' + working-directory: backend - uses: isort/isort-action@v1.1.0 with: requirements-files: requirements/ci.txt - sort-paths: 'src docs bin' + sort-paths: 'backend/src backend/docs backend/bin' configuration: '--check-only --diff' black: @@ -47,22 +48,29 @@ jobs: - name: Set up backend environment uses: maykinmedia/setup-django-backend@v1 with: - python-version: '3.10' + python-version: '3.12' setup-node: 'no' + working-directory: backend - name: Run black run: black --check src docs bin + working-directory: backend flake8: name: Code style (flake8) runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + steps: - uses: actions/checkout@v3 - name: Set up backend environment uses: maykinmedia/setup-django-backend@v1 with: - python-version: '3.10' + python-version: '3.12' setup-node: 'no' + working-directory: backend - name: Run flake8 id: flake8 run: | @@ -83,10 +91,34 @@ jobs: echo '| :--- | ---- | ------ | :---- |' >> $GITHUB_STEP_SUMMARY python ./bin/flake8_summary.py "${{ steps.flake8.outputs.FLAKE8_REPORT }}" >> $GITHUB_STEP_SUMMARY + ui-prettier: + name: Check frontend code formatting with prettier + runs-on: ubuntu-latest + + defaults: + run: + working-directory: ui + + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version-file: 'ui/.nvmrc' + + - name: Install dependencies + run: npm ci --legacy-peer-deps + + - name: Run prettier linter + run: npm run checkformat + migrations: name: Check for model changes not present in migrations runs-on: ubuntu-latest + defaults: + run: + working-directory: backend + services: postgres: image: postgres:14 @@ -101,11 +133,14 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up backend environment - uses: maykinmedia/setup-django-backend@v1 + uses: maykinmedia/setup-django-backend@v1.1 with: - python-version: '3.10' + python-version: '3.12' setup-node: 'no' + working-directory: backend + nvmrc-custom-dir: backend - name: Run makemigrations to check for missing migrations + working-directory: backend run: | src/manage.py makemigrations \ --check \ diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 95082a784..689a069f1 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -31,6 +31,7 @@ jobs: uses: github/codeql-action/init@v1 with: languages: ${{ matrix.language }} + working-directory: backend - name: Autobuild uses: github/codeql-action/autobuild@v1 diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 707a1f81e..510e79a54 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -16,13 +16,17 @@ jobs: name: Install dev dependencies on MacOS runs-on: macos-latest + defaults: + run: + working-directory: backend + steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.12' cache: 'pip' - cache-dependency-path: 'requirements/*.txt' + cache-dependency-path: 'backend/requirements/*.txt' - name: Install OS-level packages run: | brew install pkg-config