Skip to content

Commit 24ed04f

Browse files
authored
Merge pull request #424 from sir-gon/develop
Develop
2 parents d373602 + 587dc2c commit 24ed04f

File tree

8 files changed

+59
-20
lines changed

8 files changed

+59
-20
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ on:
2323
jobs:
2424
analyze:
2525
name: Analyze
26-
runs-on: ubuntu-latest
26+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
2727
permissions:
2828
actions: read
2929
contents: read
@@ -34,6 +34,8 @@ jobs:
3434
matrix:
3535
language: [ 'javascript' ]
3636
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Use only 'java' to analyze code written in Java, Kotlin or both
38+
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
3739
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
3840

3941
steps:
@@ -49,11 +51,11 @@ jobs:
4951
# By default, queries listed here will override any specified in a config file.
5052
# Prefix the list here with "+" to use these queries and those in the config file.
5153

52-
# 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
54+
# For more 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
5355
# queries: security-extended,security-and-quality
5456

5557

56-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
58+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5759
# If this step fails, then you should remove it and run the build manually (see below)
5860
- name: Autobuild
5961
uses: github/codeql-action/autobuild@v3
@@ -65,8 +67,10 @@ jobs:
6567
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
6668

6769
# - run: |
68-
# echo "Run, Build Application using script"
69-
# ./location_of_script_within_repo/buildscript.sh
70+
# echo "Run, Build Application using script"
71+
# ./location_of_script_within_repo/buildscript.sh
7072

7173
- name: Perform CodeQL Analysis
7274
uses: github/codeql-action/analyze@v3
75+
with:
76+
category: "/language:${{matrix.language}}"

.github/workflows/docker-image.yml

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,27 @@ jobs:
1515

1616
steps:
1717
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
18-
#- name: Build the Docker image
19-
# run: docker build . --file Dockerfile --tag algorithm-exercises-go:${{ github.sha }}
2018
- name: Build the Docker image
2119
run: make compose/rebuild
2220
- name: Run test in Docker image
2321
run: make compose/run
2422
- name: Tag Docker image
25-
run: docker tag algorithm-exercises-js:latest algorithm-exercises-js:${{ github.sha }}
23+
run: docker tag algorithm-exercises-js:latest algorithm-exercises-js:${{ github.sha }}
2624

25+
- name: Run Snyk to check Docker image for vulnerabilities
26+
# Snyk can be used to break the build when it detects vulnerabilities.
27+
# In this case we want to upload the issues to GitHub Code Scanning
28+
continue-on-error: true
29+
uses: snyk/actions/docker@master
30+
env:
31+
# In order to use the Snyk Action you will need to have a Snyk API token.
32+
# See https://docs.snyk.io/integrations/ci-cd-integrations/github-actions-integration#getting-your-snyk-token
33+
# or you can sign up for free at https://snyk.io/login
34+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
35+
with:
36+
image: algorithm-exercises-js:latest
37+
args: --file=Dockerfile
38+
# - name: Upload result to GitHub Code Scanning
39+
# uses: github/codeql-action/upload-sarif@v2
40+
# with:
41+
# sarif_file: snyk.sarif

.github/workflows/eslint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ name: ESLint
1111

1212
on:
1313
push:
14-
branches: [ "main", "develop", "feature/*" ]
14+
branches: [ "main", "develop" ]
1515
pull_request:
1616
# The branches below must be a subset of the branches above
1717
branches: [ "main" ]

.github/workflows/node-coverage.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
run: npm run lint
3737

3838
- name: Run the tests
39-
run: npm test -- --coverage
39+
run: npm run jest:ci -- --coverage
4040

4141
- name: Upload coverage reports to Codecov with GitHub Action
4242
uses: codecov/codecov-action@v4

.github/workflows/node-snyk.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Snyk Code analysis
5+
6+
on:
7+
push:
8+
branches: [ main, develop, feature/* ]
9+
pull_request:
10+
branches: [ main ]
11+
12+
jobs:
13+
security:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@master
17+
- name: Run Snyk to check for vulnerabilities
18+
uses: snyk/actions/node@master
19+
env:
20+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}

.github/workflows/node.js.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3-
41
name: Node.js CI Tests
52

63
on:
@@ -25,9 +22,10 @@ jobs:
2522
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2623

2724
steps:
28-
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
25+
- name: Checkout repository
26+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
2927

30-
- name: Use Node.js ${{ matrix.node-version }}
28+
- name: Set up Node.js ${{ matrix.node-version }}
3129
uses: actions/setup-node@v4
3230
with:
3331
node-version: ${{ matrix.node-version }}
@@ -38,5 +36,5 @@ jobs:
3836
- name: Lint
3937
run: npm run lint
4038

41-
- name: Test
42-
run: npm run test
39+
- name: Run the tests
40+
run: npm run jest:ci

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ env:
4444
@echo "################################################################################"
4545

4646
clean:
47+
npm run jest:clean
4748
rm -vfr ./node_modules
4849
rm -vfr ./coverage
4950
mkdir -p ./coverage
@@ -65,7 +66,7 @@ test/static: dependencies
6566
npm run lint
6667

6768
test: env dependencies test/static
68-
npm run test
69+
npm run jest:ci
6970

7071
coverage: test
7172

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
"start": "npm run test",
88
"lint": "npx eslint . --color --max-warnings=0 && echo '✔ Your code looks good.'",
99
"lint:watch": "npx esw . --color --max-warnings=0 --watch",
10-
"jest": "node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug",
10+
"jest:ci": "node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug",
11+
"jest:clean": "jest --clearCache && watchman watch-del-all",
1112
"jest:bruteforce": "BRUTEFORCE=true node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug",
1213
"jest:watch": "node --experimental-vm-modules ./node_modules/.bin/jest --no-cache --ci --color --detectOpenHandles --forceExit --runInBand --debug --watchAll",
1314
"prettier": "npx prettier --write 'src/**/*.js'",
14-
"test": "npm run jest",
15+
"test": "jest",
1516
"test:all": "npm run lint && npm run jest && echo 'Done.'",
1617
"test:watch": "concurrently -k -s first --names \"LINT,TEST\" -p \"[{name}]\" \"npm run lint:watch\" \"npm run jest:watch\"",
1718
"update-all": "npm install $(npm outdated | cut -d' ' -f 1 | sed '1d' | xargs -I '$' echo '$@latest' | xargs echo)"

0 commit comments

Comments
 (0)