feat: update action to nodejs (#1159)

Co-authored-by: Tonye Jack <jtonye@ymail.com>
Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
tj-actions[bot]
2023-05-25 12:22:24 -06:00
committed by GitHub
parent 7bbc71bb94
commit 413fd78918
32 changed files with 16379 additions and 1012 deletions

View File

@@ -19,6 +19,11 @@ on:
jobs:
codacy-security-scan:
# Cancel other workflows that are running for the same branch
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
name: Codacy Security Scan
runs-on: ubuntu-latest
steps:

74
.github/workflows/codeql.yml vendored Normal file
View File

@@ -0,0 +1,74 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '44 20 * * 0'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
# Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"

View File

@@ -22,6 +22,7 @@ jobs:
uses: ./
with:
json: true
quotepath: false
- name: List all changed files
run: echo '${{ steps.changed-files.outputs.all_changed_files }}'
- id: set-matrix

View File

@@ -24,9 +24,81 @@ jobs:
- name: shellcheck
uses: reviewdog/action-shellcheck@v1.17
build:
runs-on: ubuntu-latest
if: github.event_name != 'push'
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
fetch-depth: 0
- name: Use Node.js 16.x
uses: actions/setup-node@v3.6.0
with:
cache: 'yarn'
node-version: '16.x'
- name: Create coverage directory and clover.xml
run: |
mkdir -p coverage
touch coverage/clover.xml
- name: Install dependencies
run: |
yarn install
- name: Run eslint on changed files
uses: tj-actions/eslint-changed-files@v18
with:
token: ${{ secrets.PAT_TOKEN }}
config_path: ".eslintrc.json"
ignore_path: ".eslintignore"
- name: Run build and test
run: |
yarn all
- name: Verify Changed files
uses: tj-actions/verify-changed-files@v14
id: changed_files
with:
files: |
src
dist
- name: Commit files
if: steps.changed_files.outputs.files_changed == 'true'
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add src dist
git commit -m "Added missing changes and modified dist assets."
- name: Push changes
if: steps.changed_files.outputs.files_changed == 'true'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.PAT_TOKEN }}
branch: ${{ github.head_ref }}
- name: Upload build assets
uses: actions/upload-artifact@v3
with:
name: build-assets
path: dist
- name: Run codacy-coverage-reporter
uses: codacy/codacy-coverage-reporter-action@v1
continue-on-error: true
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage/lcov.info
test-multiple-repositories:
name: Test with multiple repositories
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout into dir1
uses: actions/checkout@v3
@@ -34,16 +106,24 @@ jobs:
submodules: true
fetch-depth: 0
path: dir1
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with defaults on the dir1
id: changed-files-dir1
uses: ./dir1
with:
path: dir1
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir1.outputs) }}'
shell:
bash
- name: List all modified files
run: |
for file in ${{ steps.changed-files-dir1.outputs.modified_files }}; do
@@ -51,22 +131,26 @@ jobs:
done
shell:
bash
- name: Checkout into dir2
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
path: dir2
- name: Run changed-files with defaults on the dir2
id: changed-files-dir2
uses: ./dir2
with:
path: dir2
- name: Show output
run: |
echo '${{ toJSON(steps.changed-files-dir2.outputs) }}'
shell:
bash
- name: List all modified files
run: |
for file in ${{ steps.changed-files-dir2.outputs.modified_files }}; do
@@ -77,6 +161,7 @@ jobs:
test-using-since-and-until:
name: Test changed-files using since and until
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push'
@@ -86,6 +171,11 @@ jobs:
with:
fetch-depth: 0
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files since 2022-08-19
id: changed-files-since
uses: ./
@@ -129,6 +219,7 @@ jobs:
test-similar-base-and-commit-sha:
name: Test changed-files similar base and commit sha
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout to branch
@@ -136,6 +227,11 @@ jobs:
with:
fetch-depth: 0
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with similar base and commit sha
id: changed-files
continue-on-error: true
@@ -159,6 +255,7 @@ jobs:
test-unset-github-output-env:
name: Test unset GITHUB_OUTPUT env
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout to branch
@@ -166,6 +263,11 @@ jobs:
with:
fetch-depth: 0
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with unset GITHUB_OUTPUT env
id: changed-files
continue-on-error: true
@@ -182,6 +284,7 @@ jobs:
test-limited-commit-history:
name: Test changed-files with limited commit history
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
max-parallel: 4
@@ -195,6 +298,11 @@ jobs:
with:
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files
id: changed-files
uses: ./
@@ -210,11 +318,17 @@ jobs:
test-non-existent-base-sha:
name: Test changed-files non existent base sha
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout to branch
uses: actions/checkout@v3
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with non existent base sha
id: changed-files
uses: ./
@@ -257,11 +371,17 @@ jobs:
test-non-existent-sha:
name: Test changed-files non existent sha
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout to branch
uses: actions/checkout@v3
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with non existent sha
id: changed-files
uses: ./
@@ -304,6 +424,7 @@ jobs:
test-submodules:
name: Test changed-files with submodule
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
max-parallel: 4
@@ -318,6 +439,11 @@ jobs:
submodules: recursive
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Run changed-files with submodule
id: changed-files
uses: ./
@@ -341,6 +467,7 @@ jobs:
test:
name: Test changed-files
runs-on: ${{ matrix.platform }}
needs: build
strategy:
fail-fast: false
max-parallel: 4
@@ -354,6 +481,10 @@ jobs:
with:
submodules: true
fetch-depth: ${{ matrix.fetch-depth }}
- name: Download build assets
uses: actions/download-artifact@v3
with:
name: build-assets
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJson(github) }}