Skip to content

Commit

Permalink
Merge branch 'main' into feat/enable-prepare-repair-tools-in-core-ser…
Browse files Browse the repository at this point in the history
…vice
  • Loading branch information
RobPasMue authored Dec 18, 2024
2 parents 34ca71c + 9f07547 commit 76af32f
Show file tree
Hide file tree
Showing 14 changed files with 199 additions and 37 deletions.
107 changes: 102 additions & 5 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main

env:
MAIN_PYTHON_VERSION: '3.13'
MAIN_PYTHON_VERSION: '3.12'
PACKAGE_NAME: 'ansys-geometry-core'
DOCUMENTATION_CNAME: 'geometry.docs.pyansys.com'
ANSRV_GEO_IMAGE: 'ghcr.io/ansys/geometry'
Expand Down Expand Up @@ -102,20 +102,71 @@ jobs:
directory: docker
recursive: true

manifests:
name: Check Docker manifests
runs-on: ubuntu-latest
outputs:
skip_dms: ${{ steps.services.outputs.skip_dms }}
skip_core_windows: ${{ steps.services.outputs.skip_core_windows }}
skip_core_linux: ${{ steps.services.outputs.skip_core_linux }}
strategy:
matrix:
include:
- container-stable: "windows-latest"
container-unstable: "windows-latest-unstable"
service: "dms"
service-name: "Windows DMS"
- container-stable: "core-windows-latest"
container-unstable: "core-windows-latest-unstable"
service: "core_windows"
service-name: "Windows Core Service"
- container-stable: "core-linux-latest"
container-unstable: "core-linux-latest-unstable"
service: "core_linux"
service-name: "Linux Core Service"
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check ${{ matrix.service-name }} manifest
id: services
run: |
docker manifest inspect ghcr.io/ansys/geometry:${{ matrix.container-stable }} > ${{ matrix.container-stable }}.json
docker manifest inspect ghcr.io/ansys/geometry:${{ matrix.container-unstable }} > ${{ matrix.container-unstable }}.json || true
# Verify that the unstable manifest exists - otherwise create an empty file
if [ ! -f ${{ matrix.container-unstable }}.json ]; then
touch ${{ matrix.container-unstable }}.json
fi
# Check if the manifests are the same (and if so, create an output that will skip the next job)
if diff ${{ matrix.container-stable }}.json ${{ matrix.container-unstable }}.json; then
echo "${{ matrix.service-name }} container manifests are the same... skipping"
echo "skip_${{ matrix.service }}=1" >> "$GITHUB_OUTPUT"
else
echo "${{ matrix.service-name }} container manifests are different"
echo "skip_${{ matrix.service }}=0" >> "$GITHUB_OUTPUT"
fi
# =================================================================================================
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
# =================================================================================================

testing-windows:
name: Testing and coverage (Windows)
needs: [smoke-tests]
needs: [smoke-tests, manifests]
# runs-on: [self-hosted, Windows, pygeometry]
runs-on: # TODO: Waiting for ansys-network runner to be updated
group: pyansys-self-hosted
labels: [self-hosted, Windows, pygeometry]
continue-on-error: ${{ matrix.experimental }}
env:
SKIP_UNSTABLE: ${{ vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY == 1 && matrix.experimental }}
SKIP_UNSTABLE: false
PYVISTA_OFF_SCREEN: true
strategy:
fail-fast: false
Expand All @@ -131,6 +182,30 @@ jobs:
experimental: true

steps:
- name: Calculate SKIP_UNSTABLE
if: matrix.experimental
run: |
# Choose the manifests output to consider (for DMS or Core service)
# based on the matrix value
if ("${{ matrix.docker-image }}" -eq "windows-latest-unstable") {
$ImagesAreEqual = ${{ needs.manifests.outputs.skip_dms }}
} elseif ("${{ matrix.docker-image }}" -eq "core-windows-latest-unstable") {
$ImagesAreEqual = ${{ needs.manifests.outputs.skip_core_windows }}
} else {
Write-Output "Unknown docker image"
exit 1
}
$A = $env:SKIP_UNSTABLE_CONTAINERS_TEMPORARILY -eq 1
$B = $ImagesAreEqual -eq 1
# Calculate the logical expression
$Result = ($A -or $B).ToString().ToLower()
# Export it as an environment variable with true/false value
Write-Output "SKIP_UNSTABLE=$Result" | Out-File -FilePath $env:GITHUB_ENV -Append
Write-Output "SKIP_UNSTABLE will be: $Result"
- uses: actions/checkout@v4
if: env.SKIP_UNSTABLE == 'false'

Expand Down Expand Up @@ -329,11 +404,11 @@ jobs:

testing-linux:
name: Testing and coverage (Linux)
needs: [smoke-tests]
needs: [smoke-tests, manifests]
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
env:
SKIP_UNSTABLE: ${{ vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY == 1 && matrix.experimental }}
SKIP_UNSTABLE: false
strategy:
fail-fast: false
matrix:
Expand All @@ -344,6 +419,28 @@ jobs:
experimental: true

