Skip to content

Prefer format or f-strings over percent formatting #205

Prefer format or f-strings over percent formatting

Prefer format or f-strings over percent formatting #205

Workflow file for this run

name: BTest
on:
pull_request:
push:
branches: [master]
tags:
- 'v*'
- '!v*-dev'
jobs:
Run-BTest:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up git config
# Set autocrlf mode to false so that actions/checkout doesn't
# modify the line endings in all of the files (mostly in the
# test Baselines) to be \r\n on Windows.
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
python -m pip install sphinx multiprocess
- name: Install dependencies (Linux/macOS)
if: matrix.os != 'windows-latest'
run: |
python -m pip install sphinx
- name: Rename wsl bash
# Something about github's runners sometimes puts WSL bash in the
# path before git bash. WSL bash has problems with permissions
# when it comes to writing files to the runner's disk, which
# causes tests to fail. This step renames WSL bash to something
# else so that git bash will execute instead.
if: matrix.os == 'windows-latest'
run: |
takeown /F C:\Windows\System32\bash.exe
icacls C:\Windows\System32\bash.exe /grant administrators:F
ren C:\Windows\System32\bash.exe wsl-bash.exe
- run: make test
Test-SetupPY:
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v4
- name: "Install pip and the btest package"
run: |
python3 -m pip install --upgrade pip
python3 -m pip install setuptools wheel
python3 -m pip install .
- name: "Run btests with installed version"
run: |
cd testing
which btest
make
- name: "Test building package"
run: |
python3 setup.py sdist bdist_wheel
Upload:
runs-on: ubuntu-latest
needs: [Run-BTest, Test-SetupPY]
if: github.repository == 'zeek/btest' && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- name: Check release version
# This fails e.g. if VERSION contains a dev commits suffix,
# since we don't want to push these to PyPI. Accepts two-
# and three-component version numbers (e.g. 1.0 and 1.0.1).
run: |
grep -E -x '[0-9]+\.[0-9]+(\.[0-9]+)?' VERSION
- name: Build sdist
# This places the sdist in the build folder, so we need to
# tell the action below where to find it since it defaults
# to dist/.
run: |
make dist
- name: Upload to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: build/
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}