Skip to content

Bump actions/github-script from 6 to 7 #3

Bump actions/github-script from 6 to 7

Bump actions/github-script from 6 to 7 #3

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: 🔨 Build distribution
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: 🏗 Install build dependencies
run: |
python -m pip install wheel --user
- name: 🔨 Build a binary wheel and a source tarball
run: |
python setup.py sdist bdist_wheel
- name: ⬆ Upload build result
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
pre-commit:
name: 🧹 Pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: 🏗 Set up dev dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run pre-commit
run: |
pre-commit run --all-files --show-diff-on-failure
test-unit:
name: 🧪 Unit tests
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 🏗 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: 🏗 Set up test dependencies
run: |
pip install -e .[develop]
- name: 🚀 Run test suite
run: |
pytest
test-js-unit:
name: 🧪 JavaScript unit tests
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 🏗 Set up test dependencies
run: |
npm -g install [email protected]
- name: 🚀 Run helpers.js test suite
run: |
node-qunit-puppeteer tests/static/js/test-helpers.html
node-qunit-puppeteer tests/static/js/test-client-base.html
test-install:
name: 🧪 Installation tests
needs: build
strategy:
matrix:
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
installable: ["wheel", "sdist"]
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 🏗 Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: 🚀 Install wheel
if: matrix.installable == 'wheel'
run: |
pip install dist/OctoPrint-*-py2.py3-none-any.whl
- name: 🚀 Install source tarball
if: matrix.installable == 'sdist'
run: |
pip install dist/OctoPrint-*.tar.gz
test-e2e:
name: 🧪 E2E tests
needs: build
runs-on: ubuntu-latest
steps:
- name: ⬇ Checkout code
uses: actions/checkout@v3
- name: ⬇ Download build result
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 🏗 Set up Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7
- name: 🏗 Install OctoPrint build
run: |
pip install dist/OctoPrint-*-py2.py3-none-any.whl
- name: 🏗 Create base config for test server
run: |
mkdir e2econfig
cp -r .github/fixtures/with_acl/* e2econfig
- 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: 🧰 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: octoprint-logs
path: ${{ github.workspace }}/e2econfig/logs
publish-on-testpypi:
name: 📦 Publish on TestPyPI
if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint'
needs:
- pre-commit
- test-unit
- test-js-unit
- test-install
- test-e2e
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 📦 Publish to index
uses: pypa/gh-action-pypi-publish@master
continue-on-error: true
with:
password: ${{ secrets.testpypi_password }}
repository_url: https://test.pypi.org/legacy/
publish-on-pypi:
name: 📦 Publish tagged releases to PyPI
if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint'
needs: publish-on-testpypi
runs-on: ubuntu-latest
steps:
- name: ⬇ Download build result
uses: actions/download-artifact@v3
with:
name: dist
path: dist
- name: 📦 Publish to index
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}
notify-custopizer-build:
name: 📧 Notify OctoPi-UpToDate
if: github.event_name == 'release' && github.repository == 'OctoPrint/OctoPrint'
needs: publish-on-pypi
runs-on: ubuntu-latest
steps:
- name: 👀 Determine version
run: |
OCTOPRINT_VERSION=$(echo $GITHUB_REF | cut -d/ -f3)
echo "OCTOPRINT_VERSION=$OCTOPRINT_VERSION" >> $GITHUB_ENV
- name: 🚀 Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.REPODISPATCH_TOKEN }}
repository: OctoPrint/OctoPi-UpToDate
event-type: octoprint_release
client-payload: '{"version": "${{ env.OCTOPRINT_VERSION }}"}'