Skip to content

Commit

Permalink
actions
Browse files Browse the repository at this point in the history
  • Loading branch information
LegrandNico committed Oct 14, 2024
1 parent 570aba6 commit c7ba0c7
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 26 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,37 @@ jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1. Checkout the repository
- name: Checkout 🛎️
uses: actions/checkout@v4

# 2. Set up Python 3.12
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'

- name: Build
# 3. Install dependencies and build the documentation
- name: Install dependencies and build docs
run: |
sudo apt-get install graphviz
apt-get install graphviz
pip install poetry poetry-dynamic-versioning
poetry install --with dev
sphinx-build -j 4 -T -b html docs/source docs/build/html
poetry run sphinx-build -j 4 -T -b html docs/source docs/build/html
# 4. Deploy the documentation for the 'release' event
- name: Deploy Stable 🚀
if: github.event_name == 'release'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/html
branch: gh-pages

# 5. Deploy the documentation for pull requests (Dev version)
- name: Deploy Dev 🚀
if: (github.event_name == 'pull_request') || (github.event_name == 'push')
if: github.event_name == 'pull_request'
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: docs/build/html
branch: gh-pages
target-folder: dev
target-folder: dev
60 changes: 39 additions & 21 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,52 @@ on:
branches:
- master
pull_request:
# This will run the action for pull requests from any branch
branches:
- "*"
- '*'

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.12']
python-version: ['3.12'] # Add more Python versions if needed, like '3.8', '3.9', '3.10', etc.

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
# Step 1: Checkout the repository
- name: Checkout Repository
uses: actions/checkout@v4

# Step 2: Set up Python environment
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

# Step 3: Install Poetry
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
echo "$HOME/.local/bin" >> $GITHUB_PATH
poetry self add "poetry-dynamic-versioning[plugin]"
- name: Install dependencies
run: |
sudo apt-get install graphviz
poetry install --with dev
python -m ipykernel install --user --name python3
- name: Run tests and coverage
run: |
pytest ./tests/ --cov=./src/pyhgf/ --cov-report=xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # required
# Step 4: Install System Dependencies
- name: Install Graphviz
run: apt-get install -y graphviz

# Step 5: Install Python Dependencies using Poetry
- name: Install dependencies
run: |
poetry install --with dev
python -m ipykernel install --user --name python3
# Step 6: Run Tests and Generate Coverage Report
- name: Run tests and coverage
run: |
poetry run pytest ./tests/ --cov=./src/pyhgf/ --cov-report=xml
# Step 7: Upload Coverage Report to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }} # Make sure to set this token in repository secrets

0 comments on commit c7ba0c7

Please sign in to comment.