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

bump to python 39 #16

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
f05e4aa
ci: add uv based workflows
kod-kristoff Sep 2, 2024
1704d89
ci: use env namespace
kod-kristoff Sep 2, 2024
6ad6e5d
chore: add uv based Makefile
kod-kristoff Sep 2, 2024
0a9d5c1
ci: remove unused actions
kod-kristoff Sep 2, 2024
15b3c7d
ci(test): fix python-version
kod-kristoff Sep 16, 2024
cb56a6c
ci: bump uv to 0.4.18
kod-kristoff Oct 4, 2024
2b55d17
ci: do not use hashes from workflow file
kod-kristoff Oct 4, 2024
479cbf3
ci: set python 3.9 as minimum version
kod-kristoff Oct 16, 2024
3cae6a5
ci: also test for python 3.13
kod-kristoff Oct 16, 2024
db04c02
ci: also test for python 3.14-dev
kod-kristoff Oct 16, 2024
c6c034d
ci(deps): bump uv to 0.5.1
kod-kristoff Nov 13, 2024
700690f
ci: use setup-uv action
kod-kristoff Nov 18, 2024
aa660f6
ci: bump codecov-action to v5
kod-kristoff Nov 18, 2024
e3ef757
chore: update uv export
kod-kristoff Nov 18, 2024
c75d70b
chore: fix typo
kod-kristoff Nov 18, 2024
2c86ff7
chore: fix uv export
kod-kristoff Nov 18, 2024
6d8852b
chore: do not emit project
kod-kristoff Nov 18, 2024
9ea9fdc
ci: only cache uv, not .venv
kod-kristoff Nov 20, 2024
3a2fff0
ci: add --all-packages to uv sync calls
kod-kristoff Nov 20, 2024
272aaf5
chore: add --all-packages to uv sync calls
kod-kristoff Nov 21, 2024
cf7f0e5
ci: bump codecov-action to v5
kod-kristoff Nov 21, 2024
ca45aa5
ci: use make install-dev where possible
kod-kristoff Nov 21, 2024
5ce716e
chore: use uv instead of pdm
kod-kristoff Nov 22, 2024
76e618e
chore: migrate pre-commit-config
kod-kristoff Nov 22, 2024
cced77c
chore: remove old Makefiles and CI
kod-kristoff Nov 22, 2024
7a51b75
Merge remote-tracking branch 'make/main' into bump-to-python-39
kod-kristoff Nov 22, 2024
2ce8edf
chore: adapt Makefile to project
kod-kristoff Nov 22, 2024
92e5a2b
Merge remote-tracking branch 'ci/main' into bump-to-python-39
kod-kristoff Nov 22, 2024
c447cee
ci: rename release workflow
kod-kristoff Nov 22, 2024
fbb59c2
ci: configure CI for project
kod-kristoff Nov 22, 2024
7c5e88f
feat: bump python-version to 3.9
kod-kristoff Nov 22, 2024
f4418f3
chore: config git-cliff to use Keep-a-changelog format
kod-kristoff Nov 22, 2024
01a1f2e
chore(dev-deps): add ruff
kod-kristoff Nov 22, 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
10 changes: 5 additions & 5 deletions .github/DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@

In this folder there is configuration for codecoverage, dependabot and ci workflows.

This folder can be merged using a `--allow-unrelated-histories` merge strategy from <https://github.com/spraakbanken/python-pdm-ci-conf> which provides a reasonably sensible base for writing your own ci on. By using this strategy the history of the CI repo is included in your repo, and future updates to the CI can be merged later.
This folder can be merged using a `--allow-unrelated-histories` merge strategy from <https://github.com/spraakbanken/python-uv-ci-conf> which provides a reasonably sensible base for writing your own ci on. By using this strategy the history of the CI repo is included in your repo, and future updates to the CI can be merged later.

The workflows in this folder requires a root Makefile with a couple of targets defined.
As base can the Makefile in <https://github.com/spraakbanken/python-pdm-make-conf> be used.
As base can the Makefile in <https://github.com/spraakbanken/python-uv-make-conf> be used.

## Publish

The `publish`-step in [test.yml](./workflows/test.yml) is configured to use the GitHub environment `release`, create that or change to your preferred environment.
The `publish`-step in [release.yml](./workflows/release.yml) is configured to use the GitHub environment `release`, create that or change to your preferred environment.
To publish to PyPI you must also configure your Pypi-project settings to use Trusted Publisher Management, by setting repo, workflow and environment on PyPI.

To perform this merge run:

```shell
git remote add ci [email protected]:spraakbanken/python-pdm-ci-conf.git
git remote add ci [email protected]:spraakbanken/python-uv-ci-conf.git
git fetch ci
git merge --allow-unrelated-histories ci/main
```

or add the remote as `git remote add ci https://github.com/spraakbanken/python-pdm-ci-conf.git`
or add the remote as `git remote add ci https://github.com/spraakbanken/python-uv-ci-conf.git`

To later merge updates to this repo, just run:

Expand Down
71 changes: 41 additions & 30 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ permissions:
contents: read

env:
MINIMUM_PYTHON_VERSION: "3.8"
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"

# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
Expand All @@ -22,82 +23,93 @@ concurrency:
jobs:
fmt:
runs-on: ubuntu-latest
name: ubuntu / 3.8 / fmt
name: ubuntu / 3.9 / fmt
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up the python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: pdm-project/setup-pdm@v4
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}

- name: Load cached venv
id: cached-venv
uses: actions/cache@v4

#----------------------------------------------
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: make install-dev

- name: check formatting
run: make check-fmt

lint:
runs-on: ubuntu-latest
name: ubuntu / 3.8 / lint
name: ubuntu / 3.9 / lint
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up the python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: pdm-project/setup-pdm@v4
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4

