Skip to content

Commit

Permalink
feat: Add CICD
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroFernandezLuces committed Feb 14, 2024
1 parent aa6e6f4 commit a4e09e9
Show file tree
Hide file tree
Showing 4 changed files with 192 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/"
insecure-external-code-execution: allow
schedule:
interval: "weekly"
labels:
- "maintenance"
- "dependencies"
groups:
general-dependencies:
patterns:
- "*"
exclude-patterns:
- "*sphinx*"
- "numpydoc"
- "pyvista*"
- "pytest*"
test-dependencies:
patterns:
- "pytest*"
doc-dependencies:
patterns:
- "*sphinx*"
- "numpydoc"
pyvista:
patterns:
- "pyvista*"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
11 changes: 11 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
documentation:
- changed-files:
- any-glob-to-any-file: ['doc/source/**/*', 'README.md']

maintenance:
- changed-files:
- any-glob-to-any-file: ['.github/**/*', '.flake8', 'pyproject.toml', 'tox.ini', '.pre-commit-config.yaml']

testing:
- changed-files:
- any-glob-to-any-file: ['tests/*']
44 changes: 44 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
- name: bug
description: Something isn't working
color: d42a34

- name: dependencies
description: Related with project dependencies
color: ffc0cb

- name: documentation
description: Improvements or additions to documentation
color: 0677ba

- name: enhancement
description: New features or code improvements
color: FFD827

- name: good first issue
description: Easy to solve for newcomers
color: 62ca50

- name: maintenance
description: Package and maintenance related
color: f78c37

- name: release
description: Anything related to an incoming release
color: ffffff

- name: testing
description: Anything related to testing
color: 5802B8

- name: graphics
description: Anything related to graphics
color: 5903A8

- name: triage
description: Need some assessment
color: f78a50

- name: top priority
description: Must be fixed promptly
color: ab8a50

103 changes: 103 additions & 0 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: GitHub CI

on:
pull_request:
workflow_dispatch:
push:
tags:
- "*"
branches:
- main

env:
MAIN_PYTHON_VERSION: '3.11'
RESET_IMAGE_CACHE: 0
PACKAGE_NAME: pyansys-visualizer

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
branch-name:
if: github.event_name == 'pull_request'
name: Check the name of the branch
runs-on: ubuntu-latest
steps:
- name: Check branch name
uses: ansys/actions/branch-name-style@main

style:
name: Code style
runs-on: ubuntu-latest
steps:
- name: PyAnsys code style checks
uses: ansys/actions/code-style@v5
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

smoke-tests:
name: Build and Smoke tests
runs-on: ${{ matrix.os }}
needs: [style]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
- should-release: false
os: macos-latest
steps:
- name: Build wheelhouse and perform smoke test
uses: ansys/actions/build-wheelhouse@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
operating-system: ${{ matrix.os }}
python-version: ${{ matrix.python-version }}

testing:
name: Run Unit Tests
needs: [ smoke-tests ]
runs-on: ubuntu-latest

steps:
- name: Restore images cache
uses: actions/cache@v3
with:
path: tests/graphics/image_cache
key: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}-${{ hashFiles('pyproject.toml') }}
restore-keys: pyvista-image-cache-${{ runner.os }}-v-${{ env.RESET_IMAGE_CACHE }}

- name: "Run pytest"
uses: ansys/actions/tests-pytest@v5
env:
PYPRIMEMESH_LAUNCH_CONTAINER: 1
PYPRIMEMESH_IMAGE_TAG: ${{ env.DOCKER_IMAGE_TAG }}
ANSYSLMD_LICENSE_FILE: ${{ format('1055@{0}', secrets.LICENSE_SERVER )}}
with:
python-version: ${{ env.MAIN_PYTHON_VERSION }}

- name: Upload PyVista generated images (cache and results)
if: always()
uses: actions/upload-artifact@v4
with:
name: pytest-pyvista-images-${{ runner.os }}
path: tests/graphics/image_cache
retention-days: 7

- uses: codecov/codecov-action@v3
name: 'Upload coverage to CodeCov'

package:
name: Package library
needs: [testing]
runs-on: ubuntu-latest
steps:
- name: Build library source and wheel artifacts
uses: ansys/actions/build-library@v5
with:
library-name: ${{ env.PACKAGE_NAME }}
python-version: ${{ env.MAIN_PYTHON_VERSION }}

0 comments on commit a4e09e9

Please sign in to comment.