Skip to content

Commit

Permalink
better
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime-desroches committed Jul 20, 2024
1 parent 3c07c5a commit aa6c09d
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 22 deletions.
78 changes: 58 additions & 20 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,75 @@ name: tests
on: [push, pull_request]

jobs:
unit_tests:
name: unit tests

static_analysis:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Installing requirements
run:
python -m pip install -r requirements.txt
- name: Installing ubuntu requirements
run: "sudo apt-get install -y cppcheck"
- name: Static analysis
run: pre-commit run --all

scons_test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-20.04", "ubuntu-24.04", "macos-14"]
python: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Installing python requirements
run:
python -m pip install -r requirements.txt
- name: Installing ubuntu requirements
if: ${{startsWith(matrix.os, 'ubuntu')}}
run:
scripts/ubuntu_dependencies.sh
- name: Installing macos requirements
if: ${{startsWith(matrix.os, 'macos')}}
run:
scripts/macos_dependencies.sh
- name: Building
run: scons -j$(nproc || sysctl -n hw.logicalcpu)


full_tests:
runs-on: ubuntu-24.04
strategy:
matrix:
os: ["ubuntu-20.04", "ubuntu-24.04", "macos-14"]
python: ["3.11", "3.12"]
flags: ['', '--asan', '--ubsan']
backend: ['MSGQ', 'ZMQ']
python-version: ["3.11", "3.12"]
exclude:
- os: "macos-14"
backend: "MSGQ"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
python-version: ${{ matrix.python }}
- name: Installing ubuntu requirements
if: ${{startsWith(matrix.os, 'ubuntu')}}
run:
scripts/ubuntu_dependencies.sh
- name: Installing macos requirements
if: ${{startsWith(matrix.os, 'macos')}}
run:
scripts/macos_dependencies.sh
- name: Building msgq
run: |
export BUILD_TESTS=1
scripts/install_dependencies.sh
pip3 install --break-system-packages .[dev]
pip3 install -e .[dev]
- name: Python tests
run: ${{ matrix.backend }}=1 pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append
- name: C++ tests
Expand All @@ -31,16 +82,3 @@ jobs:
msgq/visionipc/test_runner
- name: Upload coverage
run: "bash <(curl -s https://codecov.io/bash) -v -F unit_tests_${{ matrix.backend }}"

static_analysis:
name: static analysis
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v3
- name: Building msgq
run: |
scripts/install_dependencies.sh
pip3 install --break-system-packages .[dev]
- name: Static analysis
# TODO: a package pre-commit installs has a warning, remove the unset once that's fixed
run: unset PYTHONWARNINGS && pre-commit run --all
4 changes: 2 additions & 2 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
env:
CIBW_BUILD: "${{ matrix.python.cp }}-${{ matrix.platform.target }}"
CIBW_ARCHS: "${{ matrix.platform.arch }}"
CIBW_BEFORE_ALL_LINUX: "bash {project}/scripts/manylinux_dependencies.sh"
CIBW_BEFORE_BUILD_MACOS: "bash {project}/scripts/macos_dependencies.sh"
CIBW_BEFORE_ALL_LINUX: "bash NO_CATCH2=1 {project}/scripts/manylinux_dependencies.sh"
CIBW_BEFORE_BUILD_MACOS: "bash NO_CATCH2=1 {project}/scripts/macos_dependencies.sh"
CIBW_MANYLINUX_X86_64_IMAGE: "manylinux_2_28"
CIBW_MANYLINUX_AARCH64_IMAGE: "manylinux_2_28"
#CIBW_TEST_COMMAND: "pip install -r {project}/requirements.txt && pytest {package}"
Expand Down
11 changes: 11 additions & 0 deletions scripts/macos_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
ROOT=$DIR/../

brew bundle --file=- <<-EOS
brew "zeromq"
cask "gcc-arm-embedded"
brew "gcc@13"
EOS

if [[ -n "$NO_CATCH2" ]]; then
cd /tmp
git clone -b v2.x --depth 1 https://github.com/catchorg/Catch2.git
cd Catch2
mv single_include/* "$ROOT"
rm -rf Catch2
fi
10 changes: 10 additions & 0 deletions scripts/ubuntu_dependencies.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
ROOT=$DIR/../

if [[ ! $(id -u) -eq 0 ]]; then
if [[ -z $(which sudo) ]]; then
Expand All @@ -10,3 +12,11 @@ fi

$SUDO apt-get update
$SUDO apt-get install -y --no-install-recommends clang opencl-headers libzmq3-dev ocl-icd-opencl-dev cppcheck

if [[ -n "$NO_CATCH2" ]]; then
cd /tmp
git clone -b v2.x --depth 1 https://github.com/catchorg/Catch2.git
cd Catch2
mv single_include/* "$ROOT"
rm -rf Catch2
fi

0 comments on commit aa6c09d

Please sign in to comment.