Nightly Build and Test (Docker + Documentation) #424
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: Nightly Build and Test (Docker + Documentation) | |
| permissions: {} | |
| on: | |
| schedule: | |
| - cron: '0 0 * * *' # Nightly at midnight UTC | |
| workflow_dispatch: | |
| inputs: | |
| pydyna-run-tag: | |
| description: 'Container tag for development testing' | |
| required: false | |
| default: 'dev' | |
| skip-docker-build: | |
| description: 'Skip Docker image build and use existing images' | |
| required: false | |
| default: 'false' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FTP_USER: ${{ secrets.FTP_USER }} | |
| FTP_LOGIN: ${{ secrets.FTP_PASSWORD }} | |
| MAIN_PYTHON_VERSION: '3.13' | |
| PACKAGE_NAME: 'ansys-dyna-core' | |
| PACKAGE_NAMESPACE: 'ansys.dyna.core' | |
| DOCUMENTATION_CNAME: "dyna.docs.pyansys.com" | |
| REGISTRY: ghcr.io | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| LICENSE_SERVER: ${{ secrets.LICENSE_SERVER }} | |
| BOT_TOKEN: ${{ secrets.PYANSYS_CI_BOT_TOKEN }} | |
| BOT_USERNAME: ${{ secrets.PYANSYS_CI_BOT_USERNAME }} | |
| BOT_EMAIL: ${{ secrets.PYANSYS_CI_BOT_EMAIL }} | |
| jobs: | |
| docker-build-and-push: | |
| name: Build unified Docker image (SMP + MPP) and push | |
| runs-on: ubuntu-latest | |
| if: github.event.inputs.skip-docker-build != 'true' | |
| permissions: | |
| contents: read # Needed to checkout code | |
| packages: write # Needed for pushing Docker image to GHCR | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd | |
| with: | |
| persist-credentials: false | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0 | |
| - name: Set up Python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 | |
| with: | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| - name: Install PyDyna and dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install uv | |
| python -m venv .venv | |
| source .venv/bin/activate | |
| uv pip install -e .[tests] | |
| - name: Build unified Docker image | |
| env: | |
| DOCKER_IMAGE: pydyna-run:dev | |
| run: | | |
| echo "Building unified Docker image with both SMP and MPP LS-DYNA executables..." | |
| docker buildx build \ | |
| --build-arg FTP_USER=${FTP_USER} \ | |
| --build-arg FTP_LOGIN=${FTP_LOGIN} \ | |
| --file docker/run/Dockerfile \ | |
| --load \ | |
| -t "${DOCKER_IMAGE}" \ | |
| docker/run | |
| echo "Verifying Docker image was built successfully..." | |
| docker images "${DOCKER_IMAGE}" | |
| echo "Testing basic Docker image functionality..." | |
| docker run --rm -v $(pwd):/run "${DOCKER_IMAGE}" ls /run | |
| - name: Test with unified image | |
| env: | |
| PYDYNA_RUN_CONTAINER: pydyna-run:dev | |
| ANSYSLI_SERVERS: 2325@${{ env.LICENSE_SERVER }} | |
| ANSYSLMD_LICENSE_FILE: 1055@${{ env.LICENSE_SERVER }} | |
| LSTC_LICENSE: ansys | |
| run: | | |
| echo "Running tests with unified image (supports both SMP and MPP)..." | |
| source .venv/bin/activate | |
| python -m pytest -m 'run' -ra --cov=ansys.dyna.core --cov-report html:.cov/html --cov-report xml:.cov/xml --cov-report term -vv | |
| - name: Login to ghcr.io | |
| uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4.1.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Resolve Docker image tag | |
| id: resolve-tag | |
| env: | |
| INPUT_TAG: ${{ github.event.inputs.pydyna-run-tag || 'dev' }} | |
| run: | | |
| echo "TAG=$INPUT_TAG" >> $GITHUB_OUTPUT | |
| - name: Build and push Docker image to GHCR | |
| uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0 | |
| with: | |
| context: docker/run | |
| file: docker/run/Dockerfile | |
| push: true | |
| tags: ${{ env.REGISTRY }}/ansys/pydyna-run:${{ steps.resolve-tag.outputs.TAG }} | |
| build-args: | | |
| FTP_USER=${{ env.FTP_USER }} | |
| FTP_LOGIN=${{ env.FTP_LOGIN }} | |
| unit-tests: | |
| name: "Unit testing for ${{ matrix.os }} Python ${{ matrix.python-version }}" | |
| runs-on: ${{ matrix.os }} | |
| permissions: | |
| contents: read | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ['3.10', '3.11', '3.12', '3.13'] | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Run tests | |
| uses: ./.github/actions/unit-test | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| coverage-file: unittests | |
| pytest-markers: "not codegen and not run" | |
| doc-build: | |
| name: "Documentation build with examples" | |
| runs-on: [public-ubuntu-latest-8-cores] | |
| needs: [docker-build-and-push] | |
| if: github.event.inputs.skip-docker-build != 'true' || always() | |
| timeout-minutes: 720 | |
| permissions: | |
| contents: read # Needed to checkout code | |
| packages: read # Needed for pulling Docker container images from GHCR | |
| steps: | |
| - name: "Checkout project" | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: true | |
| - name: "Build documentation" | |
| uses: ./.github/actions/doc-build | |
| with: | |
| build-autokeywords-api: "True" | |
| pdf-pool-size: 15000000 | |
| pdf-string-vacancies: 90000 | |
| pdf-max-strings: 600000 | |
| pydyna-run-container: ${{ env.REGISTRY }}/ansys/pydyna-run:${{ github.event.inputs.pydyna-run-tag || 'dev' }} | |
| python-version: ${{ env.MAIN_PYTHON_VERSION }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| license-server: ${{ env.LICENSE_SERVER }} | |
| bot-token: ${{ env.BOT_TOKEN }} | |
| github-actor: ${{ github.actor }} | |
| persist-credentials: true | |
| use_cache_examples: false | |
| doc-deploy-dev: | |
| name: "Deploy development documentation" | |
| runs-on: ubuntu-latest | |
| needs: [doc-build] | |
| permissions: | |
| contents: write # Needed to push documentation to gh-pages branch | |
| pages: write # Needed to deploy to GitHub Pages | |
| steps: | |
| - uses: ansys/actions/doc-deploy-dev@12ca08fd7f0caa52076cca15c5621482646f8560 # v10.3.1 | |
| with: | |
| cname: ${{ env.DOCUMENTATION_CNAME }} | |
| token: ${{ env.BOT_TOKEN }} | |
| bot-user: ${{ env.BOT_USERNAME }} | |
| bot-email: ${{ env.BOT_EMAIL }} | |
| persist-credentials: true | |