steps:
- name: Calculate SKIP_UNSTABLE
if: matrix.experimental
run: |
# Choose the manifests output to consider (for Core service)
# based on the matrix value
if [[ "${{ matrix.docker-image }}" == "core-linux-latest-unstable" ]]; then
ImagesAreEqual=${{ needs.manifests.outputs.skip_core_linux }}
else
echo "Unknown docker image"
exit 1
fi
A=$([[ "$SKIP_UNSTABLE_CONTAINERS_TEMPORARILY" == "1" ]] && echo true || echo false)
B=$([[ "$ImagesAreEqual" == "1" ]] && echo true || echo false)
# Calculate the logical expression
Result=$([[ "$A" == true || "$B" == true ]] && echo true || echo false)
# Export it as an environment variable with true/false value
echo "SKIP_UNSTABLE=$Result" >> $GITHUB_ENV
echo "SKIP_UNSTABLE will be: $Result"
- name: Login in Github Container registry
if: env.SKIP_UNSTABLE == 'false'
uses: docker/login-action@v3
Expand Down
100 changes: 77 additions & 23 deletions .github/workflows/nightly_docker_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Nightly Server test - Latest build
name: Unstable build tests and promotion
on:
workflow_dispatch:
inputs:
Expand All @@ -21,7 +21,7 @@ on:
- v*

env:
MAIN_PYTHON_VERSION: '3.13'
MAIN_PYTHON_VERSION: '3.12'
ANSRV_GEO_IMAGE_WINDOWS_TAG: ghcr.io/ansys/geometry:windows-latest-unstable
ANSRV_GEO_IMAGE_WINDOWS_CORE_TAG: ghcr.io/ansys/geometry:core-windows-latest-unstable
ANSRV_GEO_IMAGE_LINUX_CORE_TAG: ghcr.io/ansys/geometry:core-linux-latest-unstable
Expand All @@ -35,13 +35,65 @@ concurrency:

jobs:

manifests:
name: Check Docker manifests
runs-on: ubuntu-latest
outputs:
skip_dms: ${{ steps.services.outputs.skip_dms }}
skip_core_windows: ${{ steps.services.outputs.skip_core_windows }}
skip_core_linux: ${{ steps.services.outputs.skip_core_linux }}
strategy:
matrix:
include:
- container-stable: "windows-latest"
container-unstable: "windows-latest-unstable"
service: "dms"
service-name: "Windows DMS"
- container-stable: "core-windows-latest"
container-unstable: "core-windows-latest-unstable"
service: "core_windows"
service-name: "Windows Core Service"
- container-stable: "core-linux-latest"
container-unstable: "core-linux-latest-unstable"
service: "core_linux"
service-name: "Linux Core Service"
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Check ${{ matrix.service-name }} manifest
id: services
run: |
docker manifest inspect ghcr.io/ansys/geometry:${{ matrix.container-stable }} > ${{ matrix.container-stable }}.json
docker manifest inspect ghcr.io/ansys/geometry:${{ matrix.container-unstable }} > ${{ matrix.container-unstable }}.json || true
# Verify that the unstable manifest exists - otherwise create an empty file
if [ ! -f ${{ matrix.container-unstable }}.json ]; then
touch ${{ matrix.container-unstable }}.json
fi
# Check if the manifests are the same (and if so, create an output that will skip the next job)
if diff ${{ matrix.container-stable }}.json ${{ matrix.container-unstable }}.json; then
echo "${{ matrix.service-name }} container manifests are the same... skipping"
echo "skip_${{ matrix.service }}=1" >> "$GITHUB_OUTPUT"
else
echo "${{ matrix.service-name }} container manifests are different"
echo "skip_${{ matrix.service }}=0" >> "$GITHUB_OUTPUT"
fi
# =================================================================================================
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# =================================================================================================

