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: on:
push: push:
@ -8,44 +8,44 @@ on:
jobs: jobs:
CodeQL-Build: CodeQL-Build:
name: CodeQL Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout Source Files
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
# We must fetch at least the immediate parents so that if this is # We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head. # a pull request then we can checkout the head.
fetch-depth: 2 fetch-depth: 2
# If this run was triggered by a pull request event, then checkout # If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit. # the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2 - run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }} 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
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # Initializes the CodeQL tools for scanning.
# If this step fails, then you should remove it and run the build manually (see below) - name: Initialize CodeQL
# - name: Autobuild uses: github/codeql-action/init@v1
# uses: github/codeql-action/autobuild@v1 # Override language selection by uncommenting this and choosing your languages
with:
languages: javascript
# Command-line programs to run using the OS shell. # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# 📚 https://git.io/JvXDl # 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 # Command-line programs to run using the OS shell.
# and modify them (or add more) to build your code if your project # 📚 https://git.io/JvXDl
# uses a compiled language
#- run: | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# make bootstrap # and modify them (or add more) to build your code if your project
# make release # uses a compiled language
- name: Perform CodeQL Analysis #- run: |
uses: github/codeql-action/analyze@v1 # 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: on:
push: push:
branches:
- master
- production-**
# This will let us work on cypress config itself
- cypress-**
pull_request: pull_request:
branches: branches:
- master - master
jobs: jobs:
cypress-run: cypress-run:
name: Cypress Tests
env: env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 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' CYPRESS_INSTALL_BINARY: '4.11.0'
name: Cypress run
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
services: services:
mongodb: mongodb:
image: mongo:3.5.5 image: mongo:3.6.19
# ports may not be necessary, try without
ports: ports:
- 27017:27017 - 27017:27017
steps: steps:
- name: Checkout - name: Checkout Source Files
uses: actions/checkout@v2 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 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 - name: Cypress run
uses: cypress-io/github-action@v1 uses: cypress-io/github-action@v1
with: with:

View File

@ -1,28 +1,51 @@
name: Lighthouse CI name: Lighthouse CI
on: on:
workflow_dispatch: push:
# Treat the below branches as special case for working on workflows
- actions-**
schedule: schedule:
# run this Action every 14 days # run this Action every 14 days
- cron: '0 * */14 * *' - cron: '0 * */14 * *'
workflow_dispatch:
jobs: jobs:
lighthouseci: lighthouseci:
name: Lighthouse CI
runs-on: ubuntu-latest 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: steps:
- uses: actions/checkout@v2 - name: Checkout Source Files
name: Checkout source files uses: actions/checkout@v2
- uses: actions/setup-node@v1
name: Setup Node - name: Use Node.js ${{ matrix.node-version }}
- name: Set environment variables uses: actions/setup-node@v1
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
with: with:
mongodb-version: 3.6 node-version: ${{ matrix.node-version }}
- name: Seed sample data
- 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 run: npm run seed
- name: Build the production website and server
- name: Build Packages
run: npm run build run: npm run build
- name: Run LightHouse CI
- name: Run Lighthouse CI
run: lhci autorun run: lhci autorun

View File

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