| 1 |
name: Pygments |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [master] |
| 6 |
tags: ['*'] |
| 7 |
pull_request: |
| 8 |
|
| 9 |
env: |
| 10 |
FORCE_COLOR: 1 |
| 11 |
|
| 12 |
permissions: |
| 13 |
contents: read # to fetch code (actions/checkout) |
| 14 |
|
| 15 |
jobs: |
| 16 |
build: |
| 17 |
runs-on: ${{ matrix.os }} |
| 18 |
strategy: |
| 19 |
fail-fast: false |
| 20 |
matrix: |
| 21 |
os: [windows-latest, ubuntu-latest, macos-latest] |
| 22 |
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"] |
| 23 |
# Run macOS CI only when pushing tags, not on every push/PR. |
| 24 |
# There seems not to be a prettier solution than this trick ... |
| 25 |
exclude: |
| 26 |
- os: ${{ !(github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')) && 'macos-latest' || 'dummy' }} |
| 27 |
|
| 28 |
steps: |
| 29 |
- name: Checkout repository |
| 30 |
uses: actions/checkout@v4 |
| 31 |
- name: Set up Python ${{ matrix.python-version }} |
| 32 |
uses: actions/setup-python@v5 |
| 33 |
with: |
| 34 |
python-version: ${{ matrix.python-version }} |
| 35 |
allow-prereleases: true |
| 36 |
cache: 'pip' |
| 37 |
- name: Install tox |
| 38 |
run: pip install -r requirements.txt |
| 39 |
- name: Test package |
| 40 |
run: tox -- -W error |
| 41 |
|
| 42 |
check: |
| 43 |
runs-on: ubuntu-latest |
| 44 |
steps: |
| 45 |
- name: Checkout repository |
| 46 |
uses: actions/checkout@v4 |
| 47 |
- uses: actions/setup-python@v5 |
| 48 |
with: |
| 49 |
python-version: "3.x" |
| 50 |
- name: Install tox |
| 51 |
run: pip install -r requirements.txt |
| 52 |
- name: Perform basic checks |
| 53 |
run: tox -e check |
| 54 |
if: runner.os == 'Linux' |
| 55 |
|
| 56 |
check-mapfiles: |
| 57 |
runs-on: ubuntu-latest |
| 58 |
steps: |
| 59 |
- name: Checkout repository |
| 60 |
uses: actions/checkout@v4 |
| 61 |
- uses: actions/setup-python@v5 |
| 62 |
with: |
| 63 |
python-version: "3.x" |
| 64 |
- name: Install tox |
| 65 |
run: pip install -r requirements.txt |
| 66 |
- name: Regenerate mapfiles |
| 67 |
run: tox -e mapfiles |
| 68 |
- name: Fail if mapfiles changed |
| 69 |
run: | |
| 70 |
if git ls-files -m | grep mapping; then |
| 71 |
echo 'Please run "tox -e mapfiles" and add the changes to a commit.' |
| 72 |
exit 1 |
| 73 |
fi |
| 74 |
|
| 75 |
lint: |
| 76 |
runs-on: ubuntu-latest |
| 77 |
steps: |
| 78 |
- name: Checkout repository |
| 79 |
uses: actions/checkout@v4 |
| 80 |
- uses: actions/setup-python@v5 |
| 81 |
with: |
| 82 |
python-version: "3.x" |
| 83 |
- name: Install tox |
| 84 |
run: pip install -r requirements.txt |
| 85 |
- name: Run regexlint |
| 86 |
run: tox -e regexlint |