Test Podman Compose #297
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: Test Podman Compose | |
| on: | |
| schedule: # UTC at 0600 | |
| - cron: "0 6 * * *" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| packages: read | |
| pull-requests: read | |
| issues: read | |
| env: | |
| ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }} | |
| PYFLUENT_TIMEOUT_FORCE_EXIT: 30 | |
| PYFLUENT_LAUNCH_CONTAINER: 1 | |
| PYFLUENT_LOGGING: "DEBUG" | |
| PYFLUENT_WATCHDOG_DEBUG: "OFF" | |
| PYFLUENT_HIDE_LOG_SECRETS: 1 | |
| PYTHON_VERSION: "3.12" | |
| jobs: | |
| install-podman: | |
| name: "Install Podman" | |
| runs-on: [public-ubuntu-latest-8-cores] | |
| steps: | |
| - uses: gacts/install-podman@96e73075ee4b6669429c80458d063924472fb04d # v1.1.1 | |
| - run: podman compose version | |
| build_test: | |
| name: Build and Test | |
| needs: install-podman | |
| runs-on: [public-ubuntu-latest-8-cores] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - image-tag: v25.2.0 | |
| version: 252 | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Python | |
| uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0 | |
| with: | |
| python-version: ${{ env.PYTHON_VERSION }} | |
| - name: Cache pip | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0 | |
| with: | |
| path: ~/.cache/pip | |
| key: Python-${{ runner.os }}-${{ env.PYTHON_VERSION }}-${{ hashFiles('pyproject.toml') }} | |
| restore-keys: | | |
| Python-${{ runner.os }}-${{ env.PYTHON_VERSION }} | |
| - name: Add version information | |
| run: make version-info | |
| - name: Install pyfluent | |
| run: | | |
| pip install packaging | |
| make install | |
| - name: Retrieve PyFluent version | |
| run: | | |
| echo "PYFLUENT_VERSION=$(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" >> $GITHUB_OUTPUT | |
| echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(); print(__version__)" | tail -1)" | |
| id: version | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0 | |
| with: | |
| registry: ghcr.io | |
| username: ansys-bot | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Pull Fluent docker image | |
| env: | |
| IMAGE_TAG: ${{ matrix.image-tag }} | |
| run: | | |
| docker pull ghcr.io/ansys/pyfluent:${IMAGE_TAG} | |
| docker images | |
| - name: Transport docker image to podman | |
| env: | |
| IMAGE_TAG: ${{ matrix.image-tag }} | |
| run: | | |
| sudo podman pull docker-daemon:ghcr.io/ansys/pyfluent:${IMAGE_TAG} | |
| sudo podman images | |
| - name: Run API codegen | |
| run: make api-codegen | |
| - name: Print Fluent version info | |
| env: | |
| VERSION: ${{ matrix.image-tag }} | |
| run: | | |
| cat src/ansys/fluent/core/generated/fluent_version_${VERSION}.py | |
| - name: Install again after codegen | |
| run: | | |
| rm -rf dist | |
| make install > /dev/null | |
| - name: Run Fluent test script | |
| id: fluent_test | |
| run: | | |
| python tests/podman_compose.py | |
| continue-on-error: true | |
| - name: Cleanup previous containers | |
| if: always() | |
| run: | | |
| docker system prune -af | |
| sudo podman system prune -af | |
| - name: Send GitHub Actions Run Status Adaptive Card to Teams via Power Automate | |
| if: github.event_name == 'schedule' && steps.fluent_test.outcome != 'success' | |
| run: | # zizmor: ignore[template-injection] | |
| STATUS="Failure" | |
| RUN_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| COMMIT_URL="https://github.com/${{ github.repository }}/commit/${{ github.sha }}" | |
| JSON_PAYLOAD=$(jq -n \ | |
| --arg status "$STATUS" \ | |
| --arg branch "${{ github.ref_name }}" \ | |
| --arg commit "${{ github.sha }}" \ | |
| --arg commit_url "$COMMIT_URL" \ | |
| --arg run_url "$RUN_URL" \ | |
| '{ | |
| "attachments": [ | |
| { | |
| "contentType": "application/vnd.microsoft.card.adaptive", | |
| "content": { | |
| "type": "AdaptiveCard", | |
| "version": "1.2", | |
| "body": [ | |
| { | |
| "type": "TextBlock", | |
| "weight": "Bolder", | |
| "size": "Medium", | |
| "text": "${{ github.workflow }}" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "Status: \($status)" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "Branch: \($branch)" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "Commit: \($commit)" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "[View Commit](\($commit_url))" | |
| }, | |
| { | |
| "type": "TextBlock", | |
| "text": "[View Run](\($run_url))" | |
| } | |
| ] | |
| } | |
| } | |
| ] | |
| }' | |
| ) | |
| echo "Sending notification to Power Automate..." | |
| curl -X POST -H "Content-Type: application/json" -d "$JSON_PAYLOAD" "${{ secrets.PYFLUENT_WEBHOOK_URL }}" | |
| - name: Check test run status and fail the whole job if tests failed | |
| if: steps.fluent_test.outcome != 'success' | |
| run: | | |
| echo "One or more tests failed. Failing the job." | |
| exit 1 |