Skip to content

Commit

Permalink
ci: setup realtime build and pr checks
Browse files Browse the repository at this point in the history
  • Loading branch information
carlossantos74 committed Sep 13, 2024
1 parent 52bacc4 commit 6a1d697
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 21 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Run Checks

on:
pull_request:
types:
- opened
- synchronize
jobs:
delete-comments:
runs-on: ubuntu-latest
steps:
- uses: izhangzhihao/delete-comment@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
delete_user_name: SuperViz-Dev
issue_number: ${{ github.event.number }}
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
env:
NPM_CONFIG_USERCONFIG: .npmrc.ci
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create a .version.js file
run: |
touch .version.js && echo "echo \"export const version = 'test'\" > .version.js" | bash -
- name: Create a .remote-config.js file
run: |
touch .remote-config.js && echo "echo \"module.exports = { remoteConfig: { apiUrl: 'https://dev.nodeapi.superviz.com' }};\" > .remote-config.js" | bash -
- name: Run tests
run: pnpm run build
test-unit-realtime:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20]
steps:
- uses: actions/checkout@v4
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9.10.0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
env:
NPM_CONFIG_USERCONFIG: .npmrc.ci
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create a .version.js file
run: |
touch .version.js && echo "echo \"export const version = 'test'\" > .version.js" | bash -
- name: Create a .remote-config.js file
run: |
touch .remote-config.js && echo "echo \"module.exports = { remoteConfig: { apiUrl: 'https://dev.nodeapi.superviz.com' }};\" > .remote-config.js" | bash -
- name: Run tests
run: pnpm run test:unit:ci --filter=@superviz/realtime
- name: Post PR Comment
run: npx github-actions-ctrf packages/realtime/ctrf/ctrf-report.json --pr-comment
if: always()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions packages/realtime/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ dist

dist/
coverage/
ctrf/
.DS_Store
.version.js
.remote-config.js
4 changes: 4 additions & 0 deletions packages/realtime/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ module.exports = {
'^.+\\.js$': 'ts-jest',
},
setupFiles: ['<rootDir>/jest.setup.js'],
reporters: [
'default',
['jest-ctrf-json-reporter', {}],
],
};
5 changes: 3 additions & 2 deletions packages/realtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@
},
"homepage": "https://github.com/SuperViz/realtime#readme",
"devDependencies": {
"@superviz/eslint-config": "workspace:*",
"@superviz/typescript-config": "workspace:*",
"@commitlint/cli": "^19.3.0",
"@commitlint/config-conventional": "^19.2.2",
"@esm-bundle/chai": "^4.3.4-fix.0",
"@jest/globals": "^29.7.0",
"@superviz/eslint-config": "workspace:*",
"@superviz/typescript-config": "workspace:*",
"@types/debug": "^4.1.12",
"@types/jest": "^29.5.12",
"@types/node": "^20.14.8",
Expand All @@ -69,6 +69,7 @@
"eslint": "8.56.0",
"husky": "^9.0.11",
"jest": "^29.7.0",
"jest-ctrf-json-reporter": "^0.0.9",
"semantic-release": "^24.0.0",
"semantic-release-version-file": "^1.0.2",
"ts-jest": "^29.2.5",
Expand Down
29 changes: 10 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"dependsOn": ["^watch"]
},
"build": {
"cache": false,
"persistent": false,
"dependsOn": ["^build"],
"inputs": ["$TURBO_DEFAULT$", ".env*"],
"outputs": [".next/**", "!.next/cache/**"]
Expand All @@ -32,6 +34,9 @@
"dev": {
"cache": false,
"persistent": true
},
"@superviz/realtime#build": {
"dependsOn": ["@superviz/socket-client#build"]
}
}
}

0 comments on commit 6a1d697

Please sign in to comment.