ci: Enable tests on Windows OS #657
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v4 | |
- name: Initialize CodeQL | |
uses: github/codeql-action/init@v3 | |
with: | |
languages: python | |
- name: Perform CodeQL Analysis | |
uses: github/codeql-action/analyze@v3 | |
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', '3.13'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
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 xml2rfc-fonts" | |
mkdir -p ~/.fonts/opentype ~/fonts | |
wget -q -O fonts.tar.gz https://github.com/ietf-tools/xml2rfc-fonts/archive/refs/tags/3.22.0.tar.gz | |
tar zxf fonts.tar.gz -C ~/fonts | |
mv ~/fonts/*/noto/* ~/.fonts/opentype/ | |
mv ~/fonts/*/roboto_mono/* ~/.fonts/opentype/ | |
mkdir -p /usr/share/fonts/truetype | |
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/ | |
echo "Reloading Font Cache..." | |
fc-cache -f -v | |
- name: Link Fonts | |
if: steps.cache-fonts-linux.outputs.cache-hit == 'true' | |
run: | | |
echo "Linking Fonts..." | |
mkdir -p /usr/share/fonts/truetype/ | |
ln -sf ~/.fonts/opentype/*.[to]tf /usr/share/fonts/truetype/ | |
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>=4.1.0" "weasyprint==61.2" "pydyf<0.10.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-12 | |
if: github.event_name == 'pull_request' | |
strategy: | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Fonts Cache | |
id: cache-fonts-mac | |
uses: pat-s/[email protected] | |
with: | |
path: ~/fonts | |
key: fonts-macos | |
- name: Download Fonts | |
run: | | |
echo "Downloading xml2rfc-fonts" | |
mkdir -p ~/fonts /Library/Fonts | |
wget -q -O fonts.tar.gz https://github.com/ietf-tools/xml2rfc-fonts/archive/refs/tags/3.22.0.tar.gz | |
tar zxf fonts.tar.gz -C ~/fonts | |
mv ~/fonts/*/noto/* /Library/Fonts/ | |
mv ~/fonts/*/roboto_mono/* /Library/Fonts/ | |
- name: Install dependencies | |
run: | | |
brew install pango pillow 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>=4.1.0" "weasyprint==61.2" "pydyf<0.10.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', '3.13'] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# - name: Install Fonts | |
# shell: pwsh | |
# run: | | |
# go install github.com/Crosse/font-install@latest | |
# $env:GOPATH = (go env GOPATH) | |
# $env:Path += ";$env:GOPATH\bin" | |
# font-install https://github.com/ietf-tools/xml2rfc-fonts/archive/refs/tags/3.22.0.zip | |
- name: Install Python dependencies | |
shell: pwsh | |
run: | | |
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>=4.1.0" "weasyprint==61.2" "pydyf<0.10.0" | |
- name: Generate Valid Tests | |
run: | | |
make yestests || true | |
cp tests/out/. tests/valid | |
- name: Test with tox | |
env: | |
PLATFORM: windows-latest | |
run: tox |