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

Generating SBOM and signing docker images #423

Merged
merged 7 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "Node.js",
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bookworm",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"moby": true,
"installDockerComposeSwitch": false
}
},
"postCreateCommand": "npm ci",
"customizations": {
"vscode": {
"settings": {
"files.eol": "\n",
"files.insertFinalNewline": true,
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": false,
"typescript.enablePromptUseWorkspaceTsdk": true
},
"extensions": [
"editorconfig.editorconfig",
"dbaeumer.vscode-eslint",
"christian-kohler.npm-intellisense"
]
}
}
}
25 changes: 25 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.devcontainer
.git
.github
.husky
.nyc_output
.idea
.vscode
coverage
dist
node_modules
test
.dockerignore
.editorconfig
.eslintignore
.eslintrc.cjs
.gitignore
.mocharc.js
.nvmrc
.nycrc.json
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
default.env
Dockerfile
README.md
10 changes: 7 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
25 changes: 24 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,31 @@ updates:
ignore:
- dependency-name: "@fastify/static"
update-types: ["version-update:semver-major"]

- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "weekly"
ignore:
- dependency-name: "*"
update-types: ["version-update:semver-major"]
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
timezone: Europe/Rome
groups:
minor-actions-dependencies:
update-types:
- minor
- patch
commit-message:
include: scope
prefix: ci
- package-ecosystem: devcontainers
directory: "/"
schedule:
interval: monthly
timezone: Europe/Rome
commit-message:
include: scope
prefix: build
84 changes: 38 additions & 46 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,44 @@
name: Build

on:
workflow_call:
inputs:
node-version:
required: false
default: 20.x
type: string

jobs:
build:
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}
cache: npm

- name: Install
run: npm ic

- name: Compile file and build
run: npm run build

- name: Save Build Cache
id: save-build-cache
uses: actions/cache/save@v3
with:
path: ./dist
key: ${{ runner.os }}-${{ github.sha }}-build

- name: Test Build
run: |
export WORKING_DIR=`pwd`
export ENV_DIR=$WORKING_DIR/.env

cp $WORKING_DIR/default.env $WORKING_DIR/.env.local
mkdir -p $ENV_DIR/public

echo "PUBLIC_DIRECTORY_PATH=$ENV_DIR/public" >> $WORKING_DIR/.env.local
echo "RESOURCES_DIRECTORY_PATH=$ENV_DIR/configurations" >> $WORKING_DIR/.env.local

npm run start:local &

./scripts/wait-for-it.sh localhost:3001 --timeout=20

curl -i "http://localhost:3001/-/ready" | grep "HTTP/1.1 200 OK"
exit `echo $?`
- name: Checkout Repository
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
show-progress: false
- name: Setup Node.js
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6 # v4.0.4
with:
node-version-file: .nvmrc
check-latest: true
cache: npm
- name: Install
run: npm ci
- name: Compile file and build
run: npm run build
- name: Test Build
run: |
export WORKING_DIR=`pwd`
export ENV_DIR=$WORKING_DIR/.env

cp $WORKING_DIR/default.env $WORKING_DIR/.env.local
mkdir -p $ENV_DIR/public

echo "PUBLIC_DIRECTORY_PATH=$ENV_DIR/public" >> $WORKING_DIR/.env.local
echo "RESOURCES_DIRECTORY_PATH=$ENV_DIR/configurations" >> $WORKING_DIR/.env.local

npm run start:local &

./scripts/wait-for-it.sh localhost:3001 --timeout=20

curl -i "http://localhost:3001/-/ready" | grep "HTTP/1.1 200 OK"
exit `echo $?`
- name: Upload Build Artifacts
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: build
path: dist
if-no-files-found: error
79 changes: 17 additions & 62 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,76 +1,31 @@
# 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"

name: Code Scanning
on:
push:
branches: [ "main" ]
branches:
- main
tags:
- "*"
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
branches:
- main
paths-ignore:
- "**/*.md"
schedule:
- cron: '43 19 * * 6'
- cron: 0 5 * * 1 # Run every monday at 5 UTC

jobs:
analyze:
name: Analyze
codeql:
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' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# 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.
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
show-progress: false
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
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#, Go, 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

languages: javascript-typescript
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
uses: github/codeql-action/analyze@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
25 changes: 25 additions & 0 deletions .github/workflows/dependency-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Dependency Review
on:
pull_request:
branches:
- main
paths-ignore:
- "**/*.md"

jobs:
dependency-review:
name: Dependencies Review
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout Repository
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
show-progress: false
- name: Dependency Review
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4
with:
fail-on-scopes: runtime,unknown
comment-summary-in-pr: on-failure
Loading
Loading