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

[feat] add ci workflow triggered by pr #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"overrides": [
{
"env": {
"node": true
},
"files": [
".eslintrc.{js,cjs}"
],
"parserOptions": {
"sourceType": "script"
}
}
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
}
}
44 changes: 44 additions & 0 deletions .github/workflows/on_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: CI workflow on PR

on:
pull_request:
branches:
- master
- main

jobs:

print_timestamp:
runs-on: ubuntu-latest
steps:
- name: Generate timestamp
run: |
echo "TIMESTAMP=$(TZ='America/Los_Angeles' date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV

- name: Print timestamp
run: |
echo "Execution time (Pacific Time Zone) $TIMESTAMP"

lint_and_test:
runs-on: ubuntu-latest
needs: print_timestamp
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1


- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '20'

- name: Install dependencies
run: npm install

# Temporarily allow the workflow to continue even if linting fails
- name: Lint
run: npm run lint || echo "Linting errors ignored temporarily"

- name: Test
run: npm test

9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.js",
"scripts": {
"test": "mocha -r ts-node/register -r mocha-steps './test/**/**/*.test.ts' --timeout 240000 --reporter mochawesome || true",
"open:report": "open mochawesome-report/mochawesome.html"
"open:report": "open mochawesome-report/mochawesome.html",
"lint": "eslint . --ext .ts,.tsx"
},
"engines": {
"node": "20.0.0"
Expand All @@ -25,9 +26,11 @@
"@types/mocha-steps": "^1.3.3",
"@types/node": "^20.8.2",
"@types/sinon": "^10.0.18",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"chai": "^4.3.10",
"chai-as-promised": "^7.1.1",
"eslint": "^8.50.0",
"eslint": "^8.57.0",
"mocha": "^10.2.0",
"mocha-steps": "^1.3.0",
"mochawesome": "^7.1.3",
Expand All @@ -42,4 +45,4 @@
"url": "https://github.com/storyprotocol/sdk-e2e-tests/issues"
},
"homepage": "https://github.com/storyprotocol/sdk-e2e-tests#readme"
}
}
Loading