Skip to content

Use grouped updates for pip dependencies #360

Use grouped updates for pip dependencies

Use grouped updates for pip dependencies #360

Workflow file for this run

# check spelling, codestyle
name: GitHub CI
# run only on main branch. This avoids duplicated actions on PRs
on:
pull_request:
push:
tags:
- "*"
branches:
- main
workflow_dispatch:
env:
PYTHON_VERSION: '3.12'
DOCUMENTATION_CNAME: 'filetransfer-server.tools.docs.pyansys.com'
PACKAGE_NAME: 'ansys-tools-filetransfer-server'
jobs:
style:
name: Pre-commit Check
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Build and run pre-commit hooks via docker
run: |
docker build -f docker/Dockerfile --target precommit --tag filetransfer-precommit .
docker run filetransfer-precommit
env:
DOCKER_BUILDKIT: '1'
build:
name: Compile and Test
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-22.04
conan_config: linux_x86_64_Release
- os: windows-2019
conan_config: windows_x86_64_Release
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/cache@v4
name: Pip cache
with:
path: ${{ startsWith(runner.os, 'Linux') && '~/.cache/pip' || '~\AppData\Local\pip\Cache' }}
key: ${{ runner.os }}-pip-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dev dependencies
run: |
pip install -U poetry
poetry install
- name: Run Conan and build with CMake
run: |
poetry run conan install -of build --build missing --profile:host=./conan/${{ matrix.conan_config }} --profile:build=./conan/${{ matrix.conan_config }} ./conan
cmake -B build . -DCMAKE_TOOLCHAIN_FILE='build/conan_toolchain.cmake' -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release --parallel
- name: Run tests
run: |
ctest --output-on-failure -V
working-directory: build
docs:
name: Documentation
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: actions/cache@v4
name: Pip cache
with:
path: ${{ startsWith(runner.os, 'Linux') && '~/.cache/pip' || '~\AppData\Local\pip\Cache' }}
key: ${{ runner.os }}-pip-${{ hashFiles('poetry.lock') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dev dependencies
run: |
pip install -U poetry
poetry install
- name: "Install OS packages for docs"
run: |
sudo apt-get install doxygen
- name: Build documentation
run: |
poetry run make -C doc html
- name: "Upload HTML Documentation"
uses: actions/upload-artifact@v4
with:
name: documentation-html
path: doc/_build/html
retention-days: 7
- name: "Install OS packages for PDF docs"
run: |
sudo apt-get install latexmk texlive-latex-extra
- name: Generate the PDF documentation
run: poetry run make -C doc latexpdf
- name: "Upload PDF Documentation"
uses: actions/upload-artifact@v4
with:
name: documentation-pdf
path: doc/_build/latex/ansys-tools-filetransfer-server.pdf
retention-days: 7
docker-build:
name: Build and publish Docker container
needs: [style, build] # run only for successful build
runs-on: ubuntu-22.04
env:
REGISTRY: ghcr.io
IMAGE_OWNER: ansys
IMAGE_NAME_BASE: tools-filetransfer
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set the current date as build date
run: |
echo "BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_ENV
- name: Verify conditions for building and pushing the image
run: |
if [[ $GITHUB_REF == refs/tags/* ]]; then
echo "IS_A_RELEASE=true" >> $GITHUB_ENV
else
echo "IS_A_RELEASE=false" >> $GITHUB_ENV
fi
- name: Build image and export to GHCR
uses: docker/build-push-action@v6
if: env.IS_A_RELEASE == 'false'
with:
context: .
file: ./docker/Dockerfile
push: ${{ github.ref == 'refs/heads/main' }}
target: app_minimal
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME_BASE }}:latest
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
VCS_REF=${{ github.sha }}
- name: Build image and export to GHCR (on release only)
if: env.IS_A_RELEASE == 'true'
uses: docker/build-push-action@v6
with:
context: .
file: ./docker/Dockerfile
push: true
target: app_minimal
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME_BASE }}:${{ github.ref_name }}
build-args: |
BUILD_DATE=${{ env.BUILD_DATE }}
VCS_REF=${{ github.sha }}
verify-tag:
name: Verify tag name consistency
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Verify tag created matches value on VERSION file
run: |
version=$(cat VERSION)
if [[ ${{ github.ref_name }} != "v$version" ]]; then
echo "Tag ${{ github.ref_name }} does not match version value in repository: $version"
exit 1
fi
release:
name: Release project
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
needs: [build, verify-tag]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: "Download all artifacts that got generated in the CI/CD"
uses: actions/download-artifact@v4
with:
path: dist
- name: "Display the structure of the 'dist/' folder"
shell: bash
run: ls -R dist/
- name: "Compressing HTML documentation"
uses: vimtor/[email protected]
with:
files: dist/documentation/documentation-html
dest: dist/documentation/documentation-html.zip
- name: "Compressing PDF documentation"
uses: vimtor/[email protected]
with:
files: dist/documentation/documentation-pdf
dest: dist/documentation/documentation-pdf.zip
- name: "Release to GitHub"
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true 
files: |
dist/documentation/documentation-html.zip
dist/documentation/documentation-pdf.zip
upload_docs_dev:
name: "Upload dev documentation"
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [docs]
steps:
- name: Deploy the latest documentation
uses: ansys/actions/doc-deploy-dev@v7
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}
upload_docs_release:
name: Upload release documentation
if: github.event_name == 'push' && contains(github.ref, 'refs/tags')
runs-on: ubuntu-latest
needs: [docs]
steps:
- name: Deploy the stable documentation
uses: ansys/actions/doc-deploy-stable@v7
with:
cname: ${{ env.DOCUMENTATION_CNAME }}
token: ${{ secrets.GITHUB_TOKEN }}