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

Update dependencies and tooling #251

Merged
merged 62 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
8195658
Update dependencies
klane Oct 12, 2024
37bccb7
Uninstall pytest-lazy-fixture
klane Oct 12, 2024
e9a748c
Update Python version
klane Oct 12, 2024
30a361e
Update pre-commit hooks
klane Oct 12, 2024
6539115
Migrate to ruff
klane Oct 12, 2024
9e26421
Remove tox from dev dependencies
klane Oct 12, 2024
f9fef95
Format notebook
klane Oct 12, 2024
f72a3ee
Update source
klane Oct 12, 2024
cfaa3f4
Update tests
klane Oct 12, 2024
8982019
Remove safety job
klane Oct 12, 2024
0ca5459
Update dependabot config
klane Oct 12, 2024
b65f9bc
Update CI
klane Oct 13, 2024
19b680a
Move linting job to test workflow
klane Oct 13, 2024
f614145
Use cache capability in setup Python action
klane Oct 13, 2024
6cbdf3f
Update poetry group name
klane Oct 13, 2024
5ebe03b
Update release pipeline
klane Oct 13, 2024
0a068a4
Update poetry hash
klane Oct 13, 2024
1d4e1f9
Remove deepsource
klane Oct 13, 2024
a04ae25
Remove LGTM badge
klane Oct 13, 2024
6a9c0ce
Install poetry with pipx
klane Oct 13, 2024
f0e01d5
Change style badge from black to ruff
klane Oct 13, 2024
031cb7a
Add Python version to linting stage
klane Oct 13, 2024
0c76575
Install poetry before setting up Python
klane Oct 13, 2024
481a3d6
Convert Python versions to strings
klane Oct 13, 2024
f385f1e
Temporarily remove Python versions
klane Oct 13, 2024
48429e6
Use default Poetry virtual environment location
klane Oct 13, 2024
295a361
Revert "Format notebook"
klane Oct 13, 2024
5fcdeb0
Remove linting job
klane Oct 13, 2024
c296a0d
Use pathlib where appropriate
klane Oct 13, 2024
a9f87dd
Only run nbconvert tests
klane Oct 13, 2024
05a727d
Format notebook
klane Oct 13, 2024
bc2d427
Add debug printing
klane Oct 13, 2024
b701c10
Revert "Only run nbconvert tests"
klane Oct 13, 2024
368dd89
Check if path is already relative
klane Oct 13, 2024
76ada37
Account for site_dir being None
klane Oct 13, 2024
e53c53b
Revert "Temporarily remove Python versions"
klane Oct 13, 2024
9c07106
Cleanup debug printing
klane Oct 13, 2024
2ce37c0
Remove ruff badge
klane Oct 13, 2024
07732d4
Add mkdocs to docs dependencies
klane Oct 13, 2024
d56679d
Remove ignore paths from CI
klane Oct 13, 2024
6277306
Remove downloads badge
klane Oct 13, 2024
b20c4ad
Add pre-commit badge
klane Oct 13, 2024
8d41a85
Remove quality badge
klane Oct 13, 2024
b6b8387
Update PyPI badge label
klane Oct 13, 2024
b5d717a
Update default branch in links
klane Oct 13, 2024
c571d85
Update changelog
klane Oct 13, 2024
26f0b02
Add pytest-xdist to test dependencies
klane Oct 13, 2024
cc19fa3
Update poetry sections
klane Oct 13, 2024
fbc3e43
Sort dependencies
klane Oct 13, 2024
f165a6a
Update dependencies
klane Oct 13, 2024
93c0317
Update changelog
klane Oct 13, 2024
c736718
Change Slack dependencies to a scalar
klane Oct 14, 2024
67a82dc
Update dependencies
klane Oct 14, 2024
47473ba
Update build system
klane Oct 14, 2024
a89b04e
Rename Python variable
klane Oct 14, 2024
48eed7d
Expand matrix variables
klane Oct 14, 2024
f1db76b
Update CI matrix
klane Oct 14, 2024
292a948
Update changelog
klane Oct 14, 2024
fc65078
Update changelog
klane Oct 14, 2024
0828e70
Add psutil extras
klane Oct 14, 2024
3ffa72d
Add pytest config
klane Oct 14, 2024
4252418
Install pytest-github-actions-annotate-failures in CI
klane Oct 14, 2024
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
18 changes: 0 additions & 18 deletions .deepsource.toml

This file was deleted.

11 changes: 3 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
directory: /
schedule:
interval: monthly
time: "00:00"
timezone: America/Los_Angeles
open-pull-requests-limit: 99
assignees:
- klane
labels:
- dependencies
- actions

- package-ecosystem: pip
directory: "/"
directory: /
schedule:
interval: monthly
time: "00:00"
timezone: America/Los_Angeles
open-pull-requests-limit: 99
assignees:
- klane
labels:
Expand Down
62 changes: 7 additions & 55 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: Quality

on:
push:
branches: [master]
branches:
- main
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
# every Sunday at midnight
schedule:
- cron: '0 0 * * 0'

Expand All @@ -16,68 +16,20 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v3
with:
languages: python
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

- name: Perform CodeQL analysis
uses: github/codeql-action/analyze@v1

linting:
name: Linting
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Python
uses: actions/[email protected]

- name: Hash Python version
id: hash
run: echo ::set-output name=hash::$(python --version | sha256sum | cut -d' ' -f1)

