-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename CI-tests.yml to CI-CD.yml
Build: Added automatic build and deployment
- Loading branch information
Showing
2 changed files
with
92 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
# This workflow will do Continous Integration (CI) and Continous Deployment (CD). | ||
# It will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: | ||
# https://py-pkgs.org/08-ci-cd | ||
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python | ||
|
||
name: ci-cd | ||
|
||
# Controls when the workflow will run | ||
on: [push, pull_request] | ||
|
||
# A workflow run is made up of one or more jobs that can run | ||
# sequentially or in parallel | ||
jobs: | ||
ci: | ||
# Set up operating system | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
python-version: ["3.9", "3.10", "3.11", "3.12"] | ||
# Define job steps | ||
steps: | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Check-out karney repository | ||
uses: actions/checkout@v4 | ||
- name: Install Poetry | ||
uses: snok/install-poetry@v1 | ||
|
||
- name: Install karney with dependencies | ||
run: poetry install --with dev --no-interaction | ||
- name: Lint with ruff | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
ruff check ./src/ | ||
- name: Test with pytest | ||
run: poetry run pytest tests/ --cov=karney --cov-report=xml | ||
cd: | ||
permissions: | ||
id-token: write | ||
contents: write | ||
# Only run this job if the "ci" job passes | ||
needs: ci | ||
|
||
# Only run this job if new work is pushed to the "main" branch | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | ||
|
||
# Set up operating system | ||
runs-on: ubuntu-latest | ||
|
||
# Define job steps | ||
steps: | ||
- name: Set up Python 3.9 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.9 | ||
|
||
- name: Check-out repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: Use Python Semantic Release to prepare release | ||
id: release | ||
uses: python-semantic-release/python-semantic-release@v8.3.0 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Publish to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: steps.release.outputs.released == 'true' | ||
with: | ||
repository-url: https://test.pypi.org/project/karney | ||
- name: Test install from TestPyPI | ||
run: | | ||
pip install \ | ||
--index-url https://test.pypi.org/project/ \ | ||
--extra-index-url https://pypi.org/project \ | ||
karney | ||
- name: Publish to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
if: steps.release.outputs.released == 'true' | ||
with: | ||
repository-url: https://pypi.org/project/karney | ||
|
||
- name: Publish package distributions to GitHub Releases | ||
uses: python-semantic-release/upload-to-gh-release@main | ||
if: steps.release.outputs.released == 'true' | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file was deleted.
Oops, something went wrong.