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

Extend CI #62

Merged
merged 23 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
fd39052
initial commit
kod-kristoff Feb 6, 2024
cd66ecf
refactor: rename to check-check
kod-kristoff Feb 6, 2024
1c2fa68
feat: add minimal and doctests jobs
kod-kristoff Feb 6, 2024
ea7a260
Bump actions/cache from 3 to 4
dependabot[bot] Feb 6, 2024
a37c337
initial commit
kod-kristoff Feb 6, 2024
85a148e
fix: adjust names
kod-kristoff Feb 6, 2024
c54965f
Merge pull request #1 from spraakbanken/dependabot/github_actions/act…
kod-kristoff Feb 6, 2024
d2bb666
fix: make code more mergeable
kod-kristoff Feb 6, 2024
9aa9db8
ci: fix so that nightly uses 3.13-dev
kod-kristoff Feb 6, 2024
ae5d28b
ci: fix typo
kod-kristoff Feb 6, 2024
90f2b02
ci: add concurreny to test
kod-kristoff Feb 6, 2024
c111d84
ci: prepare CI/Makefile rework
kod-kristoff Feb 6, 2024
11042d1
Merge remote-tracking branch 'ci/main' into extend-ci
kod-kristoff Feb 6, 2024
d49c6b8
Merge remote-tracking branch 'make/main' into extend-ci
kod-kristoff Feb 6, 2024
7638105
build: use pdm export
kod-kristoff Feb 6, 2024
f5e5deb
build: ignore .pdm stuff
kod-kristoff Feb 6, 2024
a6076da
build: use pdm instead of rye
kod-kristoff Feb 6, 2024
99441d4
Merge remote-tracking branch 'make/main' into extend-ci
kod-kristoff Feb 6, 2024
d4a465f
build: add orjson to export command
kod-kristoff Feb 6, 2024
c364ae8
ci(scheduled): install pdm separate
kod-kristoff Feb 6, 2024
6434cf1
Merge remote-tracking branch 'ci/main' into extend-ci
kod-kristoff Feb 6, 2024
ca60816
Merge branch 'main' into extend-ci
kod-kristoff Feb 6, 2024
d05ec02
ci: add json-lib
kod-kristoff Feb 6, 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
27 changes: 27 additions & 0 deletions .github/DOCS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Github config and workflows

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.

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.

To perform this merge run:

```shell
git remote add ci [email protected]:spraakbanken/python-pdm-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`

To later merge updates to this repo, just run:

```shell
git fetch ci
get merge ci/main
```

This setup is inspired by <https://github.com/jonhoo/rust-ci-conf>.
58 changes: 0 additions & 58 deletions .github/actions/setup-python-env/action.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# ref: https://docs.codecov.com/docs/codecovyml-reference
coverage:
# Hold ourselves to a high bar
range: 85..100
round: down
precision: 1
status:
# ref: https://docs.codecov.com/docs/commit-status
project:
default:
# Avoid false negatives
threshold: 1%

# Test files aren't important for coverage
ignore:
- "tests"

# Make comments less noisy
comment:
layout: "files"
require_changes: true
17 changes: 13 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,21 @@

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
ignore:
- dependency-name: "*"
# patch and minor updates don't matter for libraries as consumers of this library build
# with their own lockfile, rather than the version specified in this library's lockfile
# remove this ignore rule if your package has binaries to ensure that the binaries are
# built with the exact set of dependencies and those are up to date.
update-types:
- "version-update:semver-patch"
- "version-update:semver-minor"
105 changes: 105 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: check

on:
push:
branches:
- main
pull_request:
merge_group:

permissions:
contents: read

env:
MINIMUM_PYTHON_VERSION: "3.9"

# 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
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
fmt:
runs-on: ubuntu-latest
name: ubuntu / fmt
steps:
- uses: actions/checkout@v4

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

- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}

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

- name: check formatting
run: make check-fmt
lint:
runs-on: ubuntu-latest
name: ubuntu / lint
steps:
- uses: actions/checkout@v4
- name: Set up the python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: pdm-project/setup-pdm@v4
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}
- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: make install-dev-orjson
- name: lint code
run: make lint
type-check:
runs-on: ubuntu-latest
name: ubuntu / type-check
steps:
- uses: actions/checkout@v4
- name: Set up the python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: pdm-project/setup-pdm@v4
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: Load cached venv
id: cached-venv
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/pyproject.toml') }}-${{ hashFiles('.github/workflows/check.yml') }}
- name: Install dependencies
if: steps.cached-venv.outputs.cache-hit != 'true'
run: make install-dev-orjson
- name: type-check code
run: make lint

# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
check-check:
if: always()
needs:
- fmt
- lint
- type-check
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-failures: upload-coverage
Loading