Skip to content

Commit 9389ba5

Browse files
committed
ci: fix ci/cd
1 parent eb8b206 commit 9389ba5

File tree

1 file changed

+0
-311
lines changed

1 file changed

+0
-311
lines changed

.github/workflows/ci_cd.yml

Lines changed: 0 additions & 311 deletions
Original file line numberDiff line numberDiff line change
@@ -504,314 +504,3 @@ jobs:
504504
with:
505505
library-name: ${{ env.PACKAGE_NAME }}
506506
python-version: ${{ env.MAIN_PYTHON_VERSION }}
507-
508-
# =================================================================================================
509-
# vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv RUNNING ON SELF-HOSTED RUNNER vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
510-
# =================================================================================================
511-
512-
fetch-release-artifacts:
513-
name: Fetch release artifacts
514-
needs: [testing-windows, testing-linux, docs]
515-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
516-
runs-on:
517-
group: ansys-network
518-
labels: [self-hosted, Windows, pygeometry]
519-
env:
520-
REUSE_LAST_ARTIFACTS: ${{ vars.REUSE_LAST_ARTIFACTS == 1 }}
521-
522-
steps:
523-
- name: Check out repository pyansys-geometry-binaries
524-
uses: actions/checkout@v4
525-
with:
526-
repository: 'ansys/pyansys-geometry-binaries'
527-
token: ${{ secrets.BINARIES_TOKEN }}
528-
529-
- name: Download binaries (if conditions met)
530-
if: env.REUSE_LAST_ARTIFACTS == 'false'
531-
run: |
532-
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
533-
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
534-
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
535-
536-
- name: Reuse last binaries (if conditions met)
537-
if: env.REUSE_LAST_ARTIFACTS == 'true'
538-
env:
539-
VERSION_WITH_PREFIX: ${{ github.ref_name }}
540-
run: |
541-
# We are on a Windows machine. We need to copy the binaries from the previous tag,
542-
# based on the current tag. We will also remove the trailing "v" from the tag. This will give
543-
# us the folder from where we need to copy the binaries.
544-
$env:VERSION=$env:VERSION_WITH_PREFIX.substring(1)
545-
$env:PREVIOUS_VERSION=$env:VERSION.substring(0, $env:VERSION.Length - 1)
546-
$env:PREVIOUS_PATCH_VERSION_NUMBER=$env:VERSION.substring($env:VERSION.Length - 1)
547-
$env:PREVIOUS_PATCH_VERSION_NUMBER=[int]$env:PREVIOUS_PATCH_VERSION_NUMBER - 1
548-
$env:PREVIOUS_VERSION=$env:PREVIOUS_VERSION + $env:PREVIOUS_PATCH_VERSION_NUMBER
549-
# Fetch the LFS files from the previous version
550-
git lfs fetch origin --include="$env:PREVIOUS_VERSION/*"
551-
git lfs checkout $env:PREVIOUS_VERSION
552-
# Copy the binaries from the previous version
553-
cp ./$env:PREVIOUS_VERSION/windows-dms-binaries.zip windows-dms-binaries.zip
554-
cp ./$env:PREVIOUS_VERSION/windows-core-binaries.zip windows-core-binaries.zip
555-
cp ./$env:PREVIOUS_VERSION/linux-core-binaries.zip linux-core-binaries.zip
556-
557-
- name: Upload DMS Windows binaries as workflow artifacts
558-
uses: actions/upload-artifact@v4
559-
with:
560-
name: windows-dms-binaries.zip
561-
path: windows-dms-binaries.zip
562-
retention-days: 1
563-
564-
- name: Upload Linux Core service binaries as workflow artifacts
565-
uses: actions/upload-artifact@v4
566-
with:
567-
name: linux-core-binaries.zip
568-
path: linux-core-binaries.zip
569-
retention-days: 1
570-
571-
- name: Upload Windows Core service binaries as workflow artifacts
572-
uses: actions/upload-artifact@v4
573-
with:
574-
name: windows-core-binaries.zip
575-
path: windows-core-binaries.zip
576-
retention-days: 1
577-
578-
- name: Publish the binaries to private repo
579-
env:
580-
VERSION_WITH_PREFIX: ${{ github.ref_name }}
581-
run: |
582-
$env:VERSION=$env:VERSION_WITH_PREFIX.substring(1)
583-
mkdir $env:VERSION -ErrorAction SilentlyContinue
584-
Remove-Item -Recurse -Force .\$env:VERSION\*
585-
mv windows-dms-binaries.zip .\$env:VERSION\
586-
mv windows-core-binaries.zip .\$env:VERSION\
587-
mv linux-core-binaries.zip .\$env:VERSION\
588-
git config user.email ${{ secrets.BINARIES_EMAIL }}
589-
git config user.name ${{ secrets.BINARIES_USERNAME }}
590-
git add *
591-
git commit -m "adding binaries for ${{ github.ref_name }}"
592-
git push origin main
593-
594-
build-windows-container:
595-
name: Building Geometry Service - Windows
596-
runs-on: [self-hosted, Windows, pygeometry]
597-
needs: [fetch-release-artifacts]
598-
strategy:
599-
fail-fast: false
600-
matrix:
601-
include:
602-
- mode: "dms"
603-
docker-file: "windows-dms-dockerfile.zip"
604-
zip-file: "windows-dms-binaries.zip"
605-
- mode: "coreservice"
606-
docker-file: "windows-core-dockerfile.zip"
607-
zip-file: "windows-core-binaries.zip"
608-
steps:
609-
- name: Checkout repository
610-
uses: actions/checkout@v4
611-
612-
- name: Set up Python
613-
uses: actions/setup-python@v5
614-
with:
615-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
616-
617-
- name: Download Windows binaries for ${{ matrix.mode }}
618-
uses: actions/download-artifact@v4
619-
with:
620-
name: ${{ matrix.zip-file }}
621-
path: docker/${{ matrix.zip-file }}
622-
623-
- name: Build Docker image
624-
working-directory: docker
625-
run: |
626-
docker build -f windows/${{ matrix.mode }}/Dockerfile -t ghcr.io/ansys/geometry:windows-tmp .
627-
628-
- name: Check location of self-hosted runner and define license server accordingly
629-
if: runner.name == 'pygeometry-ci-2'
630-
run:
631-
echo "ANSRV_GEO_LICENSE_SERVER=${{ secrets.INTERNAL_LICENSE_SERVER }}" | Out-File -FilePath $env:GITHUB_ENV -Append
632-
633-
- name: Launch Geometry service
634-
run: |
635-
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
636-
637-
- name: Validate connection using PyAnsys Geometry
638-
run: |
639-
python -m venv .venv
640-
.\.venv\Scripts\Activate.ps1
641-
python -m pip install --upgrade pip
642-
pip install -e .[tests]
643-
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
644-
645-
- name: Restore images cache
646-
uses: actions/cache@v4
647-
with:
648-
path: .\tests\integration\image_cache
649-
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
650-
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
651-
652-
- name: Testing
653-
run: |
654-
.\.venv\Scripts\Activate.ps1
655-
pytest -v --use-existing-service=yes
656-
657-
- name: "Compressing Windows Dockerfile"
658-
uses: vimtor/[email protected]
659-
with:
660-
files: docker/windows/${{ matrix.mode }}/Dockerfile
661-
dest: ${{ matrix.docker-file }}
662-
663-
- name: Upload Windows Dockerfile
664-
uses: actions/upload-artifact@v4
665-
with:
666-
name: ${{ matrix.docker-file }}
667-
path: ${{ matrix.docker-file }}
668-
retention-days: 7
669-
670-
- name: Stop the Geometry service
671-
if: always()
672-
run: |
673-
docker stop ${{ env.GEO_CONT_NAME }}
674-
docker logs ${{ env.GEO_CONT_NAME }}
675-
docker rm ${{ env.GEO_CONT_NAME }}
676-
677-
- name: Stop any remaining containers
678-
if: always()
679-
run: |
680-
$dockerContainers = docker ps -a -q
681-
if (-not [string]::IsNullOrEmpty($dockerContainers)) {
682-
docker stop $dockerContainers
683-
docker rm $dockerContainers
684-
}
685-
686-
- name: Delete the Docker images (and untagged ones)
687-
if: always()
688-
run: |
689-
docker image rm ghcr.io/ansys/geometry:windows-tmp
690-
docker system prune -f
691-
692-
# =================================================================================================
693-
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ RUNNING ON SELF-HOSTED RUNNER ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
694-
# =================================================================================================
695-
696-
build-linux-container:
697-
name: Building Geometry Service - Linux
698-
runs-on: ubuntu-latest
699-
needs: [fetch-release-artifacts]
700-
steps:
701-
- name: Checkout repository
702-
uses: actions/checkout@v4
703-
704-
- name: Set up Python
705-
uses: actions/setup-python@v5
706-
with:
707-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
708-
709-
- name: Download Linux binaries
710-
uses: actions/download-artifact@v4
711-
with:
712-
name: linux-core-binaries.zip
713-
path: docker/linux-core-binaries.zip
714-
715-
- name: Build Docker image
716-
working-directory: docker
717-
run: |
718-
docker build -f linux/coreservice/Dockerfile -t ghcr.io/ansys/geometry:linux-tmp .
719-
720-
- name: Launch Geometry service
721-
run: |
722-
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
723-
724-
- name: Validate connection using PyAnsys Geometry
725-
run: |
726-
python -m pip install --upgrade pip
727-
pip install -e .[tests]
728-
python -c "from ansys.geometry.core.connection.validate import validate; validate()"
729-
730-
- name: Restore images cache
731-
uses: actions/cache@v4
732-
with:
733-
path: .\tests\integration\image_cache
734-
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
735-
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}
736-
737-
- name: Run pytest
738-
uses: ansys/actions/tests-pytest@v8
739-
env:
740-
ALLOW_PLOTTING: true
741-
with:
742-
python-version: ${{ env.MAIN_PYTHON_VERSION }}
743-
pytest-extra-args: "--use-existing-service=yes"
744-
checkout: false
745-
requires-xvfb: true
746-
747-
- name: "Compressing Linux Dockerfile"
748-
uses: vimtor/[email protected]
749-
with:
750-
files: docker/linux/coreservice/Dockerfile
751-
dest: linux-core-dockerfile.zip
752-
753-
- name: Upload Linux Dockerfile
754-
uses: actions/upload-artifact@v4
755-
with:
756-
name: linux-core-dockerfile.zip
757-
path: linux-core-dockerfile.zip
758-
retention-days: 7
759-
760-
- name: Stop the Geometry service
761-
if: always()
762-
run: |
763-
docker stop ${{ env.GEO_CONT_NAME }}
764-
docker logs ${{ env.GEO_CONT_NAME }}
765-
docker rm ${{ env.GEO_CONT_NAME }}
766-
767-
release:
768-
name: Release project
769-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
770-
needs: [package, build-windows-container, build-linux-container, update-changelog]
771-
runs-on: ubuntu-latest
772-
# Specifying a GitHub environment is optional, but strongly encouraged
773-
environment: release
774-
permissions:
775-
id-token: write
776-
contents: write
777-
steps:
778-
- name: Release to the public PyPI repository
779-
uses: ansys/actions/release-pypi-public@v8
780-
with:
781-
library-name: ${{ env.PACKAGE_NAME }}
782-
use-trusted-publisher: true
783-
784-
- name: Release to GitHub
785-
uses: ansys/actions/release-github@v8
786-
with:
787-
token: ${{ secrets.GITHUB_TOKEN }}
788-
library-name: ${{ env.PACKAGE_NAME }}
789-
additional-artifacts: windows-dms-dockerfile.zip windows-core-dockerfile.zip linux-core-dockerfile.zip
790-
791-
upload_dev_docs:
792-
name: Upload dev documentation
793-
if: github.ref == 'refs/heads/main'
794-
runs-on: ubuntu-latest
795-
needs: [package]
796-
steps:
797-
- name: Deploy the latest documentation
798-
uses: ansys/actions/doc-deploy-dev@v8
799-
with:
800-
cname: ${{ env.DOCUMENTATION_CNAME }}
801-
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
802-
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
803-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}
804-
805-
upload_docs_release:
806-
name: Upload release documentation
807-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
808-
runs-on: ubuntu-latest
809-
needs: [release]
810-
steps:
811-
- name: Deploy the stable documentation
812-
uses: ansys/actions/doc-deploy-stable@v8
813-
with:
814-
cname: ${{ env.DOCUMENTATION_CNAME }}
815-
token: ${{ secrets.PYANSYS_CI_BOT_TOKEN }}
816-
bot-user: ${{ secrets.PYANSYS_CI_BOT_USERNAME }}
817-
bot-email: ${{ secrets.PYANSYS_CI_BOT_EMAIL }}

0 commit comments

Comments
 (0)