Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing on several Python version + cleaning test.pypi.org deployments #15

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 15 additions & 28 deletions .github/workflows/build_and_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ on:
paths:
- src
- tests
- .github/workflows/build_and_tests.yml

jobs:

build_install_test:
name: Build, install and test the Ledgered Python package
runs-on: ubuntu-latest
strategy:
matrix:
python_version: ['3.8', '3.9', '3.10', '3.11']
steps:

- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Build & install
run: |
Expand All @@ -47,34 +50,26 @@ jobs:
steps:

- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

# Fetching dependencies from test.pypi,org or pypi.org depending on the package destination:
# tag -> pypi.org, not tag -> test.pypi.org
- name: Build Ledgered Python package
run: |
pip install --upgrade pip build twine
if [[ ${{ github.ref }} == "refs/tags/"* ]]; \
then \
python -m build; \
pip install .
else \
PIP_EXTRA_INDEX_URL=https://test.pypi.org/simple/ python -m build; \
pip install --extra-index-url https://test.pypi.org/simple/ .
fi
python -m build; \
pip install .
python -m twine check dist/*
echo "TAG_VERSION=$(python -c 'from ledgered import __version__; print(__version__)')" >> "$GITHUB_ENV"

- name: Display current status
run: |
echo "Current status is:"
if [[ ${{ github.ref }} == "refs/tags/"* ]]; \
then \
echo "- Triggered from tag, will be deployed on pypi.org"; \
else \
echo "- Not triggered from tag, will be deployed on test.pypi.org"; \
if [[ ${{ github.ref }} == "refs/tags/"* ]];
then
echo "- Triggered from tag, package will be a release";
else
echo "- Not triggered from tag, package will be a pre-release";
fi
echo "- Tag version: ${{ env.TAG_VERSION }}"

Expand All @@ -91,7 +86,7 @@ jobs:
fi

- name: Publish Python package on pypi.org
if: success() && github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
if: success() && github.event_name == 'push'
run: python -m twine upload dist/*
env:
TWINE_USERNAME: __token__
Expand All @@ -104,15 +99,7 @@ jobs:
with:
automatic_release_tag: "v${{ env.TAG_VERSION }}"
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: true
prerelease: false
files: |
LICENSE
dist/

- name: Publish Python package on test.pypi.org
if: success() && github.event_name == 'push'
run: python -m twine upload --repository testpypi dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_PUBLIC_API_TOKEN }}
TWINE_NON_INTERACTIVE: 1
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/fast-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: pip install flake8
- name: Flake8 lint Python code
run: find src/ -type f -name '*.py' -exec flake8 --max-line-length=120 '{}' '+'
Expand All @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: pip install yapf toml
- name: Yapf source formatting
run: |
Expand All @@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: pip install mypy types-toml
- name: Mypy type checking
run: mypy src
Expand All @@ -45,7 +45,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- run: pip install bandit
- name: Bandit security checking
run: bandit -r src -ll
Expand All @@ -55,7 +55,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Check misspellings
uses: codespell-project/actions-codespell@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ readme = { file = "README.md", content-type = "text/markdown" }
license = { file = "LICENSE" }
classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Operating System :: POSIX :: Linux",
"Operating System :: Microsoft :: Windows",
"Operating System :: MacOS :: MacOS X",
Expand Down
Loading