Skip to content

Commit

Permalink
Add CD workflow to build and publish to PyPI
Browse files Browse the repository at this point in the history
  • Loading branch information
jo-basevi committed May 17, 2024
1 parent 341afe2 commit 1ec6639
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: CI

on:
pull_request:
branches:
- 'main'

jobs:
pypi-build:
name: Build package for PyPI
if: github.repository == 'access-nri/model-config-tests'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'

- name: Install build dependencies
run: python3 -m pip install --upgrade build

- name: Build distributions
run: python3 -m build

- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
path: dist

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: pip

- name: Install model_config_tests
run: pip install -e '.[test]'

- name: Run tests
run: pytest -s tests
25 changes: 25 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,31 @@ on:
- 'main'

jobs:
pypi-build:
name: Build package for PyPI
if: github.repository == 'access-nri/model-config-tests'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip'

- name: Install build dependencies
run: python3 -m pip install --upgrade build

- name: Build distributions
run: python3 -m build

- name: Upload distribution artifact
uses: actions/upload-artifact@v4
with:
path: dist

tests:
name: Tests
runs-on: ubuntu-latest
Expand Down

0 comments on commit 1ec6639

Please sign in to comment.