- name: Restore cache
uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ steps.hash.outputs.hash }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit
uses: pre-commit/[email protected]

safety:
name: Safety
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Python
uses: actions/[email protected]

- name: Install Poetry
uses: Gr1N/setup-poetry@v7

- name: Install Safety
run: pip install safety

- name: Check dependencies
run: poetry export --dev --format requirements.txt | safety check --stdin --ignore=39462
uses: github/codeql-action/analyze@v3

slack:
name: Slack
runs-on: ubuntu-latest
needs: [analyze, linting, safety]
needs: analyze

steps:
- name: Send Slack message
Expand Down
92 changes: 71 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,107 @@ name: Release
on:
push:
tags:
- v*
- v*.*.*
workflow_dispatch:

jobs:
build:
name: Build
runs-on: ubuntu-latest

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

- name: Install poetry
run: pipx install poetry

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies and build project
run: |
poetry install --without docs,test
poetry build

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: poetry-build
path: dist/

github:
name: GitHub
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v4

- name: Get tag
id: tag
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: poetry-build
path: dist

- name: Get changes
if: github.event_name == 'push'
run: |
echo ::set-output name=tag::${GITHUB_REF#refs/tags/v}
tag=${GITHUB_REF#refs/tags/v}
pattern="0,/$tag/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q"
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md
cat RELEASE.md

- name: Get changes
id: changelog
if: github.event_name == 'workflow_dispatch'
run: |
pattern='0,/${{ steps.tag.outputs.tag }}/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q'
pattern='0,/[0-9]\+\.[0-9]\+\.[0-9]\+/d;/[0-9]\+\.[0-9]\+\.[0-9]\+/Q'
sed $pattern CHANGELOG.md | head -n -1 | tail -n +2 > RELEASE.md
cat RELEASE.md

- name: Create release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
if: success() && github.event_name == 'push'
with:
body_path: RELEASE.md
prerelease: ${{ contains(github.ref, '-') }}
files: dist/*

pypi:
name: PyPI
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout
uses: actions/checkout@v2.3.3
uses: actions/checkout@v4

- name: Set up Python
uses: actions/[email protected]

- name: Install Poetry
uses: Gr1N/setup-poetry@v7
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: poetry-build
path: dist

- name: Install dependencies
run: poetry install --no-dev
- name: Install poetry
run: pipx install poetry

- name: Build project
run: poetry build
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Publish to PyPI
if: success() && github.event_name == 'push'
run: poetry publish
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
run: poetry publish

- name: Publish to TestPyPI
if: success() && github.event_name == 'workflow_dispatch'
run: poetry publish -r test-pypi
env:
POETRY_REPOSITORIES_TEST_PYPI_URL: https://test.pypi.org/legacy/
POETRY_PYPI_TOKEN_TEST_PYPI: ${{ secrets.TEST_PYPI_TOKEN }}
86 changes: 36 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,84 +3,70 @@ name: Tests
on:
push:
branches:
- '*'
paths-ignore:
- 'docs/**'
- '**.md'
- main
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'

jobs:
test:
name: '${{ matrix.os_name }}: Python ${{ matrix.python }}'
runs-on: ${{ matrix.os }}
name: ${{ matrix.os.name }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os.image }}
defaults:
run:
shell: bash

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python: [3.6, 3.7, 3.8, 3.9]
include:
- os: ubuntu-latest
os_name: Linux
poetry_cache: ~/.cache/pypoetry

- os: macos-latest
os_name: macOS
poetry_cache: ~/Library/Caches/pypoetry

- os: windows-latest
os_name: Windows
poetry_cache: ~\AppData\Local\pypoetry\Cache
os:
- name: Ubuntu
image: ubuntu-latest
- name: macOS aarch64
image: macos-latest
- name: macOS x86_64
image: macos-13
- name: Windows
image: windows-latest
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
fail-fast: false

steps:
- name: Checkout
uses: actions/[email protected]

- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}

- name: Install Poetry
uses: Gr1N/setup-poetry@v7
uses: actions/checkout@v4

- name: Write environment information to a file
run: |
pwd > environment
python --version >> environment
- name: Install poetry
run: pipx install poetry

- name: Restore cache
uses: actions/[email protected]
if: runner.os != 'Windows'
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
path: ${{ matrix.poetry_cache }}
key: poetry|${{ hashFiles('environment') }}|${{ hashFiles('poetry.lock') }}
python-version: ${{ matrix.python-version }}
cache: poetry

- name: Install dependencies
run: poetry install
run: |
poetry install
pip install pytest-github-actions-annotate-failures

- name: Run tests
run: poetry run pytest tests/ --cov=jekyllnb

- name: Generate coverage report
run: poetry run coverage xml
run: poetry run pytest --cov-report xml:coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v2.1.0
uses: codecov/codecov-action@v4
if: success()
with:
file: coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml

- name: Send Slack message on failure
uses: lazy-actions/[email protected]
if: failure()
with:
type: ${{ job.status }}
job_name: '${{ runner.os }} :snake: ${{ matrix.python }} Tests'
job_name: '${{ runner.os }} :snake: ${{ matrix.python-version }} Tests'
url: ${{ secrets.SLACK_WEBHOOK }}
commit: true
token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,6 @@ dist/

# pyenv version file
.python-version

# docs site
site/
Loading
Loading