Skip to content

Commit

Permalink
ci/cd workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
RubelMozumder committed Nov 19, 2024
1 parent 44edf42 commit 52dc425
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/backward_compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Backward Compatibility with Pynxtools

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
backward_compatibility:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
pynxtools_versions: ["master"]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python 3.11
uses: actions/setup-python@v2
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install coverage coveralls
- name: Install pynxtools-stm
run: |
pip install .[dev]
- name: Install pynxtools version ${{ matrix.pynxtools_versions }}
run: |
if [ "${{ matrix.pynxtools_versions }}" == "master" ]; then
pip install pynxtools@git+https://github.com/FAIRmat-NFDI/pynxtools@${{ matrix.pynxtools_versions }}
else
pip install pynxtools==${{ matrix.pynxtools_versions }}
fi
- name: Run tests
run: |
pytest tests/.
28 changes: 28 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build Docs
on:
push:
branches:
- main
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- run: pip install .[docs]
- run: mkdocs gh-deploy --force
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Upload Python Package

on:
release:
types: [published]

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{secrets.PYPI_API_TOKEN}}
33 changes: 33 additions & 0 deletions .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: linting

on: [push]

jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: "3.10"
- name: Install dependencies
run: |
git submodule sync --recursive
git submodule update --init --recursive --jobs=4
python -m pip install --upgrade pip
- name: Install package
run: |
python -m pip install --no-deps .
- name: Install requirements
run: |
python -m pip install -r dev-requirements.txt
- name: ruff
run: |
ruff pynxtools_stm tests
- name: ruff formatting
run: |
ruff format --check pynxtools_stm tests
- name: mypy
run: |
mypy pynxtools_stm tests
34 changes: 34 additions & 0 deletions .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: pytest

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
pytest:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python_version: ["3.8", "3.9", "3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: recursive
- name: Set up Python ${{matrix.python_version}}
uses: actions/setup-python@v4
with:
python-version: ${{matrix.python_version}}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Install package
run: |
pip install ".[dev]"
- name: Test with pytest
run: |
pytest tests
28 changes: 28 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: pynxtools-stm package

on:
push:
branches: [ ci_cd ]
pull_request:
branches: [ ci_cd ]
types: [opened, edited, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -r requirements.txt
- name: Test with pytest
run: |
python -m pytest tests

0 comments on commit 52dc425

Please sign in to comment.