Skip to content

Commit

Permalink
Add CI workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
myrotvorets-team committed Dec 22, 2024
1 parent f6e8eb0 commit ad93efa
Show file tree
Hide file tree
Showing 11 changed files with 396 additions and 6 deletions.
6 changes: 0 additions & 6 deletions .editorconfig

This file was deleted.

6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"local>myrotvorets/.github:renovate-config"
]
}
47 changes: 47 additions & 0 deletions .github/workflows/audit-signatures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Audit Signatures

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
audit:
name: Verify Signatures and Provenance Statements
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
registry.npmjs.org:443
tuf-repo-cdn.sigstore.dev:443
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Setup Node.js environment
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: lts/*

- name: Install latest npm
run: npm install -g npm@latest

- name: Install dependencies
run: npm ci

- name: Run audit
run: npm audit signatures
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: Build and Test

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build and test (Node ${{ matrix.node.name }})
runs-on: ubuntu-latest
strategy:
matrix:
node:
- { name: Current, version: current }
- { name: LTS, version: lts/* }
- { name: Previous LTS, version: lts/-1 }
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
registry.npmjs.org:443
- name: Build and test
uses: myrotvorets/composite-actions/build-test-nodejs@27ab3af18ca12ee3e44e50e015ee74acd199d0dc
with:
node-version: ${{ matrix.node.version }}
54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CodeQL Analysis

on:
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: '4 5 * * 3'
workflow_dispatch:

permissions:
contents: read

jobs:
analyze:
name: Static Code Analysis with CodeQL
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language:
- javascript
permissions:
actions: read
contents: read
security-events: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
uploads.github.com:443
objects.githubusercontent.com:443
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Initialize CodeQL
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
languages: ${{ matrix.language }}
queries: +security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
category: "/language:${{ matrix.language }}"
34 changes: 34 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Dependency Review

on:
pull_request:

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
name: Review Dependencies
permissions:
contents: read
pull-requests: write
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.deps.dev:443
api.github.com:443
api.securityscorecards.dev:443
github.com:443
- name: Check out the source code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

- name: Review dependencies
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
with:
comment-summary-in-pr: true
35 changes: 35 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Linting

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
lint:
name: ESLint Check
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
registry.npmjs.org:443
- name: Run code style check
uses: myrotvorets/composite-actions/node-run-script@27ab3af18ca12ee3e44e50e015ee74acd199d0dc
with:
script: lint
86 changes: 86 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Publish Package

on:
release:
types:
- released
workflow_dispatch:
inputs:
npm:
default: "yes"
description: Publish to NPM?
required: true
gpr:
default: "yes"
description: Publish to GPR?
required: true

permissions:
contents: read

jobs:
prepare:
name: Prepare source code
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event_name == 'release' || github.event.inputs.npm == 'yes' || github.event.inputs.gpr == 'yes'
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
registry.npmjs.org:443
- name: Prepare source
uses: myrotvorets/composite-actions/node-prepublish@27ab3af18ca12ee3e44e50e015ee74acd199d0dc

publish:
name: Publish package (${{ matrix.registry }})
runs-on: ubuntu-latest
needs: prepare
permissions:
contents: read
packages: write
statuses: write
id-token: write
strategy:
matrix:
registry:
- npm
- gpr
include:
- registry: npm
secret: NPM_TOKEN
registry_url: https://registry.npmjs.org/
- registry: gpr
secret: GITHUB_TOKEN
registry_url: https://npm.pkg.github.com/
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
egress-policy: block
allowed-endpoints: >
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
fulcio.sigstore.dev:443
registry.npmjs.org:443
rekor.sigstore.dev:443
npm.pkg.github.com:443
- name: Publish package
uses: myrotvorets/composite-actions/node-publish@27ab3af18ca12ee3e44e50e015ee74acd199d0dc
with:
node-auth-token: ${{ secrets[matrix.secret] }}
registry-url: ${{ matrix.registry_url }}
if: github.event.inputs[matrix.registry] == 'yes' || github.event_name == 'release'
33 changes: 33 additions & 0 deletions .github/workflows/package-audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Package Audit

on:
push:
branches:
- '**'
paths:
- package.json
- package-lock.json
- .github/workflows/package-audit.yml
workflow_dispatch:

permissions:
contents: read

jobs:
audit-npm:
name: NPM Audit
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
disable-sudo: true
allowed-endpoints:
api.github.com:443
github.com:443
objects.githubusercontent.com:443
nodejs.org:443
registry.npmjs.org:443

- name: Audit with NPM
uses: myrotvorets/composite-actions/node-package-audit@27ab3af18ca12ee3e44e50e015ee74acd199d0dc
Loading

0 comments on commit ad93efa

Please sign in to comment.