diff --git a/.eslintrc.yaml b/.eslintrc.yaml index fae38e122..586cdd232 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -9,14 +9,3 @@ overrides: browser: true jquery: true es6: true - - files: - - "tests/cypress/**" - env: - node: true - es6: true - cypress/globals: true - extends: - - "plugin:cypress/recommended" - -plugins: - - cypress diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..97def2749 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Check for updates to GitHub Actions every week + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/fixtures/with_acl/config.yaml b/.github/fixtures/with_acl/config.yaml index d409a5735..c8d6efab9 100644 --- a/.github/fixtures/with_acl/config.yaml +++ b/.github/fixtures/with_acl/config.yaml @@ -4,10 +4,14 @@ devel: enableRateLimiter: false enableCsrfProtection: false plugins: - virtual_printer: - enabled: true + softwareupdate: + checks: + octoprint: + disabled: true tracking: enabled: false + virtual_printer: + enabled: true server: firstRun: false onlineCheck: diff --git a/.github/labeler.yml b/.github/labeler.yml index ed3f1c77a..79570485f 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -15,7 +15,10 @@ meta: ci/cd: - ".github/fixtures/**/*" - ".github/workflows/*" + - ".github/dependabot.yml" + - ".github/issue-validation.yml" - ".github/labeler.yml" + - ".github/pr-validation.yml" docker: - ".github/workflows/trigger_docker.yml" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dc5625260..05abded34 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -110,7 +110,6 @@ jobs: name: ๐Ÿงช E2E tests needs: build runs-on: ubuntu-latest - continue-on-error: true steps: - name: โฌ‡ Checkout code uses: actions/checkout@v3 @@ -120,11 +119,13 @@ jobs: with: name: dist path: dist + - name: ๐Ÿ— Set up Python 3.7 uses: actions/setup-python@v4 with: python-version: 3.7 - - name: ๐Ÿš€ Install wheel + + - name: ๐Ÿ— Install OctoPrint build run: | pip install dist/OctoPrint-*-py2.py3-none-any.whl @@ -133,30 +134,63 @@ jobs: mkdir e2econfig cp -r .github/fixtures/with_acl/* e2econfig - - name: ๐Ÿš€ Run Cypress - uses: cypress-io/github-action@v4.2.0 - with: - working-directory: tests/cypress - browser: chrome - start: "octoprint -b ${{ github.workspace }}/e2econfig serve --host 127.0.0.1 --port 5000" - wait-on: "http://127.0.0.1:5000/online.txt" - env: - CYPRESS_DEPLOYSENTINEL_ENABLED: "true" - CYPRESS_DEPLOYSENTINEL_UPLOAD_ON_PASSES: "true" - CYPRESS_DEPLOYSENTINEL_KEY: ${{ secrets.DEPLOYSENTINEL_APIKEY }} + - name: ๐Ÿ— Prepare Playwright env + working-directory: ./tests/playwright + run: | + npm ci + PLAYWRIGHT_VERSION=$(npm ls --json @playwright/test | jq --raw-output '.dependencies["@playwright/test"].version') + echo "PLAYWRIGHT_VERSION=$PLAYWRIGHT_VERSION" >> $GITHUB_ENV - - name: โฌ† Upload screenshots + - name: ๐Ÿงฐ Cache Playwright browser binaries + uses: actions/cache@v3 + id: playwright-cache + with: + path: "~/.cache/ms-playwright" + key: "${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}" + restore-keys: | + ${{ runner.os }}-playwright- + + - name: ๐Ÿ— Install Playwright browser binaries & OS dependencies + if: steps.playwright-cache.outputs.cache-hit != 'true' + working-directory: ./tests/playwright + run: | + npx playwright install --with-deps + + - name: ๐Ÿ— Install Playwright OS dependencies + if: steps.playwright-cache.outputs.cache-hit == 'true' + working-directory: ./tests/playwright + run: | + npx playwright install-deps + + - name: ๐ŸŽญ Run Playwright + working-directory: ./tests/playwright + run: | + npx playwright test + env: + OCTOPRINT_SERVER_BASE: ${{ github.workspace }}/e2econfig + + - name: ๐Ÿ”Ž Check octoprint.log for errors + run: | + log=${{ github.workspace }}/e2econfig/logs/octoprint.log + if grep "\- ERROR \-" $log; then + echo "::error::Errors were logged to octoprint.log" + grep -Pazo '(?m)^\N+\- ERROR \-\N*\n(^\N*?\n)*?(?=\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2},\d{3} \- )' $log + exit 1 + fi + + - name: โฌ† Upload Playwright report + uses: actions/upload-artifact@v3 + if: always() + with: + name: playwright-report + path: tests/playwright/playwright-report + + - name: โฌ† Upload OctoPrint logs uses: actions/upload-artifact@v3 if: failure() with: - name: cypress-screenshots - path: tests/cypress/screenshots - - name: โฌ† Upload videos - uses: actions/upload-artifact@v1 - if: always() - with: - name: cypress-videos - path: tests/cypress/videos + name: octoprint-logs + path: ${{ github.workspace }}/e2econfig/logs publish-on-testpypi: name: ๐Ÿ“ฆ Publish on TestPyPI @@ -208,7 +242,7 @@ jobs: OCTOPRINT_VERSION=$(echo $GITHUB_REF | cut -d/ -f3) echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV - name: ๐Ÿš€ Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.REPODISPATCH_TOKEN }} repository: OctoPrint/OctoPi-UpToDate diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 80ff4f957..e82f52fb9 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -10,11 +10,11 @@ jobs: name: ๐Ÿ”’ Lock issues & PRs closed over a year runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v2 + - uses: dessant/lock-threads@v4 with: github-token: ${{ github.token }} - issue-lock-comment: "" - pr-lock-comment: "" + issue-comment: "" + pr-comment: "" cleanup: name: ๐Ÿงน Close issues marked as incomplete & older than 14 days @@ -22,7 +22,7 @@ jobs: steps: - id: date run: | - echo "::set-output name=CUTOFF::`date --date='14 days ago' +'%Y-%m-%d'`" + echo "CUTOFF=`date --date='14 days ago' +'%Y-%m-%d'`" >> $GITHUB_OUTPUT - uses: OctoPrint/actions/close-by-query@main with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/nightly_merge.yml b/.github/workflows/nightly_merge.yml index e101eb722..d12689240 100644 --- a/.github/workflows/nightly_merge.yml +++ b/.github/workflows/nightly_merge.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 0 - name: ๐Ÿ”€ Merge master into maintenance - uses: robotology/gh-action-nightly-merge@v1.3.3 + uses: robotology/gh-action-nightly-merge@v1.4.0 with: stable_branch: "master" development_branch: "maintenance" @@ -24,7 +24,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: ๐Ÿ”€ Merge staging/bugfix into maintenance - uses: robotology/gh-action-nightly-merge@v1.3.3 + uses: robotology/gh-action-nightly-merge@v1.4.0 with: stable_branch: "staging/bugfix" development_branch: "maintenance" @@ -33,7 +33,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: ๐Ÿ”€ Merge staging/maintenance into maintenance - uses: robotology/gh-action-nightly-merge@v1.3.3 + uses: robotology/gh-action-nightly-merge@v1.4.0 with: stable_branch: "staging/bugfix" development_branch: "maintenance" @@ -42,7 +42,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: ๐Ÿ”€ Merge maintenance into devel - uses: robotology/gh-action-nightly-merge@v1.3.3 + uses: robotology/gh-action-nightly-merge@v1.4.0 with: stable_branch: "maintenance" development_branch: "devel" diff --git a/.github/workflows/pr_automation.yml b/.github/workflows/pr_automation.yml index a7f7ef7cf..9031376fe 100644 --- a/.github/workflows/pr_automation.yml +++ b/.github/workflows/pr_automation.yml @@ -8,7 +8,7 @@ jobs: pr-automation: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v3 + - uses: actions/labeler@v4 with: repo-token: "${{ secrets.GITHUB_TOKEN }}" diff --git a/.github/workflows/trigger_docker.yml b/.github/workflows/trigger_docker.yml index 1a86bb0c6..7b2cae198 100644 --- a/.github/workflows/trigger_docker.yml +++ b/.github/workflows/trigger_docker.yml @@ -15,7 +15,7 @@ jobs: if: github.repository == 'OctoPrint/OctoPrint' && github.event_name != 'push' steps: - name: ๐Ÿš€ Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.DOCKER_ACCESS_TOKEN }} repository: ${{ github.repository_owner }}/octoprint-docker @@ -27,7 +27,7 @@ jobs: if: github.repository == 'OctoPrint/OctoPrint' && github.event_name == 'push' && github.ref == 'refs/heads/maintenance' steps: - name: ๐Ÿš€ Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.DOCKER_ACCESS_TOKEN }} repository: ${{ github.repository_owner }}/octoprint-docker @@ -39,7 +39,7 @@ jobs: if: github.repository == 'OctoPrint/OctoPrint' && github.event_name == 'push' && github.ref == 'refs/heads/devel' steps: - name: ๐Ÿš€ Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.DOCKER_ACCESS_TOKEN }} repository: ${{ github.repository_owner }}/octoprint-docker diff --git a/.github/workflows/trigger_docs.yml b/.github/workflows/trigger_docs.yml index cb20852fb..c306faf5f 100644 --- a/.github/workflows/trigger_docs.yml +++ b/.github/workflows/trigger_docs.yml @@ -1,6 +1,10 @@ name: Trigger doc build on: push: + branches: + - master + - maintenance + - devel release: types: - released @@ -12,7 +16,7 @@ jobs: if: github.repository == 'OctoPrint/OctoPrint' steps: - name: ๐Ÿš€ Repository Dispatch - uses: peter-evans/repository-dispatch@v1 + uses: peter-evans/repository-dispatch@v2 with: token: ${{ secrets.REPODISPATCH_TOKEN }} repository: OctoPrint/docs.octoprint.org diff --git a/.gitignore b/.gitignore index c988710df..85ada50bb 100644 --- a/.gitignore +++ b/.gitignore @@ -40,7 +40,3 @@ pypy venv* testconf* - -node_modules -tests/cypress/screenshots -tests/cypress/videos diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e0676bbb0..6ca5d8d6f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,10 +67,10 @@ repos: - id: eslint additional_dependencies: - eslint@7.19.0 - - eslint-plugin-cypress@2.11.2 files: \.js$ exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|docs/|scripts/|translations/) - repo: https://github.com/codespell-project/codespell rev: v2.1.0 hooks: - id: codespell + exclude: ^(src/octoprint/vendor/|tests/static/js/lib|tests/util/_files|tests/playwright|scripts/) diff --git a/src/octoprint/__init__.py b/src/octoprint/__init__.py index 12500c83a..a41fb2a7c 100644 --- a/src/octoprint/__init__.py +++ b/src/octoprint/__init__.py @@ -322,6 +322,7 @@ def init_logging( "class": "octoprint.logging.handlers.TornadoLogHandler", "level": "DEBUG", "formatter": "tornado", + "when": "D", "backupCount": 1, "filename": os.path.join( settings.getBaseFolder("logs"), "tornado.log" @@ -331,6 +332,7 @@ def init_logging( "class": "octoprint.logging.handlers.AuthLogHandler", "level": "DEBUG", "formatter": "auth", + "when": "D", "backupCount": 1, "filename": os.path.join(settings.getBaseFolder("logs"), "auth.log"), }, diff --git a/src/octoprint/plugins/classicwebcam/templates/classicwebcam_webcam.jinja2 b/src/octoprint/plugins/classicwebcam/templates/classicwebcam_webcam.jinja2 index b90c7ecf6..1e6246124 100644 --- a/src/octoprint/plugins/classicwebcam/templates/classicwebcam_webcam.jinja2 +++ b/src/octoprint/plugins/classicwebcam/templates/classicwebcam_webcam.jinja2 @@ -1,6 +1,6 @@
-
+