windows-dms-tests:
name: Nightly unstable testing - Windows DMS
if: vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY != 1
name: Windows DMS
needs: manifests
if: needs.manifests.outputs.skip_dms == 0
runs-on: [self-hosted, Windows, pygeometry]
env:
PYVISTA_OFF_SCREEN: true
Expand Down Expand Up @@ -127,12 +179,12 @@ jobs:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"summary": "Nightly Tests for Windows DMS failing",
"summary": "Unstable build tests for Windows DMS failing",
"themeColor": "f44336",
"title": "PyAnsys Geometry Nightly Tests - Windows DMS failing",
"title": "PyAnsys Geometry unstable build tests - Windows DMS failing",
"sections": [
{
"activityTitle": "Windows DMS nightly tests are failing",
"activityTitle": "Windows DMS unstable build tests are failing",
"activitySubtitle": "Check the run for more details: https://github.com/ansys/pyansys-geometry/actions/runs/${{ github.run_id }}",
"facts": [
{
Expand All @@ -145,8 +197,9 @@ jobs:
}
windows-core-tests:
name: Nightly unstable testing - Windows Core Service
if: vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY != 1
name: Windows Core Service
needs: manifests
if: needs.manifests.outputs.skip_core_windows == 0
# runs-on: [self-hosted, Windows, pygeometry]
runs-on: # TODO: Waiting for ansys-network runner to be updated
group: pyansys-self-hosted
Expand Down Expand Up @@ -235,12 +288,12 @@ jobs:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"summary": "Nightly Tests for Windows Core Service failing",
"summary": "Unstable build tests for Windows Core Service failing",
"themeColor": "f44336",
"title": "PyAnsys Geometry Nightly Tests - Windows Core Service failing",
"title": "PyAnsys Geometry unstable build tests - Windows Core Service failing",
"sections": [
{
"activityTitle": "Windows Core Service nightly tests are failing",
"activityTitle": "Windows Core Service unstable build tests are failing",
"activitySubtitle": "Check the run for more details: https://github.com/ansys/pyansys-geometry/actions/runs/${{ github.run_id }}",
"facts": [
{
Expand All @@ -258,8 +311,9 @@ jobs:
# =================================================================================================

linux-tests:
name: Nightly unstable testing - Linux
if: vars.SKIP_UNSTABLE_CONTAINERS_TEMPORARILY != 1
name: Linux Core Service
needs: manifests
if: needs.manifests.outputs.skip_core_linux == 0
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -300,12 +354,12 @@ jobs:
{
"@type": "MessageCard",
"@context": "http://schema.org/extensions",
"summary": "Nightly Tests for Linux failing",
"summary": "Unstable build tests for Linux Core Service failing",
"themeColor": "f44336",
"title": "PyAnsys Geometry Nightly Tests - Linux failing",
"title": "PyAnsys Geometry unstable build tests - Linux Core Service failing",
"sections": [
{
"activityTitle": "Linux nightly tests are failing",
"activityTitle": "Linux Core Service unstable build tests are failing",
"activitySubtitle": "Check the run for more details: https://github.com/ansys/pyansys-geometry/actions/runs/${{ github.run_id }}",
"facts": [
{
Expand All @@ -318,9 +372,9 @@ jobs:
}
promote-windows-dms:
needs: [windows-dms-tests, windows-core-tests, linux-tests]
needs: windows-dms-tests
runs-on: windows-latest
name: Promote Windows container
name: Promote Windows DMS container
if: ${{ github.event.inputs.promote == 'true' || github.event_name == 'schedule' }}
env:
WINDOWS_UNSTABLE: ghcr.io/ansys/geometry:windows-latest-unstable
Expand All @@ -343,9 +397,9 @@ jobs:
run: docker push ${{ env.WINDOWS_STABLE_GHCR }}

promote-windows-core:
needs: [windows-dms-tests, windows-core-tests, linux-tests]
needs: windows-core-tests
runs-on: windows-latest
name: Promote Windows container
name: Promote Windows Core Service container
if: ${{ github.event.inputs.promote == 'true' || github.event_name == 'schedule' }}
env:
WINDOWS_UNSTABLE: ghcr.io/ansys/geometry:core-windows-latest-unstable
Expand All @@ -368,9 +422,9 @@ jobs:
run: docker push ${{ env.WINDOWS_STABLE_GHCR }}

promote-linux:
needs: [windows-dms-tests, windows-core-tests, linux-tests]
needs: linux-tests
runs-on: ubuntu-latest
name: Promote Linux container
name: Promote Linux Core Service container
if: ${{ github.event.inputs.promote == 'true' || github.event_name == 'schedule' }}
env:
LINUX_UNSTABLE: ghcr.io/ansys/geometry:core-linux-latest-unstable
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude: "tests/integration/files"
repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.2
rev: v0.8.3
hooks:
- id: ruff
- id: ruff-format
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/1581.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-api-geometry from 0.4.20 to 0.4.23
1 change: 1 addition & 0 deletions doc/changelog.d/1582.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-api-geometry from 0.4.23 to 0.4.24
1 change: 1 addition & 0 deletions doc/changelog.d/1583.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-tools-visualization-interface from 0.6.0 to 0.6.1
1 change: 1 addition & 0 deletions doc/changelog.d/1584.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
vtk/pyvista issues
1 change: 1 addition & 0 deletions doc/changelog.d/1586.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump ansys-tools-visualization-interface from 0.6.1 to 0.6.2
1 change: 1 addition & 0 deletions doc/changelog.d/1588.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pre-commit automatic update
1 change: 1 addition & 0 deletions doc/changelog.d/1589.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
avoid the usage of attrs 24.3.0 (temporary)
1 change: 1 addition & 0 deletions doc/changelog.d/1590.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bump jupytext from 1.16.4 to 1.16.5 in the docs-deps group
1 change: 1 addition & 0 deletions doc/changelog.d/1591.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
decouple unstable image promotion
1 change: 1 addition & 0 deletions doc/changelog.d/1592.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
skip unnecessary stages when containers are the same
Loading

0 comments on commit 76af32f

Please sign in to comment.