Skip to content

Commit

Permalink
ci: Fixed and updated CICD pipeline
Browse files Browse the repository at this point in the history
- Fixed the Python version in the build, lint, test, and publish jobs
- Added a strategy matrix for the Python version
- Added a new step to build the project using Poetry
- Added a new step to lint the code using black
- Updated the test step to run pytest with verbose and capture mode
- Added a new step to set up Python and install Poetry in the publish job
- Updated the publish job to use the build and publish commands of Poetry
  • Loading branch information
ntindle committed Nov 9, 2023
1 parent fdb3247 commit ee8d3b2
Showing 1 changed file with 42 additions and 3 deletions.
45 changes: 42 additions & 3 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,82 @@ on:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.12
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: |
poetry install
- name: Build
run: |
poetry build
lint:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: |
poetry install
- name: Lint with flake8
run: |
poetry run flake8 your_package
poetry run black . --check
test:
needs: lint
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
run: |
curl -sSL https://install.python-poetry.org | python3 -
- name: Install dependencies
run: |
poetry install
- name: Test with pytest
run: |
poetry run pytest
poetry run pytest -v -s ./tests
publish:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Build and publish
run: |
poetry publish --username ${{ secrets.PYPI_USERNAME }} --password ${{ secrets.PYPI_PASSWORD }}

0 comments on commit ee8d3b2

Please sign in to comment.