Skip to content
This repository has been archived by the owner on May 1, 2023. It is now read-only.

Commit

Permalink
Merge branch 'main' into fix--logging-to-wandb-on-Overtaci
Browse files Browse the repository at this point in the history
  • Loading branch information
HLasse authored Oct 4, 2022
2 parents 1e8ab50 + 5e9d61d commit cb8276c
Show file tree
Hide file tree
Showing 43 changed files with 686 additions and 281 deletions.
51 changes: 51 additions & 0 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: 'Run tests'
description: 'Run tests'
inputs:
python-version:
description: "Which Python version to run on"
required: true
default: 3.9
poetry-version:
description: "Which version of Poetry to install"
default: 1.1.15
cache-version:
description: "Cache version for invalidation"
default: 0.0.0

runs:
using: "composite"
steps:
### Setup prerequisites
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

### Caching
- name: Cache poetry and venv
id: cache-poetry-and-venv
uses: MartinBernstorff/cache-poetry-and-venv@latest
with:
poetry-version: ${{ inputs.poetry-version }}
cache-version: ${{ inputs.cache-version }}
python-version: ${{ inputs.python-version }}

# Installing
- name: Install Poetry
if: steps.cache-poetry-and-venv.outputs.poetry-cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ inputs.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true

- name: Install Project
if: steps.cache-poetry-and-venv.outputs.venv-cache-hit != 'true'
shell: bash
run: poetry install -vvv

### Run tests
- name: Run pytest
shell: bash
run: |
poetry run pytest --cov=src --cov-report term-missing --color=yes
11 changes: 6 additions & 5 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "daily"
interval: "weekly"
day: "monday"
time: "05:00"
time: "01:00"
timezone: "Europe/Copenhagen"
reviewers:
- "MartinBernstorff"
open-pull-requests-limit: 20
open-pull-requests-limit: 5
commit-message:
prefix: "fix:"
include: "scope"
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- [ ] I have battle-tested on Overtaci (RMAPPS1279)
- [ ] I have bumped the version as described in the [wiki](https://www.notion.so/Setting-up-Poetry-on-your-local-machine-76647d75e8fa4d9ba553cbc2a49946d9#dca1e0f2ce934a49acd1851aaf882d75)
- [ ] I have assigned ranges (e.g. `>=0.1, <0.2`) to all new dependencies
- [ ] I have assigned ranges (e.g. `>=0.1, <0.2`) to all new dependencies (allows dependabot to keep dependency ranges wide for better compatability)
- [ ] At least one of the commits is prefixed with either "fix:" or "feat:"

## Notes for reviewers
Reviewers can skip X, but should pay attention to Y.
7 changes: 5 additions & 2 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ jobs:
if: ${{ github.actor == 'dependabot[bot]'}}

steps:
# Checkout action is required for token to persist
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --merge "$PR_URL" # Use Github CLI to merge automatically the PR
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Auto approve dependabot PRs
if: github.actor == 'dependabot[bot]'
uses: hmarr/auto-approve-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
54 changes: 54 additions & 0 deletions .github/workflows/main_test_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Test (and release)

on:
pull_request:
push:
branches:
- main

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.9]
poetry-version: [1.1.15]
cache-version: [0.0.2] # Change this number if you want to manually invalidate all caches

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Run tests
uses: ./.github/actions/test
with:
python-version: ${{ matrix.python-version }}
poetry-version: ${{ matrix.poetry-version }}
cache-version: ${{ matrix.cache-version }}

release:
runs-on: ubuntu-latest
concurrency: release
needs: test
if: ${{ github.ref == 'refs/heads/main' }}
steps:
# Checkout action is required for token to persist
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_BOT }}

- name: Python Semantic Release
uses: relekang/[email protected]
with:
github_token: ${{ secrets.RELEASE_BOT }}
# Remember to copy the tool.semantic_release section from pyproject.toml
# as well
# To enable pypi,
# 1) Set upload_to_pypi to true in pyproject.toml and
# 2) Set the pypi_token in the repo
# 3) Uncomment the two lines below
# repository_username: __token__
# repository_password: ${{ secrets.PYPI_TOKEN }}
2 changes: 2 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
- uses: pre-commit/[email protected]
56 changes: 0 additions & 56 deletions .github/workflows/pytest.yml

This file was deleted.

16 changes: 15 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@ repos:
- id: add-trailing-comma

- repo: https://github.com/asottile/pyupgrade
rev: v2.37.3
rev: v3.0.0
hooks:
- id: pyupgrade
args: ["--py39-plus"]

- repo: https://github.com/myint/docformatter
rev: v1.5.0
Expand Down Expand Up @@ -44,3 +45,16 @@ repos:
entry: check-yaml
language: python
types: [yaml]

- repo: https://github.com/pycqa/pylint
rev: v2.15.2
hooks:
- id: pylint
types: [python]
args:
[
"-rn", # Only display messages
"-sn", # Don't display the score
"--disable=R,import-error" # Refactors are not important enough to block a commit.
# Unused-imports aren't testable by the github action, so don't test that here.
]
Loading

0 comments on commit cb8276c

Please sign in to comment.