Skip to content

Commit

Permalink
add more checks for PR pipeline, fix linters & errors (#14)
Browse files Browse the repository at this point in the history
* add more checks for PR pipeline, fix linters & errors
  • Loading branch information
vhargrave authored Apr 3, 2024
1 parent 8ac7780 commit b43d322
Show file tree
Hide file tree
Showing 6 changed files with 2,571 additions and 6,053 deletions.
4 changes: 4 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "Express CodeQL Config"

paths-ignore:
- node_modules
8 changes: 8 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Describe your specific features or fixes

Resolves: [MWPW-NUMBER](https://jira.corp.adobe.com/browse/MWPW-NUMBER)

Test URLs:
- Pre Migration Link: https://adobe.com/express/
- Before: https://main--express-milo--adobecom.hlx.page/express/
- After: https://<branch>--express-milo--adobecom.hlx.page/express/
66 changes: 66 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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", "stage" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main", "stage" ]
schedule:
- cron: '18 6 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

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 }}
config-file: ./.github/codeql/codeql-config.yml

# 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}}"
43 changes: 43 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Tests and Linting
on:
push:
branches: [ "main", "stage" ]
pull_request:
types: [opened, synchronize, reopened, edited]
branches: [ "main", "stage" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install XVFB
run: sudo apt-get install xvfb

- name: Install dependencies
run: npm ci

- name: Run linters
run: npm run lint

- name: Run the tests
run: xvfb-run -a npm test

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: adobecom/express-milo
files: coverage/lcov.info

1 change: 0 additions & 1 deletion express/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export const [setLibs, getLibs] = (() => {
if (branch === 'local') return 'http://localhost:6456/libs';
return branch.includes('--') ? `https://${branch}.hlx.live/libs` : `https://${branch}--milo--adobecom.hlx.live/libs`;
})();
window.express.miloLibs = libs;
return libs;
}, () => libs,
];
Expand Down
Loading

0 comments on commit b43d322

Please sign in to comment.