Skip to content

Commit

Permalink
chore: update eslint-config and dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
kelsos committed Jan 24, 2024
1 parent 7b941aa commit 862e2d6
Show file tree
Hide file tree
Showing 27 changed files with 1,775 additions and 2,378 deletions.
3 changes: 0 additions & 3 deletions .eslintignore

This file was deleted.

15 changes: 15 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended",
":dependencyDashboard",
":dependencyDashboardApproval"
],
"packageRules": [
{
"allowedVersions": "/^(20)\\./",
"groupName": "Node.js",
"matchPackageNames": ["@types/node", "node"]
}
]
}
1 change: 0 additions & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ jobs:
fi
id: diff

# If index.js was different than expected, upload the expected version as an artifact
- uses: actions/upload-artifact@v3
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Build
on: # rebuild any PRs and main branch changes
on:
pull_request:
push:
branches:
Expand Down
3 changes: 0 additions & 3 deletions .prettierignore

This file was deleted.

4 changes: 0 additions & 4 deletions .prettierrc.json

This file was deleted.

67 changes: 35 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,48 @@ for this folder.
### Basic

You setup the job checker in the following way:

```yaml
check-changes:
name: Required job check
runs-on: ubuntu-latest
outputs:
backend_tasks: ${{ steps.checker.outputs.backend_tasks }}
frontend_tasks: ${{ steps.checker.outputs.frontend_tasks }}
documentation_tasks: ${{ steps.checker.outputs.documentation_tasks }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run check action
uses: rotki/action-job-checker@v1
id: checker
with:
token: ${{ secrets.GITHUB_TOKEN }}
documentation_paths: |
docs
backend_paths: |
rotkehlchen
requirements.txt
requirements_dev.txt
requirements_lint.txt
frontend_paths: |
frontend/app
check-changes:
name: Required job check
runs-on: ubuntu-latest
outputs:
backend_tasks: ${{ steps.checker.outputs.backend_tasks }}
frontend_tasks: ${{ steps.checker.outputs.frontend_tasks }}
documentation_tasks: ${{ steps.checker.outputs.documentation_tasks }}
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run check action
uses: rotki/action-job-checker@v1
id: checker
with:
token: ${{ secrets.GITHUB_TOKEN }}
documentation_paths: |
docs
backend_paths: |
rotkehlchen
requirements.txt
requirements_dev.txt
requirements_lint.txt
frontend_paths: |
frontend/app
```
You use the output of the job in other jobs to enable disable running after push.
```yaml
lint-frontend:
name: Frontend lint
needs: [check-changes]
if: ${{ needs.check-changes.outputs.frontend_tasks }}
runs-on: ubuntu-latest
steps:
...
lint-frontend:
name: Frontend lint
needs: [check-changes]
if: ${{ needs.check-changes.outputs.frontend_tasks }}
runs-on: ubuntu-latest
steps:
...
```
#### Outputs
The action has the following outputs:
- **frontend_tasks**: boolean
Expand All @@ -68,8 +70,9 @@ The action supports the following commit message flags:
- `[skip ci]` or `[ci skip]` will not run any of the jobs regardless of the change status of the monitoring directory.
- `[run e2e]` will run only the e2e test suite
- `[run frontend]` will run only the frontend tasks (including e2e)

### Backend

- `[skip py tests]` will not run the python backend tests regardless of the change status of the monitored directory.
- `[run nft py tests]` will set the `test_environment` output to `nft`.
- `[run all py tests]` will set the `test_environment` output flag to `nightly`
- `[run all py tests]` will set the `test_environment` output flag to `nightly`
31 changes: 17 additions & 14 deletions __tests__/action.test.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
import { expect, it } from 'vitest';
import { Tag, type Tags } from '../src/tags';
import { type IActionInputs } from '../src/input';
import { checkRequiredTasks } from '../src/action';
import { type RunList } from '../src/types';
import type { IActionInputs } from '../src/input';
import type { RunList } from '../src/types';

