Skip to content

[plugin] Update deprecated actions #7231

[plugin] Update deprecated actions

[plugin] Update deprecated actions #7231

Workflow file for this run

name: CI
on:
push:
branches:
- main
- next
pull_request:
branches:
- main
- next
workflow_dispatch:
release:
types: [published]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Node Setup
uses: ./.github/actions/node-setup
- name: Linting Application
run: npm run lint
- name: Checking if locale is updated
run: |-
npm run locale:extract
if [ "$(git diff --name-only)" ]; then
echo ""
echo "ERROR! Locale file update detected! Please run 'npm run locale:update'."
echo ""
exit 1
fi
test-python:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Install Python test dependencies
run: python -m pip install pytest octoprint --user
- name: Install package
run: python -m pip install . --user
- name: Run Python tests
run: pytest
build:
runs-on: ubuntu-latest
outputs:
wheel-id: ${{ steps.upload-wheel.outputs.artifact-id }}
steps:
- name: Checkout Repository
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Node Setup
uses: ./.github/actions/node-setup
- name: Building Application
run: npm run build
- name: 🏗 Set up PR environment
if: github.event_name == 'pull_request'
run: |
# use base ref of PR as branch name for versioning
echo "GIT_VERSION_BRANCH=${{ github.event.pull_request.base.ref }}" >> $GITHUB_ENV
- name: Install Python build dependencies
run: python -m pip install build wheel octoprint --user
- name: Building Python
run: python -m build .
- name: Upload Wheel
id: upload-wheel
uses: actions/upload-artifact@v7
with:
path: dist/*.whl
archive: false
- name: Upload Source Distribution
uses: actions/upload-artifact@v7
with:
path: dist/*.tar.gz
archive: false
test-e2e:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Node Setup
uses: ./.github/actions/node-setup
- name: Get Playwright version
id: playwright-version
run: |
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@v5
id: playwright-cache
with:
path: '~/.cache/ms-playwright'
key: '${{ runner.os }}-playwright-playwright-${{ env.PLAYWRIGHT_VERSION }}'
restore-keys: |
${{ runner.os }}-playwright-
- name: 🏗 Install Playwright browser binaries & OS dependencies
if: steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
echo "::group::Installing Playwright browser binaries & OS dependencies"
npx playwright install --with-deps
echo "::endgroup::"
- name: 🏗 Install Playwright OS dependencies
if: steps.playwright-cache.outputs.cache-hit == 'true'
shell: bash
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
echo "::group::Installing Playwright OS dependencies"
npx playwright install-deps
echo "::endgroup::"
- name: Download artifact
uses: actions/download-artifact@v8
id: download-wheel
with:
artifact-ids: ${{ needs.build.outputs.wheel-id }}
- name: Setup Python environment
run: |
echo "::group::Installing OctoPrint and Pytest"
python -m pip install pytest octoprint --user
echo "::endgroup::"
echo "::group::Installing OctoPrint plugin from wheel"
python -m pip install ${{ steps.download-wheel.outputs.download-path}}/*.whl --user
echo "::endgroup::"
- name: Get OctoPrint config dir
id: octoprint-config
run: |
echo "OCTOPRINT_CONFIG_DIR=${GITHUB_WORKSPACE}/tests/e2e/fixtures/config" >> $GITHUB_ENV
- name: Setup OctoPrint key
run: |
export OCTODOASH_API_KEY=$(yq '.admin[0].api_key' ${{env.OCTOPRINT_CONFIG_DIR}}/data/appkeys/keys.yaml)
echo OCTODASH_API_KEY=$OCTODOASH_API_KEY >> $GITHUB_ENV
- name: Run Playwright tests
run: npx playwright test
- name: ⬆ Upload Playwright report
uses: actions/upload-artifact@v6
if: always()
with:
# name: playwright-report ${{ inputs.suffix }}
name: playwright-report
path: playwright-report
- name: ⬆ Upload OctoPrint logs
uses: actions/upload-artifact@v6
if: failure()
with:
name: octoprint-logs
path: ${{ env.OCTOPRINT_CONFIG_DIR }}/logs
release:
runs-on: ubuntu-latest
if: github.event_name == 'release'
needs: build
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Download artifacts
uses: actions/download-artifact@v5
with:
name: build
- name: Upload release
env:
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
run: gh release upload ${{ github.ref }} *.deb *.yml