Files
moss-kernel/.github/workflows/test.yml
Ashwin Naren 5c86ed2f37 add CI testing
2025-12-29 22:52:59 -08:00

39 lines
1.2 KiB
YAML

name: Test
on:
push:
branches: [ master ]
workflow_dispatch:
pull_request:
branches: [ master ]
jobs:
build-test:
runs-on: ubuntu-latest
strategy:
matrix:
smp-feature: [ "", "smp" ]
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Build dockerfile
run: docker build -t moss .
# If all features are disabled
- name: Run tests inside docker container
if: ${{ matrix.smp-feature == '' }}
run: docker run moss "/bin/bash" -c "cargo run -r --no-default-features -- /bin/usertest" >> out.log
# If any feature is enabled
- name: Run tests inside docker container
if: ${{ matrix.smp-feature == 'smp' }}
run: docker run moss "/bin/bash" -c "cargo run -r --no-default-features --features "${{ matrix.smp-feature }}" -- /bin/usertest" >> out.log
- name: Display test output
run: cat out.log
- name: Check for success line
run: grep -q "All tests passed in " out.log || (echo "Tests failed" && exit 1)
- name: Upload test output as artifact
uses: actions/upload-artifact@v6
with:
name: test-output-${{ matrix.smp-feature || 'up' }}
path: out.log