Skip to content

Commit

Permalink
feat: automation
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Selman <[email protected]>
  • Loading branch information
dselman committed Dec 12, 2023
1 parent deb2cb2 commit 5d86143
Show file tree
Hide file tree
Showing 8 changed files with 341 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @accordproject/maintainers-concerto
30 changes: 30 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!--- Provide a formatted commit message describing this PR in the Title above -->
<!--- See our DEVELOPERS guide below: -->
<!--- https://github.com/accordproject/techdocs/blob/master/DEVELOPERS.md#commit-message-format -->
# Closes #<CORRESPONDING ISSUE NUMBER>
<!--- Provide an overall summary of the pull request -->

### Changes
<!--- More detailed and granular description of changes -->
<!--- These should likely be gathered from commit message summaries -->
- <ONE>
- <TWO>

### Flags
<!--- Provide context or concerns a reviewer should be aware of -->
- <ONE>
- <TWO>

### Screenshots or Video
<!--- Provide an easily accessible demonstration of the changes, if applicable -->

### Related Issues
- Issue #<NUMBER>
- Pull Request #<NUMBER>

### Author Checklist
- [ ] Ensure you provide a [DCO sign-off](https://github.com/probot/dco#how-it-works) for your commits using the `--signoff` option of git commit.
- [ ] Vital features and changes captured in unit and/or integration tests
- [ ] Commits messages follow [AP format](https://github.com/accordproject/techdocs/blob/master/DEVELOPERS.md#commit-message-format)
- [ ] Extend the documentation, if necessary
- [ ] Merging to `main` from `fork:branchname`
43 changes: 43 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: Bug Report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

<!--- Provide a general summary of the issue in the Title above -->
# Bug Report 🐛
<!--- Provide an expanded summary of the issue -->

## Expected Behavior
<!--- Tell us what should happen -->

## Current Behavior
<!--- Tell us what happens instead of the expected behavior -->

## Possible Solution
<!--- Not obligatory, but suggest a fix/reason for the bug, -->

## Steps to Reproduce
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context (Environment)
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->
### Desktop
- OS: [e.g. macOS]
- Browser: [e.g. Chrome, Safari]
- Version: [e.g. 0.22.15]

## Detailed Description
<!--- Provide a detailed description of the change or addition you are proposing -->

## Possible Implementation
<!--- Not obligatory, but suggest an idea for implementing addition or change -->
18 changes: 18 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/custom-issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: Custom Issue
about: For miscellaneous, such as questions, discussions, etc.
title: ''
labels: ''
assignees: ''

---

<!--- Provide a general summary of the issue in the Title above -->
# Discussion 🗣
<!--- Provide an expanded summary of the issue -->

## Context
<!--- Providing context helps us come to the discussion informed -->

## Detailed Description
<!--- Provide any further details -->
25 changes: 25 additions & 0 deletions .github/workflows/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Feature Request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

<!--- Provide a general summary of the feature in the Title above -->
# Feature Request 🛍️
<!--- Provide an expanded summary of the feature -->

## Use Case
<!--- Tell us what feature we should support and what should happen -->

## Possible Solution
<!--- Not obligatory, but suggest an implementation -->

## Context
<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Detailed Description
<!--- Provide a detailed description of the change or addition you are proposing -->
97 changes: 97 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Build

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: Unit Tests

strategy:
matrix:
node-version:
- 18.x
os:
- ubuntu-latest
- windows-latest
- macOS-latest

runs-on: ${{ matrix.os }}

steps:
- name: git checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- run: npm ci
- run: npm run build --if-present
- run: npm test

- name: Calculate code coverage
run: npm run coverage

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
flag-name: ${{ matrix.os }}
parallel: true

notify:
needs:
- build

name: Code Coverage
if: ${{ success() }}
runs-on: ubuntu-latest

steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true

publish:
needs:
- build
- notify

name: Publish to npm
if: ${{ success() && github.event_name == 'push' && github.repository_owner == 'accordproject' }}
runs-on: ubuntu-latest

outputs:
job-status: ${{ job.status }}

steps:
- name: git checkout
uses: actions/checkout@v2

- name: Use Node.js 18.x
uses: actions/setup-node@v1
with:
node-version: 18.x

- run: npm ci
- run: npm run build --if-present

- name: timestamp
id: timestamp
run: |
node ./scripts/timestamp.js
- name: build and publish
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm version --no-git-tag-version --yes --exact ${{ steps.timestamp.outputs.stamp }}
npm publish --access public --tag=unstable 2>&1
74 changes: 74 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '34 1 * * 1'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# 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@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
53 changes: 53 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Publish

on:
release:
types:
- published

jobs:
publish:
name: Publish to npm
if: ${{ github.repository_owner == 'accordproject' }}
runs-on: ubuntu-latest

steps:
- name: git checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: 18.x

- run: npm ci
- run: npm run build --if-present

- name: tag
id: tag
run: |
node ./scripts/tag.js ${{ github.event.release.tag_name }}
- name: build and publish
run: |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm version --no-git-tag-version --yes --exact ${{ github.event.release.tag_name }}
npm publish --access public ${{ steps.tag.outputs.tag }} 2>&1
- name: Create PR to increment version
uses: peter-evans/create-pull-request@v3
with:
base: main
commit-message: 'chore(actions): publish ${{ github.event.release.tag_name }} to npm'
committer: GitHub <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
signoff: true
branch: ap-publish-${{ github.event.release.tag_name }}
delete-branch: true
title: 'chore(actions): publish ${{ github.event.release.tag_name }} to npm'
body: |
# Increment Versions
Update the package.json version numbers after publishing to NPM.
assignees: ${{ github.actor }}
reviewers: ${{ github.actor }}
draft: false

0 comments on commit 5d86143

Please sign in to comment.