Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: test against node 17, rely on pre-commit.ci, tweak workflow triggers and comments #372

Merged
merged 4 commits into from
Feb 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
# Publish NPM package and Docker image
#
name: Release

on:
pull_request:
paths-ignore:
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yml"
push:
paths-ignore:
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yml"
branches-ignore:
# don't double-build dependabot PRs
- dependabot/**
tags: ["**"]
pull_request:
- "dependabot/**"
- "pre-commit-ci-update-config"
tags:
- "**"
workflow_dispatch:

jobs:
61 changes: 25 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,35 @@
# Useful GitHub Actions docs:
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
#
# - https://help.github.com/en/actions
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions

name: Test

on:
pull_request:
paths-ignore:
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yml"
push:
paths-ignore:
- "**.md"
- ".github/workflows/*"
- "!.github/workflows/publish.yml"
branches-ignore:
# don't double-build dependabot PRs
- dependabot/**
tags: ["**"]
pull_request:
- "dependabot/**"
- "pre-commit-ci-update-config"
tags:
- "**"
workflow_dispatch:

jobs:
# Job to run linter / autoformat
lint:
# Audit dependencies for known vulnerabilities
audit-dependencies:
runs-on: ubuntu-20.04
steps:
# Action Repo: https://github.com/actions/checkout
- name: "Checkout repo"
uses: actions/checkout@v2

# Action Repo: https://github.com/actions/setup-node
- name: "Setup Node"
uses: actions/setup-node@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "14"
node-version: "16"

# Action Repo: https://github.com/actions/cache
- name: "Cache node_modules"
@@ -40,23 +40,17 @@ jobs:
restore-keys: |
${{ runner.os }}-npm-
- name: "Install"
- name: "Install dependencies (npm ci)"
run: |
npm ci
# Run the pre-commit action
# Repo: https://github.com/pre-commit/action
- uses: actions/setup-python@v2
- uses: pre-commit/[email protected]

- name: npm audit
run: |
# If this fails, run `npm audit fix`
npm audit --production --audit-level=moderate
test:
runs-on: ubuntu-20.04
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
strategy:
fail-fast: false # Do not cancel all jobs if one fails
matrix:
@@ -68,17 +62,12 @@ jobs:
- "10"
- "12"
- "14"
- "15" # Remove about when 17 is available?
- "16"
# - "17" # Add 2021-10-19, its initial release date.
- "17"

steps:
- name: "Checkout repo"
uses: actions/checkout@v2

# Action Repo: https://github.com/actions/setup-node
- name: "Setup Node"
uses: actions/setup-node@v1
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}

@@ -91,7 +80,7 @@ jobs:
restore-keys: |
${{ runner.os }}-npm-
- name: "Install dependencies"
- name: "Install dependencies (npm ci)"
run: |
npm ci
10 changes: 10 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# pre-commit is a tool to perform a predefined set of tasks manually and/or
# automatically before git commits are made.
#
# Config reference: https://pre-commit.com/#pre-commit-configyaml---top-level
#
# Common tasks
#
# - Run on all files: pre-commit run --all-files
# - Register git hooks: pre-commit install --install-hooks
#
repos:
# Autoformat: Bash scripts
- repo: https://github.com/lovesegfault/beautysh