const generateCommit = (tag: Tags | '' = ''): string => {
function generateCommit(tag: Tags | '' = ''): string {
const commitTag = tag ? `[${tag}]` : '';
return `Test commit message
${commitTag}
`;
};
}

const generateInputs = (): IActionInputs => ({
frontendPaths: [],
backendPaths: [],
documentationPaths: [],
});
function generateInputs(): IActionInputs {
return {
frontendPaths: [],
backendPaths: [],
documentationPaths: [],
};
}

test('[run e2e] will only run e2e', async () => {
it('[run e2e] will only run e2e', async () => {
expect(
await checkRequiredTasks(generateCommit(Tag.RUN_E2E), generateInputs()),
).toMatchObject({
Expand All @@ -28,7 +31,7 @@ test('[run e2e] will only run e2e', async () => {
} satisfies RunList);
});

test('[run all] will only run all tasks', async () => {
it('[run all] will only run all tasks', async () => {
expect(
await checkRequiredTasks(generateCommit(Tag.RUN_ALL), generateInputs()),
).toMatchObject({
Expand All @@ -39,7 +42,7 @@ test('[run all] will only run all tasks', async () => {
} satisfies RunList);
});

test('[run frontend] will only run frontend tasks', async () => {
it('[run frontend] will only run frontend tasks', async () => {
expect(
await checkRequiredTasks(
generateCommit(Tag.RUN_FRONTEND),
Expand All @@ -53,7 +56,7 @@ test('[run frontend] will only run frontend tasks', async () => {
} satisfies RunList);
});

test('[skip ci] will only run nothing', async () => {
it('[skip ci] will only run nothing', async () => {
expect(
await checkRequiredTasks(generateCommit(Tag.SKIP_CI), generateInputs()),
).toMatchObject({
Expand All @@ -64,7 +67,7 @@ test('[skip ci] will only run nothing', async () => {
} satisfies RunList);
});

test('[ci skip] will only run nothing', async () => {
it('[ci skip] will only run nothing', async () => {
expect(
await checkRequiredTasks(generateCommit(Tag.CI_SKIP), generateInputs()),
).toMatchObject({
Expand Down
7 changes: 4 additions & 3 deletions __tests__/changes.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { expect, it } from 'vitest';
import { changeDetected } from '../src/changes';

test('a file matches', () => {
it('a file matches', () => {
const monitored = ['rotkehlchen', 'requirements.txt'];
const changed = ['requirements.txt'];
expect(changeDetected(monitored, changed)).toBe(true);
});

test('a path matches', () => {
it('a path matches', () => {
const monitored = ['rotkehlchen', 'requirements.txt'];
const changed = ['rotkehlchen/args.py'];
expect(changeDetected(monitored, changed)).toBe(true);
});

test('nothing matches', () => {
it('nothing matches', () => {
const monitored = ['rotkehlchen', 'requirements.txt'];
const changed = ['docs'];
expect(changeDetected(monitored, changed)).toBe(false);
Expand Down
5 changes: 3 additions & 2 deletions __tests__/commit.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { expect, it } from 'vitest';
import { useCheckForTag } from '../src/commit';
import { Tag } from '../src/tags';

test('a commit matches the tag', () => {
it('a commit matches the tag', () => {
const commit = `Test commit message
[run all]
Expand All @@ -10,7 +11,7 @@ test('a commit matches the tag', () => {
expect(checkForTag(Tag.RUN_ALL)).toBe(true);
});

test('a commit does not match the tag', () => {
it('a commit does not match the tag', () => {
const commit = 'Test commit message';
const checkForTag = useCheckForTag(commit);
expect(checkForTag(Tag.RUN_ALL)).toBe(false);
Expand Down
1 change: 0 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line import/no-commonjs
module.exports = {
extends: ['@commitlint/config-conventional'],
};
Loading

0 comments on commit 862e2d6

Please sign in to comment.