Skip to content

[pre-commit.ci] pre-commit autoupdate #260

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #260

Workflow file for this run

name: BamBam
on: [push, pull_request]
permissions:
contents: read
jobs:
checks:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Lint with flake8
run: |
flake8 . --show-source --statistics
- name: Lint with autopep8
run: |
autopep8 -d *.py | awk 'BEGIN{had_data=0}{print;had_data=1}END{exit had_data}'
- name: Run unit tests
run: |
python -m unittest *_test.py
e2e:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
env:
AUTOPKGTEST_TMP: /tmp
AUTOPKGTEST_BAMBAM_PROGRAM: ./bambam.py
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install GUI packages
run: |
sudo apt-get update
sudo apt-get install -y xvfb xauth imagemagick xdotool sox
- name: Run regular GUI tests
run: ./run_e2e_test.sh regular
- name: Run GUI tests in dark mode
run: ./run_e2e_test.sh dark --no-expect-light-mode -- --dark
- name: Run GUI tests with deterministic sounds
run: ./run_e2e_test.sh deterministic -- --deterministic-sounds
- name: Run GUI tests muted
run: ./run_e2e_test.sh muted --no-expect-sounds -- --mute
- name: Run GUI tests muted just initially
run: ./run_e2e_test.sh start-muted -- --mute
- name: Run GUI tests without sound support
run: ./run_e2e_test.sh no-audio --no-expect-audio-output --sdl-audio-driver invalid
- name: Save artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: test-artifacts-${{ matrix.python-version }}
path: artifacts
nofonts:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"] # Just latest to keep number of combinations down.
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Install GUI packages
run: |
sudo apt-get install -y xvfb xauth
- name: Run test for font absence
run: |
export AUTOPKGTEST_ARTIFACTS=`pwd`/artifacts
mkdir -p $AUTOPKGTEST_ARTIFACTS
export AUTOPKGTEST_TMP=/tmp
# Prepare permissions for deleting freetype.
for lib in $(./test/find-freetype.sh echo); do
dir="$(dirname "${lib}")"
echo "Granting write permission on ${dir}" >&2
sudo chmod a+w "${dir}"
done
xvfb-run \
-e $AUTOPKGTEST_ARTIFACTS/xvfb-run.stderr \
-s "-screen 0 1024x768x24 -fbdir $AUTOPKGTEST_TMP" \
./test/find-freetype.sh rm-and-run \
timeout -v -k 5 10 \
./test/redirect-stderr-and-run.sh errors.txt ./bambam.py || echo Bambam under xvfb exited code $?
if grep -q 'Error, pygame fonts not available.' errors.txt; then
echo "Expected font absence message found."
exit 0
fi
echo "Expected font absence message not found."
cat errors.txt
exit 1