Skip to content

Commit 748b51d

Browse files
committed
Add stats action
1 parent e2198e7 commit 748b51d

File tree

4 files changed

+299
-1
lines changed

4 files changed

+299
-1
lines changed

.github/workflows/test-pr.yml

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v2
1414
with:
15-
fetch-depth: 100
15+
fetch-depth: 1
1616

1717
- name: Read .nvmrc
1818
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
@@ -45,3 +45,43 @@ jobs:
4545
yarn tsc
4646
yarn eslint
4747
yarn test:ci
48+
49+
stats:
50+
if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')"
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- uses: actions/checkout@v2
55+
with:
56+
fetch-depth: 1
57+
58+
- name: Read .nvmrc
59+
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"
60+
id: nvm
61+
- name: Use Node.js
62+
uses: actions/setup-node@v1
63+
with:
64+
node-version: '${{ steps.nvm.outputs.NVMRC }}'
65+
- name: Get yarn cache directory path
66+
id: yarn-cache-dir-path
67+
run: echo "::set-output name=dir::$(yarn cache dir)"
68+
69+
- uses: actions/cache@v2
70+
id: yarn-cache
71+
with:
72+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
73+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
74+
restore-keys: |
75+
${{ runner.os }}-yarn-
76+
${{ runner.os }}-
77+
78+
- name: Install dependencies
79+
run: yarn install --frozen-lockfile
80+
81+
- name: Copy .env
82+
run: cp .env-sample .env
83+
84+
- name: Build
85+
run: yarn build
86+
env:
87+
RELATIVE_CI_KEY: ${{ secrets.RELATIVE_CI_KEY }}

next.config.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const withImages = require('next-images');
2525
const withBundleAnalyzer = require('@next/bundle-analyzer')({
2626
enabled: ANALYZE === 'true',
2727
});
28+
const { RelativeCiAgentWebpackPlugin } = require('@relative-ci/agent');
2829

2930
const config = withBundleAnalyzer(
3031
withImages(
@@ -85,6 +86,11 @@ const config = withBundleAnalyzer(
8586
}),
8687
);
8788
}
89+
90+
if (!options.dev && !options.isServer) {
91+
config.plugins.push(new RelativeCiAgentWebpackPlugin());
92+
}
93+
8894
return config;
8995
},
9096
basePath,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@
7171
"devDependencies": {
7272
"@next/bundle-analyzer": "10.0.4",
7373
"@prisma/cli": "2.14.0",
74+
"@relative-ci/agent": "1.4.0",
7475
"@swc-node/jest": "1.0.3",
7576
"@testing-library/dom": "7.29.1",
7677
"@testing-library/jest-dom": "5.11.8",

0 commit comments

Comments
 (0)