Skip to content

Commit

Permalink
chore: use pnpm in github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fsubal committed Mar 28, 2023
1 parent 789c822 commit 77f3e41
Show file tree
Hide file tree
Showing 12 changed files with 1,322 additions and 2,328 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/docs-hosting-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,24 @@ jobs:
# url: TODO: Edit after

steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm
# charcoal packages
- run: yarn install --immutable
- run: yarn build
- run: pnpm install --frozen-lockfile
- run: pnpm build
# docs
- run: yarn add ../packages/react
- run: pnpm add ../packages/react
working-directory: ./docs
- run: yarn install
- run: pnpm install
working-directory: ./docs
- run: yarn build
- run: pnpm build
working-directory: ./docs

- id: auth
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/docs-hosting-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,24 @@ jobs:
url: ${{ steps.preview_deploy.outputs.details_url }}

steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- name: Get pnpm cache directory path
id: pnpm-cache-dir-path
run: echo "dir=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm
# charcoal packages
- run: yarn install --immutable
- run: yarn build
- run: pnpm install --frozen-lockfile
- run: pnpm build
# docs
- run: yarn add ../packages/react
- run: pnpm add ../packages/react
working-directory: ./docs
- run: yarn install
- run: pnpm install
working-directory: ./docs
- run: yarn build
- run: pnpm build
working-directory: ./docs

- id: auth
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- name: Prepare deps
run: |
yarn install --immutable --inline-builds
yarn build
pnpm install --frozen-lockfile
pnpm build
- name: Output files
run: |
yarn build-storybook -o public-pages --quiet
pnpm build-storybook -o public-pages --quiet
cp .storybook/badge.svg public-pages/storybook-badge.svg
mv pages public-pages/docs
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/icons.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,24 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- name: Prepare deps
run: |
yarn install --immutable --inline-builds
yarn workspaces foreach -vptR --from @charcoal-ui/icons-cli run build
pnpm install --immutable --inline-builds
pnpm run build --recursive --resume-from @charcoal-ui/icons-cli
- name: Export
env:
FIGMA_FILE_URL: ${{ secrets.FIGMA_FILE_URL }}
FIGMA_TOKEN: ${{ secrets.FIGMA_TOKEN }}
run: yarn icons-cli figma:export
run: pnpm icons-cli figma:export

- name: Optimize
run: yarn icons-cli svg:optimize --ignoreFile ./misc/icons-cli-denylist
run: pnpm icons-cli svg:optimize --ignoreFile ./misc/icons-cli-denylist

- name: Generate source
run: yarn icons-cli files:generate
run: pnpm icons-cli files:generate

- name: Generate github token
id: generate_token
Expand All @@ -50,4 +50,4 @@ jobs:
GITHUB_REPO_OWNER: pixiv
GITHUB_REPO_NAME: charcoal
GITHUB_DEFAULT_BRANCH: main
run: yarn icons-cli github:pr
run: pnpm icons-cli github:pr
48 changes: 24 additions & 24 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn build
- run: pnpm install --immutable --inline-builds
- run: pnpm build

build-storybook:
runs-on: ubuntu-latest
Expand All @@ -29,11 +29,11 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn build
- run: yarn build-storybook
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm build-storybook

build-storybook-vite:
runs-on: ubuntu-latest
Expand All @@ -43,11 +43,11 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn build
- run: yarn build-storybook
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm build-storybook
env:
NODE_OPTIONS: --max_old_space_size=6144
USE_VITE: '1'
Expand All @@ -59,10 +59,10 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn test
- run: pnpm install --frozen-lockfile
- run: pnpm test

lint:
runs-on: ubuntu-latest
Expand All @@ -71,10 +71,10 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn lint
- run: pnpm install --frozen-lockfile
- run: pnpm lint

typecheck:
runs-on: ubuntu-latest
Expand All @@ -83,11 +83,11 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn build
- run: yarn typecheck
- run: pnpm install --frozen-lockfile
- run: pnpm build
- run: pnpm typecheck

typecheck-config:
runs-on: ubuntu-latest
Expand All @@ -96,7 +96,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- run: yarn install --immutable --inline-builds
- run: yarn typecheck:config
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck:config
10 changes: 5 additions & 5 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version-file: '.node-version'
cache: yarn
cache: pnpm

- name: Prepare deps
run: |
yarn install --immutable --inline-builds
yarn build
pnpm install --frozen-lockfile
pnpm build
- name: Get comment body
id: get-comment-body
run: |
yarn lerna version --conventional-commits --no-changelog --no-git-tag-version --no-push --yes > body.txt
pnpm lerna version --conventional-commits --no-changelog --no-git-tag-version --no-push --yes > body.txt
body=$(cat body.txt)
body="${body//'%'/'%25'}"
Expand All @@ -45,7 +45,7 @@ jobs:
This pull request will bump these packages as follows
(Created by https://github.com/peter-evans/create-or-update-comment )
`yarn lerna version --conventional-commits --no-changelog --no-git-tag-version --no-push --yes`
`pnpm lerna version --conventional-commits --no-changelog --no-git-tag-version --no-push --yes`
```
${{ steps.get-comment-body.outputs.body }}
Expand Down
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
return config
},
// 実験的にviteをpreviewビルドでviteを利用する
// CLIENT_PORT=443 yarn storybook:experimental-vite -p 6007 --no-manager-cache
// CLIENT_PORT=443 pnpm storybook:experimental-vite -p 6007 --no-manager-cache
...(process.env.USE_VITE === '1'
? {
core: {
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,27 @@ See our [documentation](https://pixiv.github.io/charcoal/docs), or README of eac

### Setup

Requires `yarn` and `nodenv`.
Requires `pnpm` and `nodenv`.

```sh
nodenv install `cat .node-version`
yarn install
pnpm install
```

### Development

Start the development server on http://localhost:6006

```
yarn build
yarn storybook
pnpm build
pnpm storybook
```

If you want to start development for documentation site, run the following command and go to http://localhost:5000

```
yarn website
cd docs
pnpm start
```

### Commit
Expand Down
2 changes: 1 addition & 1 deletion jest.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const rootConfig = {
passWithNoTests: true,
}

// strictの場合は事前に`yarn build`が必要
// strictの場合は事前に`build`が必要
export const config = () =>
process.env.USE_STRICT === '1' ? strictConfig() : defaultConfig()

Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"npmClient": "yarn",
"npmClient": "pnpm",
"useWorkspaces": true,
"changelogPreset": {
"name": "conventionalcommits",
Expand Down
10 changes: 5 additions & 5 deletions misc/postpublish.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ cd $(dirname $0)/..
default_branch=`git remote show origin | grep 'HEAD branch' | awk '{print $NF}'`

if [[ $default_branch = `git symbolic-ref --short HEAD` ]]; then
yarn install
pnpm install

if [[ `git status --porcelain | grep yarn.lock` ]]; then
git add yarn.lock
git commit -m "chore: yarn install after publish"
if [[ `git status --porcelain | grep pnpm-*.lock` ]]; then
git add pnpm-*.yaml
git commit -m "chore: pnpm install after publish"
git push origin $default_branch
else
echo 'No diff found after yarn install'
echo 'No diff found after pnpm install'
fi

git push origin --tags
Expand Down
Loading

0 comments on commit 77f3e41

Please sign in to comment.