Skip to content

Commit

Permalink
ci: update pipelines
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiola committed Oct 25, 2024
1 parent d3056d4 commit dd4084d
Show file tree
Hide file tree
Showing 10 changed files with 288 additions and 336 deletions.
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

0 comments on commit dd4084d

Please sign in to comment.