small fixes for pd tests #1007
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Testing | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| workflow_dispatch: | |
| concurrency: | |
| # Skip intermediate builds: always. | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true # always cancle old runs on new push | |
| jobs: | |
| test: | |
| name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created | |
| actions: write | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: | |
| - 'lts' | |
| - '1' | |
| - 'pre' | |
| os: | |
| - ubuntu-latest | |
| # - macos-latest | |
| # - windows-latest | |
| arch: | |
| - x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: ${{ matrix.version }} | |
| arch: ${{ matrix.arch }} | |
| - name: Load Julia packages from cache | |
| id: julia-cache | |
| uses: julia-actions/cache@v2 | |
| - uses: hexaeder/julia-buildpkg@main | |
| - uses: julia-actions/julia-runtest@v1 | |
| with: | |
| coverage: false | |
| - name: Save Julia depot cache on cancel or failure | |
| id: julia-cache-save | |
| if: cancelled() || failure() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{ steps.julia-cache.outputs.cache-paths }} | |
| key: ${{ steps.julia-cache.outputs.cache-key }} | |
| test-coverage: | |
| name: Test Coverage | |
| runs-on: ubuntu-latest | |
| permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created | |
| actions: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: 1 | |
| arch: x64 | |
| - name: Load Julia packages from cache | |
| id: julia-cache | |
| uses: julia-actions/cache@v2 | |
| - uses: hexaeder/julia-buildpkg@main | |
| - uses: julia-actions/julia-runtest@v1 | |
| env: | |
| JULIA_COVERAGE: true | |
| with: | |
| coverage: true | |
| - uses: julia-actions/julia-processcoverage@v1 | |
| - uses: codecov/codecov-action@v4 | |
| with: | |
| files: lcov.info | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: false | |
| - name: Save Julia depot cache on cancel or failure | |
| id: julia-cache-save | |
| if: cancelled() || failure() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{ steps.julia-cache.outputs.cache-paths }} | |
| key: ${{ steps.julia-cache.outputs.cache-key }} | |
| Inspector-tests: | |
| name: NetworkDynamicsInspector.jl Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| DISPLAY: ":99" | |
| LIBGL_ALWAYS_SOFTWARE: "1" | |
| MESA_GL_VERSION_OVERRIDE: "4.5" | |
| MESA_GLSL_VERSION_OVERRIDE: "450" | |
| permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created | |
| actions: write | |
| contents: read | |
| steps: | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt update | |
| sudo apt install -y xvfb mesa-utils mesa-vulkan-drivers dbus | |
| - name: Start Virtual Display | |
| run: | | |
| Xvfb :99 -screen 0 1920x1080x24 & | |
| eval $(dbus-launch) | |
| export DBUS_SESSION_BUS_ADDRESS | |
| export DBUS_SESSION_BUS_PID | |
| - uses: actions/checkout@v4 | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: 1 | |
| - name: Load Julia packages from cache | |
| id: julia-cache | |
| uses: julia-actions/cache@v2 | |
| - uses: hexaeder/julia-buildpkg@main | |
| with: | |
| project: NetworkDynamicsInspector | |
| - name: Run headless test | |
| uses: GabrielBB/xvfb-action@v1 | |
| with: | |
| run: | | |
| julia --project=NetworkDynamicsInspector --color=yes -e "using Pkg; Pkg.test(coverage=false)" | |
| # - uses: julia-actions/julia-processcoverage@v1 | |
| # - uses: codecov/codecov-action@v4 | |
| # with: | |
| # files: lcov.info | |
| # token: ${{ secrets.CODECOV_TOKEN }} | |
| # fail_ci_if_error: false | |
| - name: Save Julia depot cache on cancel or failure | |
| id: julia-cache-save | |
| if: cancelled() || failure() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{ steps.julia-cache.outputs.cache-paths }} | |
| key: ${{ steps.julia-cache.outputs.cache-key }} | |
| PowerDynamics-test: | |
| name: PowerDynamics.jl test - Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| actions: write # needed to allow julia-actions/cache to proactively delete old caches that it has created | |
| contents: write | |
| pull-requests: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: | |
| - '1' | |
| os: | |
| - ubuntu-latest | |
| arch: | |
| - x64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: julia-actions/setup-julia@v2 | |
| with: | |
| version: ${{ matrix.version }} | |
| arch: ${{ matrix.arch }} | |
| - name: Load Julia packages from cache | |
| id: julia-cache | |
| uses: julia-actions/cache@v2 | |
| - uses: hexaeder/julia-buildpkg@main | |
| - name: Extract PowerDynamics branch from PR | |
| id: extract-branch | |
| run: | | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| PR_DATA=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
| -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}") | |
| PR_TITLE=$(echo "$PR_DATA" | jq -r '.title') | |
| PR_BODY=$(echo "$PR_DATA" | jq -r '.body') | |
| # Combine title and body for searching | |
| PR_TEXT="$PR_TITLE $PR_BODY" | |
| # Look for [powerdynamics:branch-name] pattern (case insensitive) | |
| BRANCH_MATCH=$(echo "$PR_TEXT" | grep -i -o "\[powerdynamics:[^]]*\]" | head -n1) | |
| if [[ -n "$BRANCH_MATCH" ]]; then | |
| BRANCH_NAME=$(echo "$BRANCH_MATCH" | sed 's/\[[Pp][Oo][Ww][Ee][Rr][Dd][Yy][Nn][Aa][Mm][Ii][Cc][Ss]:\([^]]*\)\]/\1/i') | |
| echo "Found PowerDynamics branch specification: $BRANCH_NAME" | |
| echo "powerdynamics_branch=$BRANCH_NAME" >> $GITHUB_OUTPUT | |
| else | |
| echo "No PowerDynamics branch specified, using main" | |
| echo "powerdynamics_branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| else | |
| echo "Not a pull request, using main branch" | |
| echo "powerdynamics_branch=main" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: actions/checkout@v4 | |
| with: | |
| repository: JuliaEnergy/PowerDynamics.jl | |
| ref: ${{ steps.extract-branch.outputs.powerdynamics_branch }} | |
| path: PowerDynamics | |
| - name: Run PowerDynamics tests | |
| shell: julia --project=PowerDynamics/test --color=yes {0} | |
| run: | | |
| using Pkg | |
| pkg"dev ." # dev NetworkDynamics | |
| pkg"instantiate" | |
| pkg"build" | |
| Pkg.test("PowerDynamics"; coverage=false) | |
| - name: Save Julia depot cache on cancel or failure | |
| id: julia-cache-save | |
| if: cancelled() || failure() | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{ steps.julia-cache.outputs.cache-paths }} | |
| key: ${{ steps.julia-cache.outputs.cache-key }} |