Skip to content

Commit

Permalink
first version of external project test
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgeorge309 committed Oct 29, 2024
1 parent 728bdb6 commit 8b267bc
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 9 deletions.
99 changes: 99 additions & 0 deletions .github/workflows/external.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: External projects test

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
workflow_dispatch:

jobs:
create-combinations:
name: Create project combinations
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install locally
run: python3 -m pip install -e .

- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: list all test sessions
id: set-matrix
run: |
projects=$(opp_env list --flat | grep -P '^(?!(omnetpp|inet|simulte|simu5g|veins))')
if [ -z "$projects" ]; then
echo "::set-output name=matrix::[]"
else
# Create a JSON array directly
json_array=$(echo "$projects" | awk '{printf "\"%s\",", $0}' | sed 's/,$//')
json_array="[$json_array]"
echo "::set-output name=matrix::$json_array"
fi
- name: Debug output
run: echo "${{ steps.set-matrix.outputs.matrix }}"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}

smoketests:
needs: create-combinations
strategy:
fail-fast: false
matrix:
projects: ${{ fromJson(needs.create-combinations.outputs.matrix) }}
name: ${{ matrix.projects }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"

- name: Install locally
run: python3 -m pip install -e .

- uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Xvfb
run: |
# Install Xvfb
sudo apt-get update
sudo apt-get install -y xvfb
# kludge: remove libc++ so that projects don't link with it
sudo apt remove --purge libc++1*
# Start Xvfb
Xvfb :99 -screen 0 1024x768x24 &
# Set DISPLAY variable
echo "DISPLAY=:99" >> $GITHUB_ENV
- name: Run test
working-directory: tests
run: ./project_tester install ${{ matrix.projects }}

- name: Show output
if: always()
run: |
echo "::group::Output"
cat tests/logs/${{ matrix.projects }}.out || echo '(no output)'
echo "::endgroup::"
echo "::group::Error"
cat tests/logs/${{ matrix.projects }}.err || echo '(no output)'
echo "::endgroup::"
4 changes: 2 additions & 2 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Publish opp_env Python distribution to PyPI

on:
push:
tags: [ '*' ] # only publish to PyPI on tag push
# push:
# tags: [ '*' ] # only publish to PyPI on tag push
workflow_dispatch:

jobs:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/smoketest.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Smoke test

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
# push:
# branches:
# - main
# - dev
# pull_request:
# branches:
# - main
workflow_dispatch:

jobs:
Expand Down

0 comments on commit 8b267bc

Please sign in to comment.