Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ci: update node from 20 to 24 #1525

ci: update node from 20 to 24

ci: update node from 20 to 24 #1525

Workflow file for this run

# see https://github.com/karlicoss/pymplate for up-to-date reference
name: CI
on:
push:
branches: '*'
tags: 'v[0-9]+.*' # only trigger on 'release' tags for PyPi
# Ideally I would put this in the pypi job... but github syntax doesn't allow for regexes there :shrug:
# Needed to trigger on others' PRs.
# Note that people who fork it need to go to "Actions" tab on their fork and click "I understand my workflows, go ahead and enable them".
pull_request:
# Needed to trigger workflows manually.
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: false
schedule:
- cron: '31 18 * * 5' # run every Friday
jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.12', '3.13', '3.14']
exclude: [
# windows runners are pretty scarce, so let's only run lowest and highest python version
{platform: windows-latest, python-version: '3.13'},
# same, macos is a bit too slow and ubuntu covers python quirks well
{platform: macos-latest , python-version: '3.13'},
]
runs-on: ${{ matrix.platform }}
# useful for 'optional' pipelines
# continue-on-error: ${{ matrix.platform == 'windows-latest' }}
steps:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests
- uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- uses: astral-sh/setup-uv@v7
with:
enable-cache: false # we don't have lock files during initial CI checkout, so can't use them as cache key
- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
# explicit bash command is necessary for Windows CI runner, otherwise it thinks it's cmd...
- run: bash .ci/run
env:
# only compute lxml coverage on ubuntu; it crashes on windows
CI_MYPY_COVERAGE: ${{ matrix.platform == 'ubuntu-latest' && '--cobertura-xml-report .coverage.mypy-all' || '' }}
- if: matrix.platform == 'ubuntu-latest' # no need to compute coverage for other platforms
uses: codecov/codecov-action@v6
with:
fail_ci_if_error: true # default false
token: ${{ secrets.CODECOV_TOKEN }}
flags: mypy-${{ matrix.python-version }}
files: .coverage.mypy-all/cobertura.xml
pypi:
# Do not run it for PRs/cron schedule etc.
# NOTE: release tags are guarded by on: push: tags on the top.
if: github.event_name == 'push' && (startsWith(github.event.ref, 'refs/tags/') || (github.event.ref == format('refs/heads/{0}', github.event.repository.master_branch)))
# Ugh, I tried using matrix or something to explicitly generate only test pypi or prod pypi pipelines.
# But github actions is so shit, it's impossible to do any logic at all, e.g. doesn't support conditional matrix, if/else statements for variables etc.
needs: [build, end2end_tests, install_and_run_test] # add all other jobs here
runs-on: ubuntu-latest
permissions:
# necessary for Trusted Publishing
id-token: write
steps:
# ugh https://github.com/actions/toolkit/blob/main/docs/commands.md#path-manipulation
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0 # pull all commits to correctly infer vcs version
- uses: actions/setup-python@v6
with:
python-version: '3.12'
- uses: astral-sh/setup-uv@v7
with:
enable-cache: false # we don't have lock files during initial CI checkout, so can't use them as cache key
- name: 'release to test pypi'
# always deploy merged master to test pypi
if: github.event.ref == format('refs/heads/{0}', github.event.repository.master_branch)
run: .ci/release --use-test-pypi
- name: 'release to prod pypi'
# always deploy tags to release pypi
if: startsWith(github.event.ref, 'refs/tags/')
run: .ci/release
###
build_extension:
env:
name: 'promnesia'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests
- uses: actions/setup-node@v6
with:
node-version: '24'
- run: extension/.ci/build --lint # debug version
- run: extension/.ci/build --lint --release
# TODO ugh. can't share github actions artifacts publicly...
# TODO for fuck's sake... why does it end up named as .zip.zip ????
- uses: actions/upload-artifact@v6
with:
name: '${{ env.name }}-chrome-debug-latest.zip'
path: 'extension/dist/artifacts/chrome/${{ env.name }}_dev_-*.zip'
- uses: actions/upload-artifact@v6
with:
name: '${{ env.name }}-chrome-release-latest.zip'
path: 'extension/dist/artifacts/chrome/${{ env.name }}-*.zip'
- uses: actions/upload-artifact@v6
with:
name: '${{ env.name }}-firefox-debug-latest.zip'
path: 'extension/dist/artifacts/firefox/${{ env.name }}_dev_-*.zip'
- uses: actions/upload-artifact@v6
with:
name: '${{ env.name }}-firefox-release-latest.zip'
path: 'extension/dist/artifacts/firefox/${{ env.name }}-*.zip'
# split in two pipelines to speedup running
end2end_tests:
strategy:
fail-fast: false
matrix:
browser: [chrome, firefox]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
fetch-depth: 0 # nicer to have all git history when debugging/for tests
- uses: actions/setup-node@v6
with:
node-version: '24'
- uses: astral-sh/setup-uv@v7
with:
enable-cache: false # we don't have lock files during initial CI checkout, so can't use them as cache key
- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- run: sudo apt update && sudo apt install --yes python3-doc # html files from this pacakge are used in tests
- run: extension/.ci/build # debug version, don't lint since build_extension already did that
# -n is used to run in parallel (pytes-xdist)
- run: bash .ci/run -e end2end -- -k ${{ matrix.browser }} -n auto
install_and_run_test:
# todo use setup-python thing?
# todo run on macos too?
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
submodules: recursive
- uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- run: .ci/github-ci-compat
- run: |
python3 -m pip install .
export PATH=.ci/fake-systemd:$PATH
tests/install_and_run