Skip to content

Commit

Permalink
Run CI for the both tags of the docker image. (#496)
Browse files Browse the repository at this point in the history
* Support both tags of docker image

* Cache API code
  • Loading branch information
mkundu1 authored Jun 13, 2022
1 parent c03cc86 commit c25ac42
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 15 deletions.
5 changes: 4 additions & 1 deletion .ci/pull_fluent_image.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import os

import docker

_IMAGE_NAME = "ghcr.io/pyansys/pyfluent:latest"
_IMAGE_TAG = os.getenv("FLUENT_IMAGE_TAG", "latest")
_IMAGE_NAME = f"ghcr.io/pyansys/pyfluent:{_IMAGE_TAG}"


def _is_newer_version_available(client: docker.DockerClient):
Expand Down
80 changes: 67 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ env:
# You should go up in number, if you go down (or repeat a previous value)
# you might end up reusing a previous cache if it haven't been deleted already.
# It applies 7 days retention policy by default.
RESET_EXAMPLES_CACHE: 3
RESET_EXAMPLES_CACHE: 4
API_CODE_CACHE: 0

jobs:
stylecheck:
Expand Down Expand Up @@ -93,6 +94,9 @@ jobs:
docs_build:
name: Build Documentation
runs-on: self-hosted
strategy:
matrix:
image-tag: [latest, solver-latest]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -127,52 +131,72 @@ jobs:
- name: Install pyfluent
run: make install

- name: Retrieve PyFluent version
run: |
echo "::set-output name=PYFLUENT_VERSION::$(python -c "from ansys.fluent.core import __version__; print(__version__)")"
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(__version__)")"
id: version

- name: Cache API Code
uses: actions/cache@v3
id: cache-api-code
with:
path:
src/ansys/fluent/core/datamodel
src/ansys/fluent/core/fluent_version.py
src/ansys/fluent/core/meshing/tui.py
src/ansys/fluent/core/solver/settings
src/ansys/fluent/core/solver/tui.py
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('codegen/**') }}-${{ github.sha }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('codegen/**') }}

- name: Login to GitHub Container Registry
if: steps.cache-api-code.outputs.cache-hit != 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}

- name: Pull Fluent docker image
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make docker-pull

- name: Retrieve PyFluent version
run: |
echo "::set-output name=PYFLUENT_VERSION::$(python -c "from ansys.fluent.core import __version__; print(__version__)")"
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(__version__)")"
id: version
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Run API codegen
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
PYFLUENT_LAUNCH_CONTAINER: 1
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Cache examples
uses: actions/cache@v3
with:
path: doc/source/examples
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ hashFiles('examples/**') }}-${{ github.sha }}
key: Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('examples/**') }}-${{ github.sha }}
restore-keys: |
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ hashFiles('examples/**') }}
Examples-v${{ env.RESET_EXAMPLES_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('examples/**') }}
- name: Build Documentation
run: make build-doc DOCS_CNAME=fluentdocs.pyansys.com
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Upload HTML Documentation
uses: actions/upload-artifact@v3
with:
name: HTML-Documentation
name: HTML-Documentation-tag-${{ matrix.image-tag }}
path: doc/_build/html
retention-days: 7

- name: Deploy
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
if: github.event_name == 'push' && contains(github.ref, 'refs/tags') && ${{ matrix.image-tag == 'latest'}}
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyfluent-docs
Expand All @@ -185,6 +209,9 @@ jobs:
name: Build and Unit Testing
needs: test-import
runs-on: self-hosted
strategy:
matrix:
image-tag: [latest, solver-latest]

steps:
- uses: actions/checkout@v3
Expand All @@ -208,22 +235,47 @@ jobs:
- name: Install pyfluent
run: make install

- name: Retrieve PyFluent version
run: |
echo "::set-output name=PYFLUENT_VERSION::$(python -c "from ansys.fluent.core import __version__; print(__version__)")"
echo "PYFLUENT version is: $(python -c "from ansys.fluent.core import __version__; print(__version__)")"
id: version

- name: Cache API Code
uses: actions/cache@v3
id: cache-api-code
with:
path:
src/ansys/fluent/core/datamodel
src/ansys/fluent/core/fluent_version.py
src/ansys/fluent/core/meshing/tui.py
src/ansys/fluent/core/solver/settings
src/ansys/fluent/core/solver/tui.py
key: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('codegen/**') }}-${{ github.sha }}
restore-keys: API-Code-v${{ env.API_CODE_CACHE }}-${{ steps.version.outputs.PYFLUENT_VERSION }}-${{ matrix.image-tag }}-${{ hashFiles('codegen/**') }}

- name: Login to GitHub Container Registry
if: steps.cache-api-code.outputs.cache-hit != 'true'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ secrets.GH_USERNAME }}
password: ${{ secrets.REPO_DOWNLOAD_PAT }}

- name: Pull Fluent docker image
- name: Pull Fluent docker image\
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make docker-pull
env:
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Run API codegen
if: steps.cache-api-code.outputs.cache-hit != 'true'
run: make api-codegen
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
PYFLUENT_LAUNCH_CONTAINER: 1
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Install again after codegen
run: |
Expand All @@ -235,11 +287,12 @@ jobs:
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Upload Coverage Results
uses: actions/upload-artifact@v3
with:
name: HTML-Coverage
name: HTML-Coverage-tag-${{ matrix.image-tag }}
path: cov_html
retention-days: 7

Expand All @@ -249,6 +302,7 @@ jobs:
twine check dist/*
- name: Upload package
if: ${{ matrix.image-tag == 'latest'}}
uses: actions/upload-artifact@v3
with:
name: PyFluent-packages
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/nightly-doc-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
jobs:
nightly_docs_build:
runs-on: self-hosted
strategy:
matrix:
image-tag: [latest, solver-latest]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -49,14 +52,17 @@ jobs:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
PYFLUENT_LAUNCH_CONTAINER: 1
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Build Documentation
run: make build-doc DOCS_CNAME=dev.fluentdocs.pyansys.com
env:
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER) }}
PYFLUENT_START_INSTANCE: 0
FLUENT_IMAGE_TAG: ${{ matrix.image-tag }}

- name: Deploy
if: ${{ matrix.image-tag == 'latest'}}
uses: JamesIves/[email protected]
with:
repository-name: pyansys/pyfluent-dev-docs
Expand Down
3 changes: 2 additions & 1 deletion codegen/tuigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@
)
_XML_HELPSTRINGS = {}

_FLUENT_IMAGE_NAME = "ghcr.io/pyansys/pyfluent:latest"
_FLUENT_IMAGE_TAG = os.getenv("FLUENT_IMAGE_TAG", "latest")
_FLUENT_IMAGE_NAME = f"ghcr.io/pyansys/pyfluent:{_FLUENT_IMAGE_TAG}"


def _copy_tui_help_xml_file():
Expand Down

0 comments on commit c25ac42

Please sign in to comment.