Skip to content

Commit

Permalink
ci: switch to e2e composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
foosel committed Nov 12, 2024
1 parent ebfc13a commit ad5c59b
Showing 1 changed file with 6 additions and 93 deletions.
99 changes: 6 additions & 93 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,106 +51,19 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.12"]
octoprint: ["master", "maintenance"]
steps:
- name: "⬇ Checkout OctoPrint with E2E tests"
uses: actions/checkout@v4
with:
repository: OctoPrint/OctoPrint
ref: maintenance
fetch-depth: 0
path: OctoPrint

- name: ⬇ Download build result
uses: actions/download-artifact@v4
with:
name: dist
path: dist

- name: πŸ— Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}

- name: πŸ— Install OctoPrint
working-directory: ./OctoPrint/
run: |
pip install .
pip install --force-reinstall ${{ github.workspace }}/dist/*.whl
- name: πŸ— Create base config for test server
run: |
mkdir e2econfig
cp -r OctoPrint/.github/fixtures/with_acl/* e2econfig
- name: πŸ— Install dummy mfa plugin if available
run: |
plugin="${{ github.workspace }}/OctoPrint/.github/fixtures/mfa_dummy"
if [ -f "$plugin" ]; then
mkdir -p e2econfig/plugins
cp -r "$plugin" "e2econfig/plugins/mfa_dummy"
fi
- name: πŸ— Prepare Playwright env
working-directory: ./OctoPrint/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: 🧰 Cache Playwright browser binaries
uses: actions/cache@v4
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: ./OctoPrint/tests/playwright
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install --with-deps
- name: πŸ— Install Playwright OS dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
working-directory: ./OctoPrint/tests/playwright
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
npx playwright install-deps
- name: 🎭 Run Playwright
working-directory: ./OctoPrint/tests/playwright
run: |
npx playwright test
env:
OCTOPRINT_SERVER_BASE: ${{ github.workspace }}/e2econfig
TEST_MFA: true

- 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@v4
if: always()
with:
name: playwright-report-py${{ matrix.python }}
path: tests/playwright/playwright-report

- name: ⬆ Upload OctoPrint logs
uses: actions/upload-artifact@v4
if: failure()
- name: 🎭 Run OctoPrint's E2E Tests
uses: OctoPrint/actions/e2e@main
with:
name: octoprint-logs-py${{ matrix.python }}
path: ${{ github.workspace }}/e2econfig/logs
ref: ${{ matrix.octoprint }}
deps: ${{ github.workspace }}/dist/*.whl

publish-on-testpypi:
name: πŸ“¦ Publish on TestPyPI
Expand All @@ -169,7 +82,7 @@ jobs:
- name: πŸ“¦ Publish to index
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository_url: https://test.pypi.org/legacy/
repository-url: https://test.pypi.org/legacy/

publish-on-pypi:
name: πŸ“¦ Publish tagged releases to PyPI
Expand Down

0 comments on commit ad5c59b

Please sign in to comment.