Skip to content

Flexible logging trait, sync and non sync periodic updater, redis conn behind conn like trait to allow owned variant, timeout utility, misc. #125

Flexible logging trait, sync and non sync periodic updater, redis conn behind conn like trait to allow owned variant, timeout utility, misc.

Flexible logging trait, sync and non sync periodic updater, redis conn behind conn like trait to allow owned variant, timeout utility, misc. #125

Workflow file for this run

name: Tests
# Run when a new PR is created for main branch:
on:
pull_request:
branches:
- "main"
jobs:
# This can be used as the status check for branch protection, saves added each and every actual test job to the rules.
# https://github.com/marketplace/actions/alls-green
check_all_passed: # This job does nothing and is only used for the branch protection
if: always()
runs-on: ubuntu-latest
needs:
- qa
- tests_docs
- tests_python
- tests_js
- tests_py_rust
- tests_rust
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
id: all-green
with:
jobs: ${{ toJSON(needs) }}
# Everything but qa might be skipped if nothing's changed in its folder:
allowed-skips: tests_docs, tests_python, tests_js, tests_py_rust, tests_rust,
qa:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-python
with:
pdm: true
# Js project
- name: "Install Bun, no npm should be needed"
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install js dependencies
run: |
cd ./js
bun install
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
qa: true
- uses: ./.github/actions/install-pre-commit
- name: Run QA
run: |
./dev_scripts/test.sh qa
whos_changed:
uses: ./.github/workflows/whos-changed.yml
tests_docs:
name: Test documentation build
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.docs-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Basic python always needed:
- uses: ./.github/actions/install-python
with:
pdm: false
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: "3.12"
cache: true
cache-dependency-path: 'docs/pdm.lock'
- name: Install Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
qa: true
- name: Install dependencies
run: |
pdm sync -p ./docs
- name: Test docs
run: |
./dev_scripts/test.sh docs
tests_python:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.py-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu test on all versions:
- {python: "3.11", os: "ubuntu-latest", coverage: false}
- {python: "3.12", os: "ubuntu-latest", coverage: true} # Only run coverage check on the newest version to save time
# Make sure other os types work on newest version:
# - { python: "3.12", os: "macOS-latest" } # Mac uses 10x minutes, skipping for now considering devs usually use mac and v similar to linux
- {python: "3.12", os: "windows-latest", coverage: false,} # 2x minutes, most different architecture so worth testing
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
with:
python-version: ${{ matrix.python }}
cache: true
cache-dependency-path: 'py/pdm.lock'
- name: Install dependencies
run: |
pdm sync -p ./py -G:all
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
COVERAGE=${{ matrix.coverage }} ./dev_scripts/test.sh py
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
$env:COVERAGE=${{ matrix.coverage }}
bash ./dev_scripts/test.sh py
tests_js:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.js-changed == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
# Js project
- name: "Install Bun, no npm should be needed"
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Install js dependencies
run: |
cd ./js
bun install
- name: Run tests
run: |
./dev_scripts/test.sh js
tests_py_rust:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.py-rust-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Ubuntu test on all versions:
- {python: "3.11", os: "ubuntu-latest"}
- {python: "3.12", os: "ubuntu-latest"}
# Make sure other os types work on newest version:
# - { python: "3.12", os: "macOS-latest" } # Mac uses 10x minutes, skipping for now considering devs usually use mac and v similar to linux
- {python: "3.12", os: "windows-latest",} # 2x minutes, most different architecture so worth testing
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
- uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python }}"
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
test: true
- name: Setup venv (problems with the automatic creating in scripts as it uses pipx and for some
reason ends with wrong py version)
run: |
pip install virtualenv
python -m virtualenv ./py_rust/.venv
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
./dev_scripts/test.sh py_rust
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
bash ./dev_scripts/test.sh py_rust
tests_rust:
needs: whos_changed
# Only run if applicable things have changed:
if: needs.whos_changed.outputs.rust-changed == 'true'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# Run on both linux and windows (dev testing on mac and much more expensive in terms of build minutes),
# windows most likely to fail unexpectedly.
os:
- ubuntu-latest
- windows-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/install-redis
# Basic python always needed:
- uses: ./.github/actions/install-python
with:
pdm: false
- uses: ./.github/actions/install-rust
with:
secret_config_toml: ${{ secrets.CUSTOM_RUST_CONFIG_TOML }}
test: true
- name: Run tests (linux)
if: matrix.os == 'ubuntu-latest'
run: |
./dev_scripts/test.sh rust --no-fail-fast
- name: Run tests (windows)
if: matrix.os == 'windows-latest'
run: |
bash ./dev_scripts/test.sh rust --no-fail-fast