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

ci: update GitHub workflows and Code Coverage settings #955

Merged
merged 5 commits into from
Dec 6, 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
43 changes: 22 additions & 21 deletions .github/workflows/algolia-search-indexing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,31 @@ on:
workflow_dispatch:

env:
ALGOLIA_APPLICATION_ID: 7V00GBK8V8
ALGOLIA_APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
ALGOLIA_INDEX: tonic-ui-v2

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install yarn
run: npm install -g yarn
- name: Install and build
run: |
yarn up
yarn install
yarn build
- name: Algolia search indexing
env:
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
run: |
cd packages/react-docs; ../../node_modules/.bin/babel-node scripts/algolia-search-indexing.js
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch the entire Git history to access the latest tag release
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install yarn
run: npm install -g yarn
- name: Install and build
run: |
yarn up
yarn install
yarn build
- name: Algolia search indexing
env:
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
run: |
cd packages/react-docs; ../../node_modules/.bin/babel-node scripts/algolia-search-indexing.js
7 changes: 6 additions & 1 deletion .github/workflows/ci-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
push:
branches:
- v2
schedule:
# run daily
- cron: '0 0 * * *'
workflow_dispatch:

permissions:
Expand All @@ -25,7 +28,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Check installed versions
run: |
Expand Down Expand Up @@ -54,6 +57,8 @@ jobs:
yarn install

- name: Build & Test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
yarn build
yarn lint
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Check installed versions
run: |
Expand Down Expand Up @@ -58,6 +58,8 @@ jobs:
yarn install

- name: Build & Test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
yarn build
yarn lint
Expand Down Expand Up @@ -114,7 +116,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Configure environment variables
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Install packages
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/ci-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20

- name: Check installed versions
run: |
Expand Down Expand Up @@ -54,6 +54,8 @@ jobs:
yarn install

- name: Build & Test
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: |
yarn build
yarn lint
Expand Down
38 changes: 17 additions & 21 deletions .github/workflows/update-yarn-lock-file.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: Update yarn.lock file
name: Update `yarn.lock` file

on:
# run daily
schedule:
- cron: '0 0 * * *'

# allow manual trigger
workflow_dispatch:

# Ensure only one lock action can run at a time
Expand All @@ -18,19 +13,20 @@ jobs:
runs-on: ubuntu-latest
permissions:
pull-requests: write
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install yarn
run: npm install -g yarn
- name: Update yarn.lock
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
scripts/update-yarn-lock-file.sh
- name: Checkout code
uses: actions/checkout@v4
with:
# Fetch the entire Git history to access the latest tag release
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install yarn
run: npm install -g yarn
- name: Update yarn.lock
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
scripts/update-yarn-lock-file.sh
11 changes: 11 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
# https://docs.codecov.com/docs/commit-status
status:
project:
default:
target: auto
threshold: 2%
patch:
default:
target: auto
threshold: 2%
1 change: 1 addition & 0 deletions packages/changelog-github/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@babel/eslint-plugin": "^7.0.0",
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@codecov/rollup-plugin": "^1.5.1",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@trendmicro/babel-config": "^1.0.2",
Expand Down
19 changes: 17 additions & 2 deletions packages/changelog-github/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';

const pkg = createRequire(import.meta.url)('./package.json');
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -27,6 +30,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
},
{
Expand All @@ -40,6 +49,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
}
];
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fs from 'fs';
import path from 'path';
import fs from 'node:fs';
import path from 'node:path';
import jscodeshift from 'jscodeshift';
import transform from '@tonic-ui/codemod/src/react/v2.0.0/import-react-icons';

Expand Down
1 change: 1 addition & 0 deletions packages/react-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@codecov/rollup-plugin": "^1.5.1",
"@emotion/babel-plugin": "^11.10.0",
"@emotion/jest": "^11.10.0",
"@rollup/plugin-babel": "^6.0.0",
Expand Down
19 changes: 17 additions & 2 deletions packages/react-base/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';

const pkg = createRequire(import.meta.url)('./package.json');
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -26,6 +29,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
},
{
Expand All @@ -39,6 +48,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
}
];
1 change: 1 addition & 0 deletions packages/react-hooks/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@babel/plugin-transform-runtime": "^7.0.0",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@codecov/rollup-plugin": "^1.5.1",
"@rollup/plugin-babel": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.0",
"@testing-library/jest-dom": "^6.0.0",
Expand Down
19 changes: 17 additions & 2 deletions packages/react-hooks/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';

const pkg = createRequire(import.meta.url)('./package.json');
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -27,6 +30,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
},
{
Expand All @@ -40,6 +49,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
}
];
1 change: 1 addition & 0 deletions packages/react-icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"@babel/plugin-transform-runtime": "^7.24.0",
"@babel/preset-env": "^7.24.0",
"@babel/preset-react": "^7.23.3",
"@codecov/rollup-plugin": "^1.5.1",
"@emotion/babel-plugin": "^11.11.0",
"@emotion/react": "11.x",
"@trendmicro/babel-config": "^1.0.2",
Expand Down
19 changes: 17 additions & 2 deletions packages/react-icons/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import path from 'path';
import { fileURLToPath } from 'url';
import { createRequire } from 'node:module';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { codecovRollupPlugin } from '@codecov/rollup-plugin';
import { babel } from '@rollup/plugin-babel';
import { nodeResolve } from '@rollup/plugin-node-resolve';

const pkg = createRequire(import.meta.url)('./package.json');
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

Expand All @@ -26,6 +29,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
},
{
Expand All @@ -39,6 +48,12 @@ export default [
plugins: [
nodeResolve(),
babel({ babelHelpers: 'bundled' }),
// Put the Codecov rollup plugin after all other plugins
codecovRollupPlugin({
enableBundleAnalysis: process.env.CODECOV_TOKEN !== undefined,
bundleName: pkg.name,
uploadToken: process.env.CODECOV_TOKEN,
}),
],
}
];
Loading
Loading