#----------------------------------------------
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: make install-dev

- name: lint code
run: make lint

type-check:
runs-on: ubuntu-latest
name: ubuntu / 3.8 / type-check
name: ubuntu / 3.9 / type-check
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up the python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: pdm-project/setup-pdm@v4
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4

#----------------------------------------------
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: make install-dev

- name: type-check code
run: make type-check

# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check-check:
if: always()
needs:
needs:
- fmt
- lint
- type-check
Expand All @@ -108,4 +120,3 @@ jobs:
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-failures: upload-coverage
40 changes: 25 additions & 15 deletions .github/workflows/release-sentence-sentiment-kb-sent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
tags:
- 'sentence-sentiment-kb-sent-v[0-9]+.[0-9]+.[0-9]+'
- "sentence-sentiment-kb-sent-v[0-9]+.[0-9]+.[0-9]+"
pull_request:
merge_group:

Expand All @@ -16,13 +16,14 @@ permissions:
contents: read

env:
MINIMUM_PYTHON_VERSION: "3.8"
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"

jobs:
build:
# This action builds distribution files for upload to PyPI

name: ubuntu / 3.8 / build
name: ubuntu / 3.9 / build
runs-on: ubuntu-latest
steps:
#----------------------------------------------
Expand All @@ -32,41 +33,50 @@ jobs:
uses: actions/checkout@v4
with:
submodules: true

#----------------------------------------------
# ----- setup python -----
#----------------------------------------------
- name: Set up the environment
uses: pdm-project/setup-pdm@v4
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}


#----------------------------------------------
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true

#----------------------------------------------
# ----- build distribution -----
#----------------------------------------------
- name: Build distribution
run: cd sparv-sbx-sentence-sentiment-kb-sent && make build
run: make sparv-sbx-sentence-sentiment-kb-sent-build

#----------------------------------------------
# ----- upload artifacts -----
#----------------------------------------------
- uses: actions/upload-artifact@v4
with:
name: pypi_files
path: sparv-sbx-sentence-sentiment-kb-sent/dist
path: dist

test-build:
# This action runs the test suite on the built artifact in the `build` action.
# The default is to run this in ubuntu, macos and windows

name: ${{ matrix.os }} / 3.8 / test built artifact
name: ${{ matrix.os }} / 3.9 / test built artifact
needs: [build]

strategy:
fail-fast: false
matrix:
os:
os:
- ubuntu

runs-on: ${{ matrix.os }}-latest
Expand All @@ -90,12 +100,12 @@ jobs:
- run: pip install typing-extensions
- run: pip install -r sparv-sbx-sentence-sentiment-kb-sent/tests/requirements-testing.lock
- run: pip install sparv-sbx-sentence-sentiment-kb-sent --no-index --no-deps --find-links dist --force-reinstall
- run: pytest
- run: pytest sparv-sbx-sentence-sentiment-kb-sent/tests

# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
release-check:
if: always()
needs:
needs:
- build
- test-build
runs-on: ubuntu-latest
Expand All @@ -108,9 +118,9 @@ jobs:
# allowed-failures: coverage

publish:
# This action publishes the built and tested artifact to PyPI, but only on a tag
# This action publishes the built and tested artifact to PyPI, but only on a tag

needs:
needs:
- test-build
if: success() && startsWith(github.ref, 'refs/tags/sentence-sentiment-kb-sent-v')
runs-on: ubuntu-latest
Expand Down
60 changes: 22 additions & 38 deletions .github/workflows/scheduled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,68 +9,52 @@ on:
branches: [main]
pull_request:
schedule:
- cron: '7 7 * * *'
- cron: "7 7 * * *"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

name: rolling

env:
UV_VERSION: "0.5.1"

jobs:
# https://twitter.com/mycoliza/status/1571295690063753218
nightly:
runs-on: ubuntu-latest
name: ubuntu / 3.13-dev
continue-on-error: true # allow failure until py3.8 is dropped
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install pdm
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.11"
- name: Install python
uses: actions/setup-python@v5
with:
python-version: "3.13-dev"
- run: python --version
- name: pdm lock
if: hashFiles('pdm.lock') == ''
run: pdm lock
- name: pdm sync --dev
run: pdm sync --dev
- name: make test
run: make test
# https://twitter.com/alcuadrado/status/1571291687837732873
update:
# This action checks that updating the dependencies of this crate to the latest available that
# satisfy the versions in Cargo.toml does not break this crate. This is important as consumers
# satisfy the versions in pyproject.toml does not break this crate. This is important as consumers
# of this crate will generally use the latest available crates. This is subject to the standard
# Cargo semver rules (i.e cargo does not update to a new major version unless explicitly told
# to).
runs-on: ubuntu-latest
name: ubuntu / 3.12 / updates work
# There's no point running this if no Cargo.lock was checked in in the first place, since we'd
# There's no point running this if no uv.lock was checked in in the first place, since we'd
# just redo what happened in the regular test job. Unfortunately, hashFiles only works in if on
# steps, so we repeat it.
continue-on-error: true # allow failure until py3.8 is dropped
steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up uv
if: hashFiles('uv.lock') != ''
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true

- name: Install 3.12
if: hashFiles('pdm.lock') != ''
uses: pdm-project/setup-pdm@v4
if: hashFiles('uv.lock') != ''
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: pdm update
if: hashFiles('pdm.lock') != ''
run: pdm update
- name: pdm sync --dev
if: hashFiles('pdm.lock') != ''
run: pdm sync --dev

- name: uv sync --dev --upgrade
if: hashFiles('uv.lock') != ''
run: uv sync --dev --upgrade --all-packages --all-extras

- name: make test
if: hashFiles('pdm.lock') != ''
if: hashFiles('uv.lock') != ''
run: make test
Loading
Loading