Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add github action to run pytest on posix build #53

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Build S32k and posix platform

on: [push, pull_request]
on: [workflow_call, push, pull_request]

jobs:
run-command:
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/run-pytest-on-posix.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Run pytest for posix platform

on: [push, pull_request]

jobs:
cmake-build:
uses: ./.github/workflows/build.yml

run-pytest-on-posix:
runs-on: ubuntu-latest
needs: cmake-build

steps:

- name: Install missing kernel module file for vcan
run: sudo apt install linux-modules-extra-$(uname -r)

- name: Install can kernel modules
run: |
sudo modprobe can
sudo modprobe can-raw
sudo modprobe vcan

- name: Set up vcan0 interface
run: |
sudo ip link add dev vcan0 type vcan
sudo ip link set vcan0 mtu 16
sudo ip link set up vcan0

- name: Show all interface info, vcan0 should be set up
run: ip a

- name: Checkout repository
uses: actions/checkout@v4

- name: Restore cached posix build
id: restore-cached-posix-build
uses: actions/cache/restore@v3
with:
path: |
cmake-build-posix
cmake-build-s32k148
key: ${{ runner.os }}-cmake-posix-20-${{ hashFiles('**/*.cpp', '**/*.h', '**/*.cmake', '**/*.txt', '**/*.c', '**/*.s', 'admin/cmake/ArmNoneEabi.cmake') }}
fail-on-cache-miss: true

- name: Set up python 3.10
if: ${{ steps.restore-cached-posix-build.outputs.cache-hit == 'true' }}
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install python dependencies for tests
if: ${{ steps.restore-cached-posix-build.outputs.cache-hit == 'true' }}
run: |
pip install -r test/pyTest/requirements.txt
cd tools/UdsTool
pip install .

- name: Run tests
if: ${{ steps.restore-cached-posix-build.outputs.cache-hit == 'true' }}
run: |
cd test/pyTest
pytest --target=posix
Loading