Skip to content

Commit

Permalink
Format YAML files with yamllint rules
Browse files Browse the repository at this point in the history
  • Loading branch information
akaihola committed Feb 17, 2022
1 parent e29447a commit e14866a
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 82 deletions.
8 changes: 6 additions & 2 deletions .github/actions/commit-range/action.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Copyright (c) 2022, Eindhoven University of Technology - CST Robotics Group
# BDS 3-Clause License (see ./LICENSE.md)

Expand All @@ -13,7 +14,8 @@ runs:
- name: Commit range
id: commit-range
env:
commit_list: ${{ toJson(github.event.commits) }} # Doing this inside run doesn't work because of piping
# Doing this inside run doesn't work because of piping:
commit_list: ${{ toJson(github.event.commits) }}
run: |
if [ "${GITHUB_EVENT_NAME}" == "push" ]
then
Expand All @@ -26,7 +28,9 @@ runs:
NEWEST=$(echo "${commit_list}" | jq 'last.id' | tr -d '"')
OLDEST_PARENTS=($(git show --no-patch --format="%P" ${OLDEST}))
NUMBER_OLDEST_PARENTS=${#OLDEST_PARENTS[@]}
COMMIT_RANGE="${OLDEST}^${NUMBER_OLDEST_PARENTS}...${NEWEST}" # Take second parent if possible, see https://stackoverflow.com/a/2222920
# Take second parent if possible,
# see https://stackoverflow.com/a/2222920:
COMMIT_RANGE="${OLDEST}^${NUMBER_OLDEST_PARENTS}...${NEWEST}"
fi
elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]
then
Expand Down
94 changes: 48 additions & 46 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
name: build

on:
on: # yamllint disable-line rule:truthy
push:
branches:
- master
- master
pull_request:
branches:
- master
- master


jobs:
Expand All @@ -17,22 +18,22 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- ubuntu-latest
- macos-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-21.11
- name: Run tests in nix-shell
run: |
nix-shell --pure --run '
python -m venv venv
venv/bin/pip install -e '.[isort,test]'
venv/bin/pytest
' ./default.nix
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-21.11
- name: Run tests in nix-shell
run: |
nix-shell --pure --run '
python -m venv venv
venv/bin/pip install -e '.[isort,test]'
venv/bin/pytest
' ./default.nix
build:

Expand All @@ -41,37 +42,38 @@ jobs:
fail-fast: false
matrix:
os:
- ubuntu-latest
- windows-latest
- macos-latest
- ubuntu-latest
- windows-latest
- macos-latest
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
constraints: ['']
include:
- os: ubuntu-latest
python-version: '3.7'
constraints: '--constraint constraints-oldest.txt'
- os: ubuntu-latest
python-version: '3.10'
constraints: '--constraint constraints-future.txt'
- os: ubuntu-latest
python-version: '3.7'
constraints: '--constraint constraints-oldest.txt'
- os: ubuntu-latest
python-version: '3.10'
constraints: '--constraint constraints-future.txt'

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade 'pip>=20.3' # strict dependency resolution added in pip 20.3
pip install -e '.[isort,test]' ${{ matrix.constraints }}
- name: Test with pytest
run: |
pytest
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
# strict dependency resolution added in pip 20.3
python -m pip install --upgrade 'pip>=20.3'
pip install -e '.[isort,test]' ${{ matrix.constraints }}
- name: Test with pytest
run: |
pytest
34 changes: 18 additions & 16 deletions .github/workflows/test-future.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
---
name: test-future

# This workflow detects breakage against upcoming releases of dependencies
# even in the absence of activity in Darker's own repository.

on:
on: # yamllint disable-line rule:truthy
schedule:
- cron: "05 20 * * 6"
- cron: "05 20 * * 6"

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: 'master'
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade 'pip>=20.3' # strict dependency resolution added in pip 20.3
pip install -e '.[isort,test]' --constraint constraints-future.txt
- name: Test with pytest
run: |
pytest
- uses: actions/checkout@v2
with:
ref: 'master'
fetch-depth: 0
- uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: Install dependencies
run: |
# strict dependency resolution added in pip 20.3
python -m pip install --upgrade 'pip>=20.3'
pip install -e '.[isort,test]' --constraint constraints-future.txt
- name: Test with pytest
run: |
pytest
1 change: 1 addition & 0 deletions .github/workflows/yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Yaml Lint
on: [push] # yamllint disable-line rule:truthy
jobs:
Expand Down
19 changes: 10 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
# See https://pre-commit.com for more information
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/akaihola/darker
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- repo: https://github.com/akaihola/darker
rev: master
hooks:
- id: darker
- id: darker
args: [--isort]
additional_dependencies:
- black~=21.8b0
- isort~=5.9
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
rev: v1.0.1
hooks:
- id: rst-linter
- id: rst-linter
args: [--allow-raw]
4 changes: 3 additions & 1 deletion .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
- id: darker
name: darker
description: "Black reformatting to Python files only in regions changed since last commit"
description: >-
Black reformatting to Python files only in regions changed since last commit
entry: "darker -r :PRE-COMMIT:"
language: python
language_version: python3
Expand Down
3 changes: 2 additions & 1 deletion .sourcery.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
ignore:
- 'test_*.py' # parameterized tests would trigger Length and Working Memory detection
- 'test_*.py' # parameterized tests trigger Length & Working Memory detection
16 changes: 9 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
---
name: "Darker"
description: "Apply Black, isort and linters to modified lines only."
author: "Antti Kaihola and contributors to Darker"
inputs:
options:
description:
"Options passed to Darker. Use `darker --help` to see available options. Default:
'--check --diff'"
description: >-
Options passed to Darker. Use `darker --help` to see available options.
Default: '--check --diff'
required: false
default: "--check --diff"
src:
Expand All @@ -17,9 +18,9 @@ inputs:
required: false
default: "1.4.0"
revision:
description:
'Git revision range to compare when determining modified lines. '
'Determined automatically if omitted.'
description: >-
Git revision range to compare when determining modified lines.
Determined automatically if omitted.
required: false
branding:
color: "black"
Expand Down Expand Up @@ -54,7 +55,8 @@ runs:
echo $entrypoint | python3
fi
env:
# TODO: Remove once https://github.com/actions/runner/issues/665 is fixed.
# TODO: Remove once https://github.com/actions/runner/issues/665 is
# fixed.
INPUT_OPTIONS: ${{ inputs.options }}
INPUT_SRC: ${{ inputs.src }}
INPUT_VERSION: ${{ inputs.version }}
Expand Down

0 comments on commit e14866a

Please sign in to comment.