Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce TypeScript and an integration test #45

Merged
merged 33 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
2c437fa
Remove unused imports
dbartholomae Nov 7, 2022
f37b9a7
Remove unused dependencies
dbartholomae Nov 7, 2022
9ce2238
Ignore JetBrains IDE files
dbartholomae Nov 7, 2022
bf925b5
Add compilation step with TypeScript
dbartholomae Nov 7, 2022
f8684ed
Type imports correctly
dbartholomae Nov 7, 2022
cd5be67
Remove unused parameter
dbartholomae Nov 7, 2022
19221e4
Add type annotations
dbartholomae Nov 7, 2022
ace5e24
Update GitHub Actions dependencies
dbartholomae Nov 7, 2022
e9a7f4a
Explicitly convert buffer to string
dbartholomae Nov 7, 2022
70e4348
Handle different types of sites explicitly
dbartholomae Nov 7, 2022
fdf1c16
Add Eslint with prettier
dbartholomae Nov 7, 2022
b5d25fe
Fix prettier and other auto-fixable linting rules
dbartholomae Nov 7, 2022
353cbb1
Wait for uploading reports before finishing
dbartholomae Nov 7, 2022
9290749
Fix linting
dbartholomae Nov 7, 2022
b363942
Add jest for running tests
dbartholomae Nov 7, 2022
96c2352
Remove unused import
dbartholomae Nov 7, 2022
c72f41e
Add missing request dependency
dbartholomae Nov 7, 2022
58fb512
Correctly import from @actions/github and @actions/artifact
dbartholomae Nov 7, 2022
faf1f52
Move all models into separate files
dbartholomae Nov 7, 2022
65c4120
Add fixture generators for most important data types
dbartholomae Nov 7, 2022
b75ad11
Add helpers to mock Github requests
dbartholomae Nov 7, 2022
52a62f6
Add test for creating an issue when there is no issue yet
dbartholomae Nov 7, 2022
6b888c4
Update eslint from 8.17.0 to 8.27.0
dbartholomae Nov 7, 2022
efb7b24
Add CONTRIBUTING.md
dbartholomae Nov 7, 2022
a10a983
Run tests on CI
dbartholomae Nov 7, 2022
82e5326
Show failing tests directly in Github
dbartholomae Nov 7, 2022
c98a9d9
Mock fs only during the test
dbartholomae Nov 7, 2022
f98fddd
Remove IDE files from .gitignore
dbartholomae Nov 16, 2022
5b90157
Rename CI workflow to ci
dbartholomae Nov 16, 2022
782fa46
Run CI on all PRs
dbartholomae Nov 16, 2022
cdaa31e
Run CI on Ubuntu, Windows, and Mac
dbartholomae Dec 10, 2022
1ff828e
Skip e2e test on mac
dbartholomae Dec 10, 2022
b93a6d1
Enforce checking out files with LF line ending
dbartholomae Dec 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text eol=lf
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: CI

on:
push:
branches: [ master ]
pull_request:

defaults:
run:
working-directory: packages/scans

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
cache-dependency-path: packages/scans/package-lock.json
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Run tests
run: npm test
- name: Build
run: npm run build
23 changes: 23 additions & 0 deletions packages/scans/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
plugins: ["@typescript-eslint", "prettier"],
parserOptions: {
project: ["./tsconfig.json"],
},
extends: [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/recommended-requiring-type-checking",
"plugin:jest/recommended",
"plugin:jest/style",
"plugin:jest-formatting/strict",
"prettier"
],
rules: {
// This rule would disallow using async to make the result a promise
"@typescript-eslint/require-await": "off",
// Enable auto-fixing for prettier rules
"prettier/prettier": "error"
},
};
4 changes: 4 additions & 0 deletions packages/scans/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!dist/**/*
!package.json
!README.md
6 changes: 6 additions & 0 deletions packages/scans/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Contributing

## Setting up the project

You need to `npm install` dependencies. Then you can lint with
`npm run lint`, test with `npm test`, and build with `npm run build`.
4 changes: 4 additions & 0 deletions packages/scans/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@

The following repository contains common code and helper functionalities to run the ZAP baseline scan and full scan with
GitHub Actions.

## Contributing

See [CONTRIBUTING.md](./CONTRIBUTING.md).
thc202 marked this conversation as resolved.
Show resolved Hide resolved
10 changes: 10 additions & 0 deletions packages/scans/jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
reporters: [
'default',
'github-actions',
],
"setupFilesAfterEnv": ["jest-os-detection"],
};
Loading