Skip to content

Commit 9e30fb5

Browse files
committed
ci: simplify
1 parent 6a77800 commit 9e30fb5

File tree

1 file changed

+2
-262
lines changed

1 file changed

+2
-262
lines changed

.github/workflows/ci_cd.yml

Lines changed: 2 additions & 262 deletions
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,6 @@ jobs:
597597
docker logs ${{ env.GEO_CONT_NAME }}
598598
docker rm ${{ env.GEO_CONT_NAME }}
599599
600-
601600
package:
602601
name: Package library
603602
needs: [testing-windows, testing-linux, testing-min-reqs, testing-no-graphics, docs]
@@ -609,269 +608,10 @@ jobs:
609608
library-name: ${{ env.PACKAGE_NAME }}
610609
python-version: ${{ env.MAIN_PYTHON_VERSION }}
611610

612-
# =================================================================================================
613-
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
614-
# =================================================================================================
615-
616-
fetch-release-artifacts:
617-
name: Fetch release artifacts
618-
needs: [testing-windows, testing-linux, docs]
619-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
620-
runs-on:
621-
group: ansys-network
622-
labels: [self-hosted, Windows, pygeometry]
623-
env:
624-
REUSE_LAST_ARTIFACTS: ${{ vars.REUSE_LAST_ARTIFACTS == 1 }}
625-
626-
steps:
627-
- name: Check out repository pyansys-geometry-binaries
628-
uses: actions/checkout@v4
629-
with:
630-
repository: 'ansys/pyansys-geometry-binaries'
631-
token: ${{ secrets.BINARIES_TOKEN }}
632-
633-
- name: Download binaries (if conditions met)
634-
if: env.REUSE_LAST_ARTIFACTS == 'false'
635-
run: |
636-
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerWindows.zip --output windows-dms-binaries.zip
637-
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerCoreWindows.zip --output windows-core-binaries.zip
638-
curl.exe -X GET -H "X-JFrog-Art-Api: ${{ secrets.ARTIFACTORY_KEY }}" ${{ secrets.ARTIFACTORY_URL }}/${{ env.ARTIFACTORY_VERSION }}/DockerCoreLinux.zip --output linux-core-binaries.zip
639-
640-
- name: Reuse last binaries (if conditions met)
641-
if: env.REUSE_LAST_ARTIFACTS == 'true'
642-
env:
643-
VERSION_WITH_PREFIX: ${{ github.ref_name }}
644-
run: |
645-
# We are on a Windows machine. We need to copy the binaries from the previous tag,
646-
# based on the current tag. We will also remove the trailing "v" from the tag. This will give
647-
# us the folder from where we need to copy the binaries.
648-
$env:VERSION=$env:VERSION_WITH_PREFIX.substring(1)
649-
$env:PREVIOUS_VERSION=$env:VERSION.substring(0, $env:VERSION.Length - 1)
650-
$env:PREVIOUS_PATCH_VERSION_NUMBER=$env:VERSION.substring($env:VERSION.Length - 1)
651-
$env:PREVIOUS_PATCH_VERSION_NUMBER=[int]$env:PREVIOUS_PATCH_VERSION_NUMBER - 1
652-
$env:PREVIOUS_VERSION=$env:PREVIOUS_VERSION + $env:PREVIOUS_PATCH_VERSION_NUMBER
653-
# Fetch the LFS files from the previous version
654-
git lfs fetch origin --include="$env:PREVIOUS_VERSION/*"
655-
git lfs checkout $env:PREVIOUS_VERSION
656-
# Copy the binaries from the previous version
657-
cp ./$env:PREVIOUS_VERSION/windows-dms-binaries.zip windows-dms-binaries.zip
658-
cp ./$env:PREVIOUS_VERSION/windows-core-binaries.zip windows-core-binaries.zip
659-
cp ./$env:PREVIOUS_VERSION/linux-core-binaries.zip linux-core-binaries.zip
660-
661-
- name: Upload DMS Windows binaries as workflow artifacts
662-
uses: actions/upload-artifact@v4
663-
with:
664-
name: windows-dms-binaries.zip
665-
path: windows-dms-binaries.zip
666-
retention-days: 1
667-
668-
- name: Upload Linux Core service binaries as workflow artifacts
669-
uses: actions/upload-artifact@v4
670-
with:
671-
name: linux-core-binaries.zip
672-
path: linux-core-binaries.zip
673-
retention-days: 1
674-
675-
- name: Upload Windows Core service binaries as workflow artifacts
676-
uses: actions/upload-artifact@v4
677-
with:
678-
name: windows-core-binaries.zip
679-
path: windows-core-binaries.zip
680-
retention-days: 1
681-
682-
- name: Publish the binaries to private repo
683-
env:
684-
VERSION_WITH_PREFIX: ${{ github.ref_name }}
685-
run: |
686-
$env:VERSION=$env:VERSION_WITH_PREFIX.substring(1)
687-
mkdir $env:VERSION -ErrorAction SilentlyContinue
688-
Remove-Item -Recurse -Force .\$env:VERSION\*
689-
mv windows-dms-binaries.zip .\$env:VERSION\
690-
mv windows-core-binaries.zip .\$env:VERSION\
691-
mv linux-core-binaries.zip .\$env:VERSION\
692-
git config user.email ${{ secrets.BINARIES_EMAIL }}
693-
git config user.name ${{ secrets.BINARIES_USERNAME }}
694-
git add *
695-
git commit -m "adding binaries for ${{ github.ref_name }}"
696-
git push origin main
697-
698-
build-windows-container:
699-
name: Building Geometry Service - Windows
700-
runs-on: [self-hosted, Windows, pygeometry]
701-
needs: [fetch-release-artifacts]
702-
strategy:
703-
fail-fast: false
704-
matrix:
705-
include:
706-
- mode: "dms"
707-
docker-file: "windows-dms-dockerfile.zip"
708-
zip-file: "windows-dms-binaries.zip"
709-
- mode: "coreservice"
710-
docker-file: "windows-core-dockerfile.zip"
711-
zip-file: "windows-core-binaries.zip"
712-
steps:
713-
- name: Checkout repository
714-
uses: actions/checkout@v4
715-
716-
- name: Set up Python
717-
uses: actions/setup-python@v5
718-
with:
719-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
720-
721-
- name: Download Windows binaries for ${{ matrix.mode }}
722-
uses: actions/download-artifact@v4
723-
with:
724-
name: ${{ matrix.zip-file }}
725-
path: docker/${{ matrix.zip-file }}
726-
727-
- name: Build Docker image
728-
working-directory: docker
729-
run: |
730-
docker build -f windows/${{ matrix.mode }}/Dockerfile -t ghcr.io/ansys/geometry:windows-tmp .
731-
732-
- name: Check location of self-hosted runner and define license server accordingly
733-
if: runner.name == 'pygeometry-ci-2'
734-
run:
735-
echo "ANSRV_GEO_LICENSE_SERVER=${{ secrets.INTERNAL_LICENSE_SERVER }}" | Out-File -FilePath $env:GITHUB_ENV -Append
736-
737-
- name: Launch Geometry service
738-
run: |
739-
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:windows-tmp
740-
741-
- name: Validate connection using PyAnsys Geometry
742-
run: |
743-
python -m venv .venv
744-
.\.venv\Scripts\Activate.ps1
745-
python -m pip install --upgrade pip
746-
pip install -e .[tests]
747-
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
748-
749-
- name: Restore images cache
750-
uses: actions/cache@v4
751-
with:
752-
path: .\tests\integration\image_cache
753-
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
754-
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
755-
756-
- name: Testing
757-
run: |
758-
.\.venv\Scripts\Activate.ps1
759-
pytest -v --use-existing-service=yes
760-
761-
- name: "Compressing Windows Dockerfile"
762-
uses: vimtor/action-zip@v1.2
763-
with:
764-
files: docker/windows/${{ matrix.mode }}/Dockerfile
765-
dest: ${{ matrix.docker-file }}
766-
767-
- name: Upload Windows Dockerfile
768-
uses: actions/upload-artifact@v4
769-
with:
770-
name: ${{ matrix.docker-file }}
771-
path: ${{ matrix.docker-file }}
772-
retention-days: 7
773-
774-
- name: Stop the Geometry service
775-
if: always()
776-
run: |
777-
docker stop ${{ env.GEO_CONT_NAME }}
778-
docker logs ${{ env.GEO_CONT_NAME }}
779-
docker rm ${{ env.GEO_CONT_NAME }}
780-
781-
- name: Stop any remaining containers
782-
if: always()
783-
run: |
784-
$dockerContainers = docker ps -a -q
785-
if (-not [string]::IsNullOrEmpty($dockerContainers)) {
786-
docker stop $dockerContainers
787-
docker rm $dockerContainers
788-
}
789-
790-
- name: Delete the Docker images (and untagged ones)
791-
if: always()
792-
run: |
793-
docker image rm ghcr.io/ansys/geometry:windows-tmp
794-
docker system prune -f
795-
796-
# =================================================================================================
797-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
798-
# =================================================================================================
799-
800-
build-linux-container:
801-
name: Building Geometry Service - Linux
802-
runs-on: ubuntu-latest
803-
needs: [fetch-release-artifacts]
804-
steps:
805-
- name: Checkout repository
806-
uses: actions/checkout@v4
807-
808-
- name: Set up Python
809-
uses: actions/setup-python@v5
810-
with:
811-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
812-
813-
- name: Download Linux binaries
814-
uses: actions/download-artifact@v4
815-
with:
816-
name: linux-core-binaries.zip
817-
path: docker/linux-core-binaries.zip
818-
819-
- name: Build Docker image
820-
working-directory: docker
821-
run: |
822-
docker build -f linux/coreservice/Dockerfile -t ghcr.io/ansys/geometry:linux-tmp .
823-
824-
- name: Launch Geometry service
825-
run: |
826-
docker run --detach --name ${{ env.GEO_CONT_NAME }} -e LICENSE_SERVER=${{ env.ANSRV_GEO_LICENSE_SERVER }} -p ${{ env.ANSRV_GEO_PORT }}:50051 ghcr.io/ansys/geometry:linux-tmp
827-
828-
- name: Validate connection using PyAnsys Geometry
829-
run: |
830-
python -m pip install --upgrade pip
831-
pip install -e .[tests]
832-
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
833-
834-
- name: Restore images cache
835-
uses: actions/cache@v4
836-
with:
837-
path: .\tests\integration\image_cache
838-
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
839-
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
840-
841-
- name: Run pytest
842-
uses: ansys/actions/tests-pytest@v8
843-
env:
844-
ALLOW_PLOTTING: true
845-
with:
846-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
847-
pytest-extra-args: "--use-existing-service=yes"
848-
checkout: false
849-
requires-xvfb: true
850-
851-
- name: "Compressing Linux Dockerfile"
852-
uses: vimtor/action-zip@v1.2
853-
with:
854-
files: docker/linux/coreservice/Dockerfile
855-
dest: linux-core-dockerfile.zip
856-
857-
- name: Upload Linux Dockerfile
858-
uses: actions/upload-artifact@v4
859-
with:
860-
name: linux-core-dockerfile.zip
861-
path: linux-core-dockerfile.zip
862-
retention-days: 7
863-
864-
- name: Stop the Geometry service
865-
if: always()
866-
run: |
867-
docker stop ${{ env.GEO_CONT_NAME }}
868-
docker logs ${{ env.GEO_CONT_NAME }}
869-
docker rm ${{ env.GEO_CONT_NAME }}
870-
871611
release:
872612
name: Release project
873613
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
874-
needs: [package, build-windows-container, build-linux-container, update-changelog]
614+
needs: [package, update-changelog]
875615
runs-on: ubuntu-latest
876616
# Specifying a GitHub environment is optional, but strongly encouraged
877617
environment: release
@@ -889,7 +629,7 @@ jobs:
889629
uses: ansys/actions/release-github@v8
890630
with:
891631
library-name: ${{ env.PACKAGE_NAME }}
892-
additional-artifacts: windows-dms-dockerfile.zip windows-core-dockerfile.zip linux-core-dockerfile.zip
632+
token: ${{ secrets.GITHUB_TOKEN }}
893633

894634
upload_dev_docs:
895635
name: Upload dev documentation

0 commit comments

Comments
 (0)