fix(tools): misc. updates to action workflows

This commit is contained in:
Mrugesh Mohapatra
2020-08-08 23:39:03 +05:30
parent 5c60070cc5
commit e242852bef
4 changed files with 99 additions and 70 deletions

View File

@ -1,4 +1,4 @@
name: "Code scanning - action"
name: "CodeQL Scanning"
on:
push:
@ -8,44 +8,44 @@ on:
jobs:
CodeQL-Build:
name: CodeQL Build
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Checkout Source Files
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript
# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}
# 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@v1
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# 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@v1
# If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
#- run: |
# make bootstrap
# make release
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,36 +1,45 @@
name: Cypress tests
name: Cypress Tests
on:
push:
branches:
- master
- production-**
# This will let us work on cypress config itself
- cypress-**
pull_request:
branches:
- master
jobs:
cypress-run:
name: Cypress Tests
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# our .npmrc sets a default version to 0, and prevents download. This installs it.
# We use .npmrc to set the default version to 0, and prevents download during developement.
# This installs it specifically in the CI runs.
CYPRESS_INSTALL_BINARY: '4.11.0'
name: Cypress run
runs-on: ubuntu-18.04
services:
mongodb:
image: mongo:3.5.5
# ports may not be necessary, try without
image: mongo:3.6.19
ports:
- 27017:27017
steps:
- name: Checkout
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Set up environment
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set Environment variables
run: cp sample.env .env
- name: Install Dependencies
run: |
npm ci
npm run ensure-env
- name: Seed Database
run: npm run seed
- name: Cypress run
uses: cypress-io/github-action@v1
with:

View File

@ -1,28 +1,51 @@
name: Lighthouse CI
on:
workflow_dispatch:
push:
# Treat the below branches as special case for working on workflows
- actions-**
schedule:
# run this Action every 14 days
- cron: '0 * */14 * *'
workflow_dispatch:
jobs:
lighthouseci:
name: Lighthouse CI
runs-on: ubuntu-latest
runs-on: ubuntu-18.04
services:
mongodb:
image: mongo:3.6.19
ports:
- 27017:27017
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
name: Checkout source files
- uses: actions/setup-node@v1
name: Setup Node
- name: Set environment variables
run: cp sample.env .env
- name: Install all the dependencies
run: npm install && npm install -g @lhci/cli@0.4.x && cd client && npm install && cd ../
- name: Start MongoDB
uses: supercharge/mongodb-github-action@1.3.0
- name: Checkout Source Files
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
mongodb-version: 3.6
- name: Seed sample data
node-version: ${{ matrix.node-version }}
- name: Set Environment variables
run: cp sample.env .env
- name: Install Dependencies
run: |
npm install -g @lhci/cli@0.4
npm ci
npm run ensure-env
- name: Seed Database
run: npm run seed
- name: Build the production website and server
- name: Build Packages
run: npm run build
- name: Run LightHouse CI
- name: Run Lighthouse CI
run: lhci autorun

View File

@ -1,9 +1,6 @@
name: Node.js CI
push:
branches:
- master
- production-**
on:
push:
pull_request:
branches:
- master
@ -26,14 +23,17 @@ jobs:
with:
node-version: ${{ matrix.node-version }}
- name: Set Environment variables
run: cp sample.env .env
- name: Lint Source Files
run: |
npm ci
npm run ensure-env --if-present
npm run lint --if-present
build:
name: Check Builds and Run Integration Tests
test:
name: Test
needs: lint
runs-on: ubuntu-latest
@ -58,8 +58,5 @@ jobs:
npm ci
npm run ensure-env --if-present
- name: Build Packages
run: npm run build --if-present
- name: Run Tests
run: npm test