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を設定 #38

Merged
merged 7 commits into from
Aug 19, 2023
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
84 changes: 72 additions & 12 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,89 @@
name: frontend_build
run-name: ${{ github.actor }} is learning GitHub Actions
on: [release]
name: build
run-name: build was executed by ${{ github.actor }}

on: [push]
jobs:
changes:
runs-on: ubuntu-20.04
outputs:
is_frontend: ${{ steps.filter.outputs.is_frontend }}
is_backend: ${{ steps.filter.outputs.is_backend }}
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
frontend:
- "packages/frontend/**"
backend:
-"packages/backend/**"

build_frontend:
if: ${{ always() }} # 無条件にjobを実行
needs: changes
if: ${{ needs.changes.outputs.is_frontend == 'true' }}
runs-on: ubuntu-20.04
strategy:
matrix:
node-version: [15]
defaults:
run:
working-directory: packages/frontend
steps:
# リポジトリをチェックアウト
- uses: actions/checkout@v3

# pnpm 8をインストール
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}

# node.jsをインストール()
- name: Node.js
Percy08-dev marked this conversation as resolved.
Show resolved Hide resolved
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: packages/frontend/

# 依存関係先をインストール
- name: Install dependencies
run: pnpm install --frozen-lockfile


# lint
- name: static code analysis
run: pnpm ci/lint

# ビルドチェック(linterが在れば要らない?)
- name: build check
Percy08-dev marked this conversation as resolved.
Show resolved Hide resolved
run: pnpm build

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build checkはあるんですが、lintがないようです:eyes:
一応VSCode上でPrettierによる保存時フォーマットは有効になってはいると思うものの、
CIでもチェックしたほうがいいと思うのですがどうでしょうか?

@para7

Copy link
Collaborator

@para7 para7 Aug 16, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cotton-alta
確かに。入れるべきかもしれません

@Percy08-dev
後ほど実行コマンドお送りします

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

今日フロント課題のセッティング等の方をやってたので明日コマンド作成します…

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Percy08-dev
お待たせしました。
先ほど新しくプルリクを発行してマージしましたので、取り込んで以下の実行をお願いします!

pnpm ci/lint

# 単体テスト
- name: unit test
run: pnpm ci:test
run: pnpm ci/test

# コンポーネントカタログをビルド
- name: catalog build
run: pnpm ci:ladle
run: pnpm ci/ladle

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちら申し訳ないのですが、github pagesが無料プランだと使えないようなので、一旦コメントアウトしておいてもらえますか:bow:(カタログのデプロイ先を別issueで検討したいと思います)

合わせて以下のようにTODOコメントも追記しておいていただけるとありがたいです:pray:

# TODO: https://github.com/stlatica/stlatica/issues/39

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cotton-alta
プライベートリポジトリだから、ですよねたぶん。
ブランチ保護もそうですし、公開にして解決するなら将来的に公開予定ですしもう出しちゃってもいいのではないかという気もしてきたのですがどうなんでしょう。

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

公開にしちゃいますかー
discordの方で一応問題ないか確認してから変更させてください:pray:

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

こちら申し訳ないのですが、github pagesが無料プランだと使えないようなので、一旦コメントアウトしておいてもらえますか🙇(カタログのデプロイ先を別issueで検討したいと思います)

こちらの問題は解決したので、忘れてもらって大丈夫です

build_backend:
needs: changes
if: ${{ needs.changes.outputs.is_backend == 'true' }}
runs-on: ubuntu-20.04
defaults:
run:
working-directory: packages/backend
steps:
# リポジトリをチェックアウト
- uses: actions/checkout@v3
# setup go install
- uses: actions/setup-go@v4
with:
go-version: '1.20.6'
cache: false
# lint
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
working-directory: packages/backend
# TODO:Build
# - name: Go build check
# run: |
# go build -v ./...