From 6bac5c33f036b8a622629aeec7bdb879679b88d8 Mon Sep 17 00:00:00 2001 From: azurepolarbear Date: Sun, 3 Nov 2024 13:23:08 -0600 Subject: [PATCH] Add github workflows. --- .github/dependabot.yml | 62 +++++++++++++++++++++++++++++ .github/workflows/codeql.yml | 74 +++++++++++++++++++++++++++++++++++ .github/workflows/node-js.yml | 36 +++++++++++++++++ package.json | 2 +- 4 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/codeql.yml create mode 100644 .github/workflows/node-js.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..f27f9ad --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,62 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: weekly + target-branch: "development-main" + allow: + - dependency-type: "direct" + versioning-strategy: increase + commit-message: + prefix: "dependabot npm update" + include: "scope" + groups: + development-dependencies: + applies-to: version-updates + dependency-type: "development" + update-types: + - "major" + - "minor" + - "patch" + development-dependencies-security: + applies-to: security-updates + dependency-type: "development" + update-types: + - "major" + - "minor" + - "patch" + production-dependencies: + applies-to: version-updates + dependency-type: "production" + update-types: + - "major" + - "minor" + - "patch" + production-dependencies-security: + applies-to: security-updates + dependency-type: "production" + update-types: + - "major" + - "minor" + - "patch" + reviewers: + - "blwatkins" + - "azurepolarbear" + + - package-ecosystem: github-actions + directory: "/" + schedule: + interval: weekly + target-branch: "development-main" + commit-message: + prefix: "dependabot github-action update" + include: "scope" + reviewers: + - "blwatkins" + - "azurepolarbear" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..6d6f339 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,74 @@ +name: "CodeQL" + +on: + push: + branches: + - "main" + - "development-main" + pull_request: + branches: + - "main" + - "development-main" + schedule: + - cron: '0 12 * * *' + +jobs: + analyze: + name: Analyze + # Runner size impacts CodeQL analysis time. To learn more, please see: + # - https://gh.io/recommended-hardware-resources-for-running-codeql + # - https://gh.io/supported-runners-and-hardware-resources + # - https://gh.io/using-larger-runners + # Consider using larger runners for possible analysis time improvements. + runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }} + timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }} + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript-typescript' ] + # CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ] + # Use only 'java-kotlin' to analyze code written in Java, Kotlin or both + # Use only 'javascript-typescript' 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@v4 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + 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. + + # 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 + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + # ℹī¸ 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@v3 + with: + category: "/language:${{matrix.language}}" diff --git a/.github/workflows/node-js.yml b/.github/workflows/node-js.yml new file mode 100644 index 0000000..63db072 --- /dev/null +++ b/.github/workflows/node-js.yml @@ -0,0 +1,36 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs + +name: Node.js Build + +on: + push: + branches: + - "main" + - "development-main" + pull_request: + branches: + - "main" + - "development-main" + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [ 18.x, 20.x, 22.x ] + # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'npm' + - run: npm ci + - run: npm run lint + - run: npm run build + - run: npm run prod-build diff --git a/package.json b/package.json index 65b44ad..781772e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "lint": "eslint ./src", - "deploy": "webpack --mode production", + "prod-build": "webpack --mode production", "build": "webpack --mode development", "start": "webpack-dev-server --mode development", "stats": "webpack --mode development --profile --json > ./out/stats.json"