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

fix(ci): gha for SDK testing #1

Merged
merged 20 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
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
26 changes: 0 additions & 26 deletions .eslintrc.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/1.bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Bug Report
description: Create a bug report for the Hypercerts protocol
labels: ['type:bug']
body:
- type: markdown
attributes:
value: If you leave out sections there is a high likelihood it will be moved to the [GitHub Discussions](https://github.com/Network-Goods/hypercerts/discussions).
- type: dropdown
attributes:
label: Which area(s) of Hypercerts are affected? (leave empty if unsure)
multiple: true
options:
- 'Smart Contracts'
- 'SDK'
- 'Frontend Dapp'
- 'Docs'
- 'The Graph integration'
- 'OpenZeppelin Defender integration'
- 'Other'
- type: textarea
attributes:
label: To Reproduce
description: Steps to reproduce the behavior, please provide a clear description of how to reproduce the issue. Screenshots can be provided in the issue body below.
validations:
required: true
- type: textarea
attributes:
label: Describe the Bug
description: A clear and concise description of what the bug is.
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: A clear and concise description of what you expected to happen.
validations:
required: true
- type: markdown
attributes:
value: Before posting the issue go through the steps you've written down to make sure the steps provided are detailed and clear. Contributors should be able to follow the steps provided in order to reproduce the bug.
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/2.feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Feature Request
description: Create a feature request
labels: 'type:featurerequest'
body:
- type: markdown
attributes:
value: Thanks for taking the time to file a feature request! Please fill out this form as completely as possible.
- type: markdown
attributes:
value: Please first verify that your feature was not already discussed on GitHub.
- type: textarea
attributes:
label: Describe the feature you'd like to request
description: A clear and concise description of what you want and what your use case is.
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
validations:
required: true
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/3.docs_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Docs Request'
description: A request to update or improve documentation
title: 'Docs: '
labels:
- 'category:docs'
body:
- type: textarea
attributes:
label: What is the improvement or update you wish to see?
description: 'Example: I would like to see more examples of how to use the SDK to detect hypercert claim collisions.'
validations:
required: true
- type: textarea
attributes:
label: Is there any context that might help us understand?
description: A clear description of any added context that might help us understand.
validations:
required: true
- type: input
attributes:
label: Does the docs page already exist? Please link to it.
description: 'Example: https://hypercerts.org/docs/api-reference/'
validations:
required: false
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/9.other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: 'Other'
description: For internal use only
body:
- type: textarea
attributes:
label: What is it?
validations:
required: true
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Ask a question
url: https://github.com/Network-Goods/hypercerts/discussions
about: Ask questions and discuss with other community members
33 changes: 33 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and release - staging

on:
pull_request:

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test
91 changes: 91 additions & 0 deletions .github/workflows/create-prerelease-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Build and release - staging

on:
push:
branches:
- main
- dev/*
- develop/*
- feat/*

jobs:
build-and-test:
name: Build and test
runs-on: ubuntu-latest
environment: test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Install dependencies
run: pnpm install

- name: Run tests
run: pnpm test

semantic-release:
needs: build-and-test
if: "!contains(github.event.head_commit.message, '[skip ci]')"

name: Semantic Release
runs-on: ubuntu-latest
environment: staging
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'

- name: Prepare prerelease semantic
if: github.ref != 'refs/heads/main'
run: mv .releaserc.prerelease.yaml .releaserc.yaml

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
with:
extra_plugins: |
@semantic-release/commit-analyzer
@semantic-release/release-notes-generator
@semantic-release/changelog
@semantic-release/github
env:
GITHUB_TOKEN: ${{ secrets.GH_PA_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Do something when a new release published
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
!.yarn/versions
**/node_modules
**/dist
docs/

# files
*.env
Expand Down
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm commitlint ${1}
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pnpm lint-staged
4 changes: 0 additions & 4 deletions .prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ trailingComma: "all"
useTabs: false

overrides:
- files: "*.sol"
options:
compiler: "0.8.17"
tabWidth: 4
- files: "*.ts"
options:
importOrder: ["<THIRD_PARTY_MODULES>", "^[./]"]
Expand Down
20 changes: 20 additions & 0 deletions .releaserc.prerelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- "@semantic-release/github"
- "@semantic-release/npm"

branches:
- "+([0-9])?(.{+([0-9]),x}).x"
- main
- name: dev/*
prerelease: "beta"
- name: develop/*
prerelease: 'beta'
- name: hotfix/*
prerelease: '${name.replace(/^hotfix\//g, "fix-").replace(/\//g, "-")}'
- name: fix/*
prerelease: '${name.replace(/^fix\//g, "fix-").replace(/\//g, "-")}'
- name: feat/init
prerelease: 'beta'
10 changes: 10 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/changelog"
- "@semantic-release/git"
- "@semantic-release/github"

branches:
- "+([0-9])?(.{+([0-9]),x}).x"
- main
1 change: 1 addition & 0 deletions commitlintrc.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export default { extends: ["@commitlint/config-conventional"] };
11 changes: 11 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";


export default [
{files: ["**/*.{js,mjs,cjs,ts}"]},
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];
Loading