-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ci): add unified test/lint command
- Loading branch information
Showing
84 changed files
with
3,993 additions
and
542 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
GREEN:=\033[0;32m | ||
NC:=\033[0m | ||
RED:=\033[0;31m | ||
|
||
DAYS:=$(shell ls -d */ | sed 's:/$$::' | grep -E '^Day[0-9]{2}' | sort -u) | ||
|
||
|
||
init: # Init folder for a given [day] | ||
ifndef day | ||
@echo "[day] must be defined" | ||
else ifneq ("$(wildcard Day$(day))", "") | ||
@echo "directory already exists" | ||
else | ||
@mkdir -p Day$(day) | ||
@cp Day00/* Day$(day) | ||
@grep -rl "Day 0" Day$(day)/solutions.spec.ts | xargs sed -i "" "s/Day 0/Day $(day)/g" | ||
@echo "Day$(day) created! happy coding!" | ||
endif | ||
|
||
test: # Run tests | ||
ifndef day | ||
@echo "Running all tests for 2019" | ||
@for day in $(DAYS); do \ | ||
echo "----------------------------------------------------------------------"; \ | ||
echo "$(GREEN)Running tests for $$day...$(NC)"; \ | ||
pytest -v $$day || exit 1; \ | ||
done; | ||
else | ||
@echo "$(GREEN)Running tests for Day$(day)...$(NC)" | ||
@pytest -v Day$(day) || exit 1 | ||
endif | ||
|
||
lint: # Run linter | ||
ifndef day | ||
@echo "Running linter for 2019" | ||
@black --check . | ||
@isort --check-only . | ||
else | ||
@echo "$(GREEN)Running linter for Day$(day)...$(NC)" | ||
@black --check ./Day$(day) | ||
@isort --check-only ./Day$(day) | ||
endif |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
module.exports = { | ||
env: { | ||
browser: true, | ||
commonjs: true, | ||
es2021: true, | ||
}, | ||
extends: ['google', 'prettier'], | ||
overrides: [ | ||
{ | ||
env: { | ||
node: true, | ||
}, | ||
files: ['.eslintrc.{js,cjs}'], | ||
parserOptions: { | ||
sourceType: 'script', | ||
}, | ||
}, | ||
], | ||
parserOptions: { | ||
ecmaVersion: 'latest', | ||
}, | ||
rules: { | ||
'require-jsdoc': 'off', | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": true, | ||
"arrowParens": "always", | ||
"singleQuote": true, | ||
"trailingComma": "all", | ||
"bracketSpacing": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const {} = require("./helpers"); | ||
const {} = require('./helpers'); | ||
|
||
// Part 1; | ||
function step1(inputs) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const { getInputLines } = require("../utils/input"); | ||
const { step1, step2 } = require("./solutions"); | ||
const { day} = require('./config'); | ||
const {getInputLines} = require('../utils/input'); | ||
const {step1, step2} = require('./solutions'); | ||
const {day} = require('./config'); | ||
|
||
describe("Solutions", () => { | ||
let input = getInputLines(`./Day${day}/test.input.txt`); | ||
test("step 1", () => { | ||
describe('Solutions', () => { | ||
const input = getInputLines(`./Day${day}/test.input.txt`); | ||
test('step 1', () => { | ||
expect(step1(input)).toEqual(123); | ||
}); | ||
|
||
test("step 2", () => { | ||
test('step 2', () => { | ||
expect(step2(input)).toEqual(456); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const { getInputLines } = require("../utils/input"); | ||
const { step1, step2 } = require("./solutions"); | ||
const { day} = require('./config'); | ||
const {getInputLines} = require('../utils/input'); | ||
const {step1, step2} = require('./solutions'); | ||
const {day} = require('./config'); | ||
|
||
describe("Solutions", () => { | ||
let input = getInputLines(`./Day${day}/test.input.txt`); | ||
test("step 1", () => { | ||
describe('Solutions', () => { | ||
const input = getInputLines(`./Day${day}/test.input.txt`); | ||
test('step 1', () => { | ||
expect(step1(input)).toEqual(24000); | ||
}); | ||
|
||
test("step 2", () => { | ||
test('step 2', () => { | ||
expect(step2(input)).toEqual(45000); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
const { getInputLines } = require("../utils/input"); | ||
const { step1, step2 } = require("./solutions"); | ||
const { day} = require('./config'); | ||
const {getInputLines} = require('../utils/input'); | ||
const {step1, step2} = require('./solutions'); | ||
const {day} = require('./config'); | ||
|
||
describe("Solutions", () => { | ||
let input = getInputLines(`./Day${day}/test.input.txt`); | ||
test("step 1", () => { | ||
describe('Solutions', () => { | ||
const input = getInputLines(`./Day${day}/test.input.txt`); | ||
test('step 1', () => { | ||
expect(step1(input)).toEqual(15); | ||
}); | ||
|
||
test("step 2", () => { | ||
test('step 2', () => { | ||
expect(step2(input)).toEqual(12); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.