Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Replace tox with taskfile as build tool (#311)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssbarnea authored Jun 13, 2022
1 parent 010779e commit 8e7bcf8
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 48 deletions.
4 changes: 3 additions & 1 deletion .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ DISTRO
Devuan
FQRN
Junos
NXOS
Mageia
NXOS
SLES
TMOS
Taskfile
aci
ansiblelint
bigcrypt
bindep
bsdi
cliconf
cmds
codespell
cpus
dbservers
Expand Down
25 changes: 12 additions & 13 deletions .github/workflows/npm.yml → .github/workflows/task.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: npm
name: task

on:
create: # is used for publishing to PyPI and TestPyPI
Expand All @@ -19,17 +19,17 @@ on:
# - cron: 2 18 * * 5

jobs:
npm:
task:
runs-on: ubuntu-latest
name: ${{ matrix.npm_target }}
name: ${{ matrix.task_name }}
strategy:
matrix:
node-version: [16.x]
npm_target:
task_name:
- test
- lint
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3

# https://github.com/actions/cache
- uses: actions/cache@v2
Expand All @@ -49,20 +49,19 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: Install test deps
run: |
npm ci
python3 -m pip install --upgrade pre-commit
- run: npm ci
- name: Install Task
uses: arduino/setup-task@v1
with:
version: 3.x
repo-token: ${{ secrets.GITHUB_TOKEN }}

- run: npm run ${{ matrix.npm_target }}
- run: task ${{ matrix.task_name }}

check: # This job does nothing and is only used for the branch protection
if: always()

needs:
- npm
- task

runs-on: ubuntu-latest

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,4 @@ dmypy.json
.pyre/
node_modules
report.html
.task
79 changes: 79 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# see https://taskfile.dev/#/
version: "3"
output: group
vars:
VERSION:
sh: node -p "require('./package.json').version"
tasks:
default:
desc: Run most commands
deps:
- lint
- test
cmds:
- echo Passed all checks!
setup:
desc: Install dependencies
run: once # avoid duplicate runs as all task depend on this
cmds:
- npm ci
- pip3 install --user 'pip-tools>=6.6.2' pre-commit
# check that tools we need are installed
- npm --version
- pip-compile --version
- pre-commit --version
sources:
- Taskfile.yml
- package.json
- package-lock.json
deps:
desc: Update dependencies
deps:
- setup
cmds:
- pip-compile -q --no-header --no-annotate --output-file=requirements.txt
requirements.in
- npm run deps
lint:
desc: Lint the project
deps:
- setup
env:
PRE_COMMIT_COLOR: always
cmds:
- python3 -m pre_commit run -a
silent: true
sources:
- "*"
- "*.*"
- ".config"
- ".github"
- ".vscode"
- data
- f
- negative_test
- src
- test
test:
desc: Run all tests
deps:
- setup
cmds:
- npm run test
sources:
- f/
- negative_test/
- test/
- src/
- package.json
- package-lock.json
- Taskfile.yml
- tsconfig.json
interactive: true
pr:
desc: Opens a pull request using gh
deps:
- lint
cmds:
- gh pr create
interactive: true
5 changes: 1 addition & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
"vscode-json-languageservice": "^5.0.0"
},
"scripts": {
"ajv": "ajv",
"compile": "tsc -p ./src",
"deps": "npx npm-check-updates -u && npm install --ignore-scripts",
"lint": "pre-commit run -a",
"test": "mocha",
"postinstall": "pip install --user -r requirements.txt"
"test": "mocha"
},
"devDependencies": {
"@types/chai": "^4.3.1",
Expand Down
30 changes: 0 additions & 30 deletions tox.ini

This file was deleted.

0 comments on commit 8e7bcf8

Please sign in to comment.