Skip to content

Commit e02b4dd

Browse files
authoredSep 14, 2021
chore(ci): Use GitHub Actions, Dependabot (#10)
1 parent 9894c1d commit e02b4dd

6 files changed

+151
-8
lines changed
 

‎.github/dependabot.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
versioning-strategy: increase
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily

‎.github/workflows/codeql-analysis.yml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: "Code scanning - action"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
# The branches below must be a subset of the branches above
8+
branches: [master]
9+
schedule:
10+
- cron: "0 7 * * 0"
11+
12+
jobs:
13+
CodeQL-Build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v2
19+
with:
20+
# We must fetch at least the immediate parents so that if this is
21+
# a pull request then we can checkout the head.
22+
fetch-depth: 2
23+
24+
# If this run was triggered by a pull request event, then checkout
25+
# the head of the pull request instead of the merge commit.
26+
- run: git checkout HEAD^2
27+
if: ${{ github.event_name == 'pull_request' }}
28+
29+
# Initializes the CodeQL tools for scanning.
30+
- name: Initialize CodeQL
31+
uses: github/codeql-action/init@v1
32+
# Override language selection by uncommenting this and choosing your languages
33+
# with:
34+
# languages: go, javascript, csharp, python, cpp, java
35+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
36+
# If this step fails, then you should remove it and run the build manually (see below)
37+
- name: Autobuild
38+
uses: github/codeql-action/autobuild@v1
39+
40+
# ℹ️ Command-line programs to run using the OS shell.
41+
# 📚 https://git.io/JvXDl
42+
43+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
44+
# and modify them (or add more) to build your code if your project
45+
# uses a compiled language
46+
47+
#- run: |
48+
# make bootstrap
49+
# make release
50+
51+
- name: Perform CodeQL Analysis
52+
uses: github/codeql-action/analyze@v1
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Based on https://docs.github.com/en/code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions#enable-auto-merge-on-a-pull-request
2+
name: Dependabot auto-merge
3+
on: pull_request_target
4+
5+
permissions:
6+
pull-requests: write
7+
contents: write
8+
9+
jobs:
10+
dependabot:
11+
runs-on: ubuntu-latest
12+
if: ${{ github.actor == 'dependabot[bot]' }}
13+
steps:
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/fetch-metadata@v1.1.1
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
- name: Enable auto-merge for Dependabot PRs
20+
# Automatically merge semver-patch and semver-minor PRs
21+
if: "${{ steps.metadata.outputs.update-type ==
22+
'version-update:semver-minor' ||
23+
steps.metadata.outputs.update-type ==
24+
'version-update:semver-patch' }}"
25+
run: gh pr merge --auto --squash "$PR_URL"
26+
env:
27+
PR_URL: ${{github.event.pull_request.html_url}}
28+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

‎.github/workflows/nodejs-test.yml

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Node.js CI
2+
3+
on: [push, pull_request]
4+
5+
env:
6+
CI: true
7+
FORCE_COLOR: 2
8+
NODE_COV: 16 # The Node.js version to run coveralls on
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: actions/setup-node@v2
16+
with:
17+
node-version: 16
18+
cache: npm
19+
- run: npm ci
20+
- run: npm run lint
21+
22+
test:
23+
name: Node ${{ matrix.node }}
24+
runs-on: ubuntu-latest
25+
26+
strategy:
27+
fail-fast: false
28+
matrix:
29+
node:
30+
- 10
31+
- 12
32+
- 14
33+
- 16
34+
35+
steps:
36+
- uses: actions/checkout@v2
37+
- name: Use Node.js ${{ matrix.node }}
38+
uses: actions/setup-node@v2
39+
with:
40+
node-version: ${{ matrix.node }}
41+
cache: npm
42+
- run: npm ci
43+
- run: npm run build --if-present
44+
45+
- name: Run Jest
46+
run: npm run test:jest
47+
if: matrix.node != env.NODE_COV
48+
49+
- name: Run Jest with coverage
50+
run: npm run test:jest -- --coverage
51+
if: matrix.node == env.NODE_COV
52+
53+
- name: Run Coveralls
54+
uses: coverallsapp/github-action@master
55+
if: matrix.node == env.NODE_COV
56+
with:
57+
github-token: "${{ secrets.GITHUB_TOKEN }}"

‎.travis.yml

-6
This file was deleted.

‎package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"lib/**/*"
1818
],
1919
"scripts": {
20-
"test": "jest --coverage && npm run lint",
21-
"coverage": "cat coverage/lcov.info | coveralls",
20+
"test": "npm run test:jest && npm run lint",
21+
"test:jest": "jest",
2222
"lint": "npm run lint:es && npm run lint:prettier",
2323
"lint:es": "eslint .",
2424
"lint:prettier": "npm run prettier -- --check",

0 commit comments

Comments
 (0)
Please sign in to comment.