Skip to content

feat: Add support for Python 3.12 #446

feat: Add support for Python 3.12

feat: Add support for Python 3.12 #446

Workflow file for this run

name: Tests + Code Analysis
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
analyze:
name: Analyze Code
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
tests-linux:
name: Unit Tests (Linux)
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Fonts Cache
id: cache-fonts-linux
uses: pat-s/[email protected]
with:
path: ~/.fonts/opentype
key: fonts-linux
- name: Download Fonts
if: steps.cache-fonts-linux.outputs.cache-hit != 'true'
run: |
echo "Downloading Noto Font..."
mkdir -p ~/.fonts/opentype/noto
wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip
unzip -q Noto-unhinted.zip -d ~/.fonts/opentype/noto/
mkdir -p /usr/share/fonts/truetype/noto/
ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/
echo "Downloading Roboto Mono Font..."
mkdir -p ~/.fonts/opentype/roboto
wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip
unzip -q roboto-mono.zip -d ~/.fonts/opentype/roboto/
mkdir -p /usr/share/fonts/truetype/roboto/
ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/
echo "Reloading Font Cache..."
fc-cache -f -v
- name: Link Fonts
if: steps.cache-fonts-linux.outputs.cache-hit == 'true'
run: |
echo "Linking Noto Font..."
mkdir -p /usr/share/fonts/truetype/noto/
ln -sf ~/.fonts/opentype/noto/*.[to]tf /usr/share/fonts/truetype/noto/
echo "Linking Roboto Mono Font..."
mkdir -p /usr/share/fonts/truetype/roboto/
ln -sf ~/.fonts/opentype/roboto/*.[to]tf /usr/share/fonts/truetype/roboto/
echo "Reloading Font Cache..."
fc-cache -f -v
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -qy groff html2text python3-cffi python3-brotli libpango-1.0-0 libharfbuzz0b libpangoft2-1.0-0 libxml2-dev libxml2-utils libxslt-dev
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
- name: Generate Valid Tests
run: |
make yestests || true
cp -af tests/out/. tests/valid
- name: Test with tox
env:
PLATFORM: ubuntu-latest
run: tox
tests-macos:
name: Unit Tests (macOS)
runs-on: macos-latest
if: github.event_name == 'pull_request'
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ matrix.python-version }}
- name: Fonts Cache
id: cache-fonts-mac
uses: pat-s/[email protected]
with:
path: ~/new-fonts
key: fonts-macos
- name: Download Fonts
if: steps.cache-fonts-mac.outputs.cache-hit != 'true'
run: |
mkdir -p ~/new-fonts
cd ~/new-fonts
echo "Downloading Noto Font..."
wget -q https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip
unzip -o -q Noto-unhinted.zip -d /Library/Fonts/
echo "Downloading Roboto Mono Font..."
wget -q https://fonts.google.com/download?family=Roboto%20Mono -O roboto-mono.zip
unzip -o -q roboto-mono.zip -d /Library/Fonts/
- name: Extract Fonts
if: steps.cache-fonts-mac.outputs.cache-hit == 'true'
run: |
unzip -o -q ~/new-fonts/Noto-unhinted.zip -d /Library/Fonts/
unzip -o -q ~/new-fonts/roboto-mono.zip -d /Library/Fonts/
- name: Install dependencies
run: |
brew install pango libffi groff make diffutils
echo "Installing pip + wheel..."
python -m pip install --upgrade pip wheel
echo "Installing requirements.txt + test dependencies..."
python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
- name: Generate Valid Tests
run: |
echo "/usr/local/opt/make/libexec/gnubin" >> $GITHUB_PATH
make yestests || true
cp -af tests/out/. tests/valid
- name: Test with tox
env:
PLATFORM: macos-latest
run: |
echo "/usr/local/opt/make/libexec/gnubin" >> $GITHUB_PATH
tox
# tests-windows:
# name: Unit Tests (Windows)
# runs-on: windows-latest
# if: github.event_name == 'pull_request'
# strategy:
# matrix:
# python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
# steps:
# - name: Checkout repository
# uses: actions/checkout@v2
# - name: Setup Python ${{ matrix.python-version }}
# uses: actions/[email protected]
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install Fonts
# shell: pwsh
# working-directory: .github/scripts
# run: |
# Invoke-WebRequest -Uri 'https://github.com/ietf-tools/common/raw/main/scripts/font-install/font-install.exe' -OutFile font-install.exe
# & ./font-install.exe -debug https://fonts.google.com/download?family=Roboto%20Mono
# & ./font-install.exe -debug https://noto-website-2.storage.googleapis.com/pkgs/Noto-unhinted.zip
# - name: Install dependencies
# shell: pwsh
# run: |
# Invoke-WebRequest -Uri 'https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/download/2022-01-04/gtk3-runtime-3.24.31-2022-01-04-ts-win64.exe' -OutFile gtk.exe
# & ./gtk.exe /S
# choco install make
# echo "Installing pip + wheel..."
# python -m pip install --upgrade pip wheel
# echo "Installing requirements.txt + test dependencies..."
# python -m pip install -r requirements.txt tox tox-gh-actions certifi decorator dict2xml pyflakes "pypdf>=3.2.1" "weasyprint>=53.0,!=57.0,!=60.0"
# - name: Generate Valid Tests
# run: |
# make yestests || true
# cp tests/out/. tests/valid
# - name: Test with tox
# env:
# PLATFORM: windows-latest
# run: tox