Skip to content

Commit

Permalink
Merge pull request #180 from crazy-max/update-node20
Browse files Browse the repository at this point in the history
chore: node 20 as default runtime
  • Loading branch information
crazy-max authored Sep 10, 2023
2 parents 7700025 + 7f31b0c commit 92a6081
Show file tree
Hide file tree
Showing 19 changed files with 2,098 additions and 1,577 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/dist/**
/coverage/**
/node_modules/**
5 changes: 3 additions & 2 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
{
"env": {
"node": true,
"es2021": true,
"jest/globals": true
"es6": true,
"jest": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended",
"plugin:jest/recommended",
"plugin:prettier/recommended"
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: ci

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
schedule:
- cron: '0 10 * * *'
Expand All @@ -20,8 +24,6 @@ jobs:
-
name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.14
-
name: Build Windows executables
run: |
Expand All @@ -37,7 +39,3 @@ jobs:
vt_api_key: ${{ secrets.VT_API_KEY }}
files: |
./tests/app/*.exe
-
name: Dump context
if: always()
uses: crazy-max/ghaction-dump-context@v2
12 changes: 4 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
name: test

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- 'master'
- 'releases/v*'
pull_request:
branches:
- 'master'
- 'releases/v*'

jobs:
test:
Expand All @@ -17,11 +18,6 @@ jobs:
-
name: Checkout
uses: actions/checkout@v4
-
name: Validate
uses: docker/bake-action@v3
with:
targets: validate
-
name: Test
uses: docker/bake-action@v3
Expand Down
45 changes: 45 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: validate

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
push:
branches:
- 'master'
- 'releases/v*'
pull_request:

jobs:
prepare:
runs-on: ubuntu-latest
outputs:
targets: ${{ steps.targets.outputs.matrix }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Targets matrix
id: targets
run: |
echo "matrix=$(docker buildx bake validate --print | jq -cr '.group.validate.targets')" >> $GITHUB_OUTPUT
validate:
runs-on: ubuntu-latest
needs:
- prepare
strategy:
fail-fast: false
matrix:
target: ${{ fromJson(needs.prepare.outputs.targets) }}
steps:
-
name: Checkout
uses: actions/checkout@v3
-
name: Validate
uses: docker/bake-action@v3
with:
targets: ${{ matrix.target }}
222 changes: 111 additions & 111 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

801 changes: 0 additions & 801 deletions .yarn/releases/yarn-3.2.4.cjs

This file was deleted.

874 changes: 874 additions & 0 deletions .yarn/releases/yarn-3.6.3.cjs

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
logFilters:
- code: YN0013
level: discard
- code: YN0019
level: discard
- code: YN0076
level: discard

nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.2.4.cjs
yarnPath: .yarn/releases/yarn-3.6.3.cjs
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@ outputs:
description: 'Analysis results formatted as asset=analysisURL (comma separated)'

runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
4 changes: 2 additions & 2 deletions dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

ARG NODE_VERSION=16
ARG NODE_VERSION=20

FROM node:${NODE_VERSION}-alpine AS base
RUN apk add --no-cache cpio findutils git
Expand Down Expand Up @@ -78,7 +78,7 @@ RUN --mount=type=bind,target=.,rw \
GITHUB_TOKEN=$(cat /run/secrets/GITHUB_TOKEN) \
VT_API_KEY=$(cat /run/secrets/VT_API_KEY) \
VT_MONITOR_API_KEY=$(cat /run/secrets/VT_MONITOR_API_KEY) \
yarn run test --coverageDirectory=/tmp/coverage
yarn run test --coverage --coverageDirectory=/tmp/coverage

FROM scratch AS test-coverage
COPY --from=test /tmp/coverage /
8 changes: 4 additions & 4 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions jest.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
module.exports = {
clearMocks: true,
testEnvironment: 'node',
moduleFileExtensions: ['js', 'ts'],
setupFiles: ['dotenv/config'],
testMatch: ['**/*.test.ts'],
transform: {
'^.+\\.ts$': 'ts-jest'
},
collectCoverageFrom: ['src/**/{!(main.ts),}.ts'],
coveragePathIgnorePatterns: ['dist/', 'node_modules/', '__tests__/'],
verbose: true
};
41 changes: 23 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
"description": "GitHub Action to upload and scan files with VirusTotal",
"main": "src/main.ts",
"scripts": {
"build": "ncc build --source-map --minify --license licenses.txt",
"lint": "eslint src/**/*.ts __tests__/**/*.ts",
"format": "eslint --fix src/**/*.ts __tests__/**/*.ts",
"test": "jest --coverage"
"build": "ncc build src/main.ts --source-map --minify --license licenses.txt",
"lint": "yarn run prettier && yarn run eslint",
"format": "yarn run prettier:fix && yarn run eslint:fix",
"eslint": "eslint --max-warnings=0 .",
"eslint:fix": "eslint --fix .",
"prettier": "prettier --check \"./**/*.ts\"",
"prettier:fix": "prettier --write \"./**/*.ts\"",
"test": "jest",
"all": "yarn run build && yarn run format && yarn test"
},
"repository": {
"type": "git",
Expand All @@ -21,7 +26,7 @@
],
"author": "CrazyMax",
"license": "MIT",
"packageManager": "yarn@3.2.4",
"packageManager": "yarn@3.6.3",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/github": "^5.1.1",
Expand All @@ -33,19 +38,19 @@
"devDependencies": {
"@types/form-data": "^2.5.0",
"@types/mime": "^3.0.1",
"@types/node": "^18.11.3",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"@typescript-eslint/parser": "^5.40.1",
"@vercel/ncc": "^0.34.0",
"dotenv": "^16.0.3",
"eslint": "^8.26.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-jest": "^27.1.3",
"eslint-plugin-prettier": "^4.2.1",
"jest": "^29.2.1",
"prettier": "^2.7.1",
"ts-jest": "^29.0.3",
"@types/node": "^20.6.0",
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@vercel/ncc": "^0.38.0",
"dotenv": "^16.3.1",
"eslint": "^8.49.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-prettier": "^5.0.0",
"jest": "^29.6.4",
"prettier": "^3.0.3",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "^4.8.4"
"typescript": "^5.2.2"
}
}
2 changes: 1 addition & 1 deletion src/virustotal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {lstatSync, readFileSync} from 'fs';
import {getType} from 'mime';
import {basename, posix} from 'path';
import axios, {AxiosInstance} from 'axios';
import * as FormData from 'form-data';
import FormData from 'form-data';
import * as core from '@actions/core';

interface UploadData {
Expand Down
2 changes: 1 addition & 1 deletion tests/app/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/crazy-max/ghaction-virustotal/test/app

go 1.14
go 1.20
3 changes: 1 addition & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
{
"compilerOptions": {
"esModuleInterop": true,
"target": "es6",
"module": "commonjs",
"newLine": "lf",
"outDir": "./lib",
"rootDir": "./src",
"esModuleInterop": false,
"forceConsistentCasingInFileNames": true,
"strict": true,
"noImplicitAny": false,
"resolveJsonModule": true,
"useUnknownInCatchVariables": false,
Expand Down
Loading

0 comments on commit 92a6081

Please sign in to comment.