Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

CIの整備 #13

Merged
merged 15 commits into from
Apr 16, 2022
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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ next-env.d.ts
*.setup.js
storybook-static
__mocks__
lighthouserc.js
13 changes: 12 additions & 1 deletion .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,20 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 7
steps:
- name: Checkout repository
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
fetch-depth: 0
- name: Install dependencies
run: yarn install --frozen-lockfile
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: CodeQL

on:
pull_request:
branches:
- dev
- main

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language:
- javascript
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
56 changes: 56 additions & 0 deletions .github/workflows/lighthouse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: CodeQL

on:
pull_request:
branches:
- dev
- main

jobs:
run-lighthouse-ci:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: production build
run: yarn run build
- name: install Lighthouse cli
run: |
yarn add @lhci/cli@0.8.x
- name: run Lighthouse cli
id: lhci
run: |
mkdir dist
touch dist/autorun.txt
yarn lhci autorun | grep 'storage.googleapis.com' > ./dist/autorun.txt
report_url=$(cat ./dist/autorun.txt)
echo $report_url
echo "::set-output name=report_url::$report_url"
continue-on-error: true
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
- name: json to markdown
uses: shoma3571/lhci-format-action@v1.3
id: parse
with:
json-file-path: .lighthouseci/assertion-results.json
report-url: ${{ steps.lhci.outputs.report_url }}
- name: post comment
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL: ${{ github.event.pull_request.html_url }}
run: gh pr comment -F ./result-markdown.md "${URL}"
29 changes: 29 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: ESLint

on:
pull_request:
branches:
- dev

jobs:
run-eslint:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: eslint
run: yarn run lint
29 changes: 29 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Prettier

on:
pull_request:
branches:
- dev

jobs:
run-prettier:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Format the code
run: yarn run fmt
65 changes: 65 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Test

on:
pull_request:
branches:
- dev

jobs:
run-type-check:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Check codes types
run: yarn run type
run-build:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/checkout@v2
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Build the project
run: yarn run build
run-snapshot-test:
runs-on: ubuntu-latest
steps:
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/checkout@v2
- name: Install Dependencies
run: yarn install --frozen-lockfile
- name: Test snapshots
run: yarn run test
4 changes: 0 additions & 4 deletions .husky/pre-commit

This file was deleted.

5 changes: 0 additions & 5 deletions .husky/pre-push

This file was deleted.

2 changes: 0 additions & 2 deletions .lintstagedrc.yml

This file was deleted.

File renamed without changes.
2 changes: 1 addition & 1 deletion jest.setup.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import '@testing-library/jest-dom/extend-expect'
require('@testing-library/jest-dom/extend-expect')
18 changes: 18 additions & 0 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
ci: {
assert: {
assertions: {
'categories:accessibility': ['error', { minScore: 0.9 }],
'categories:best-practices': ['error', { minScore: 0.9 }],
'categories:performance': ['error', { minScore: 0.9 }],
'categories:seo': ['error', { minScore: 0.9 }]
}
},
collect: {
staticDistDir: './.next/'
},
upload: {
target: 'temporary-public-storage'
}
}
}
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
"test": "jest",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN",
"prepare": "husky install",
"postinstall": "husky install"
"chromatic": "npx chromatic --project-token=$CHROMATIC_PROJECT_TOKEN"
},
"dependencies": {
"@emotion/react": "^11.8.2",
Expand Down Expand Up @@ -77,10 +75,8 @@
"eslint": "8.13.0",
"eslint-config-re-taro": "1.1.0",
"eslint-plugin-storybook": "0.5.8",
"husky": "7.0.4",
"identity-obj-proxy": "3.0.0",
"jest": "27.5.1",
"lint-staged": "12.3.7",
"postcss": "8.4.12",
"preact-render-to-string": "5.1.21",
"prettier": "2.6.2",
Expand Down
1 change: 1 addition & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"baseBranches": ["dev"],
"extends": ["github>re-taro/renovate"]
}
Loading