Skip to content

Commit

Permalink
Merge pull request #7 from altive/add-melos-command-and-actions
Browse files Browse the repository at this point in the history
ci/cd: Add melos command and actions
  • Loading branch information
naipaka authored Oct 6, 2023
2 parents a5a87dd + 3321bad commit f2e7211
Show file tree
Hide file tree
Showing 13 changed files with 327 additions and 52 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @riscait @naipaka
20 changes: 20 additions & 0 deletions .github/actions/setup_flutter/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Setup Flutter
description: "Setup Flutter"
outputs:
flutter-path:
description: "Flutter SDK path"
value: ${{ steps.install-flutter.outputs.CACHE-PATH }}
runs:
using: "composite"
steps:
- name: Parse Flutter version
id: fvm-config
uses: kuhnroyal/flutter-fvm-config-action@v1

- name: Install Flutter
id: install-flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config.outputs.FLUTTER_CHANNEL }}
cache: true
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
5 changes: 5 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
documentation:
- "**/*.md"

test:
- "**/test/**/*"
28 changes: 28 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## 🔗 Issue Link

closes #0

## 🙌 What I did

<!-- What did you do in this pull request? -->

## ✍️ What I didn't do

<!-- What didn't you address in this pull request? If none, you can write "None". -->

## ✅ Verification

<!-- Build and launch verification + any necessary operational checks -->

- [ ] Android
- [ ] iOS
- [ ] macOS
- [ ] Web

## Screenshots

<!-- If there are UI changes, attach Before and After screenshots or videos -->

## Additional Information

<!-- Any reference information for the reviewer (such as concerns or notes about the implementation) -->
11 changes: 11 additions & 0 deletions .github/workflows/assign-author-to-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Assign author to Pull request
on:
pull_request:
types: [opened]
jobs:
assignAuthor:
name: Assign author to PR
runs-on: ubuntu-latest
steps:
- name: Assign author to PR
uses: technote-space/assign-author@v1
91 changes: 91 additions & 0 deletions .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: code check

on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
check:
runs-on: ubuntu-latest
outputs:
flutter: ${{ steps.filter.outputs.flutter }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Filter by paths
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
flutter:
- '**/android/**'
- '**/assets/**'
- '**/dart_defines/**'
- '**/golden_test/**'
- '**/ios/**'
- '**/lib/**'
- '**/test/**'
- '**/web/**'
- '**/analysis_options.yaml'
- '**/melos.yaml'
- '**/pubspec.yaml'
- 'fvm_config.json'
analyze:
needs: check
if: ${{ needs.check.outputs.flutter == 'true' && github.event_name != 'push' }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
id: setup-flutter
uses: ./.github/actions/setup_flutter

- name: Prepare Melos
run: echo "MELOS_SDK_PATH=${{ steps.setup-flutter.outputs.flutter-path }}" >> "$GITHUB_ENV"

- name: Install Melos
uses: bluefireteam/melos-action@v2

- name: Analyze packages
run: melos run analyze --no-select

- name: Check for the existence of unformatted files
run: melos run format:ci --no-select

test:
needs: check
if: needs.check.outputs.flutter == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Flutter
id: setup-flutter
uses: ./.github/actions/setup_flutter

- name: Prepare Melos
run: echo "MELOS_SDK_PATH=${{ steps.setup-flutter.outputs.flutter-path }}" >> "$GITHUB_ENV"

- name: Install Melos
uses: bluefireteam/melos-action@v2

- name: Run package tests
run: melos run test:ci --no-select

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
26 changes: 26 additions & 0 deletions .github/workflows/lint-github-actions-workflows.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint GitHub Actions workflows
on:
push:
branches: [main]
paths: ['.github/workflows/**']
pull_request:
types: [opened, synchronize, reopened]
paths: ['.github/workflows/**']
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
actionlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download actionlint
id: get_actionlint
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
shell: bash
- name: Check workflow files
run: ${{ steps.get_actionlint.outputs.executable }} -color
shell: bash
16 changes: 16 additions & 0 deletions .github/workflows/pull-request-labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Pull Request Labeler"
on:
- pull_request_target

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
sync-labels: true
94 changes: 47 additions & 47 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Dart Recommended Settings: https://dartcode.org/docs/recommended-settings/
{
// スペルチェックから除外する単語をまとめたテキストファイルを指定する
// Specify a text file that compiles words to be excluded from spell check.
"cSpell.customDictionaries": {
"app-words": {
"name": "app-words",
Expand All @@ -24,7 +24,7 @@
"scope": "workspace"
}
},
// スペルチェックを行わないファイルパスを指定する
// Specify a file path that will not undergo spell check.
"cSpell.ignorePaths": [
"dart_defines",
"firebase_options*.dart",
Expand All @@ -41,74 +41,74 @@
".vscode",
".vscode-insiders",
],
// ONLY GLOBAL: Breakpointに到達した時、デバッグビューが自動的に表示される
// ONLY GLOBAL: When reaching a Breakpoint, the debug view is automatically displayed.
"debug.openDebug": "openOnDebugBreak",
// 保存時にフォーマットを実行するなら`true`
// Execute format on save if true.
"editor.formatOnSave": true,
// 入力した行をフォーマットを実行するなら`true`
// Execute format on the line entered if `true`.
"editor.formatOnType": true,
// 貼り付けした時にフォーマットを実行するなら`true`
// Execute format when pasted if `true`.
"editor.formatOnPaste": true,
// 垂直ルーラーを表示する文字数の位置。複数指定可
// Position of the character count where the vertical ruler is displayed. Multiple specifications possible.
"editor.rulers": [
80
],
// ホワイトスペース文字の表示
// Display of whitespace characters.
"editor.renderWhitespace": "all",
// 制御文字を表示するなら`true`
// Display control characters if true.
"editor.renderControlCharacters": true,
// ミニマップを表示するなら`true`。Default: true
// Display the minimap if true. Default: true.
"editor.minimap.enabled": false,
// ブラケットをペアごとに色付けするなら`true`
// Color brackets by pair if `true`.
"editor.bracketPairColorization.enabled": true,
// ブラケットペアのガイド表示を有効にするなら`true`
// Enable bracket pair guide display if `true`.
"editor.guides.bracketPairs": true,
// Dartにのみ適用する設定群
// Settings applicable only to Dart.
"[dart]": {
// 選択された変数への正確な参照のみをハイライトするDartの機能を妨げないために`false`
// Set to `false` to not hinder the Dart feature that highlights only precise references to selected variables.
"editor.selectionHighlight": false,
// 「スニペットモード」でも通常通り補完機能を効かせるために`false`
// Set to `false` to allow regular completion functionality even in "snippet mode".
"editor.suggest.snippetsPreventQuickSuggestions": false,
// `first`: コード補完時に、最近使用された項目ではなく最上位の項目を提案する
// `recentlyUsedByPrefix`: 直前のテキストに基づいて最新使用された項目をフィルタリングする
// `first`: Propose the topmost item, not the recently used one, during code completion.
// `recentlyUsedByPrefix`: Filter the recently used items based on the preceding text.
"editor.suggestSelection": "recentlyUsedByPrefix",
// 補完リストが表示されていなくても、<TAB>を押すことで`for`などのスニペットを補完できる
// Even if the completion list is not displayed, pressing <TAB> will complete snippets like `for`.
"editor.tabCompletion": "onlySnippets",
// コメントや文字列の編集時にコード補完が単語を示唆することある挙動を無効化する
// Disable the behavior where code completion suggests words during editing of comments or strings.
"editor.wordBasedSuggestions": false,
// ファイル保存時に実行されるコードアクション
"editor.codeActionsOnSave": [
// セミコロンを挿入する。
"quickfix.insertSemicolon",
// インポートを整理する。
"source.organizeImports",
// 足りないインポートを追加する。
"source.addMissingImports",
// Dart fix を実行する。
"source.fixAll",
// セミコロンを挿入する。
"quickfix.insertSemicolon",
],
// Code actions executed upon file save.
"editor.codeActionsOnSave": {
// Insert a semicolon.
"quickfix.insertSemicolon": "always",
// Organize imports.
"source.organizeImports": "always",
// Add missing imports.
"source.addMissingImports": "always",
// Execute Dart fix.
"source.fixAll": "always",
},
},
// arbファイルが保存されるたびにLocalizationファイルを再生成させる
// Regenerate the Localization file every time an arb file is saved.
"dart.flutterGenerateLocalizationsOnSave": "all",
// 使用するFlutter SDKのパスを指定
// Specify the path to the Flutter SDK you are using.
"dart.flutterSdkPath": ".fvm/flutter_sdk",
// 外部パッケージをデバッグ可能としてマークし、デバッグ中のステップインを可能にするなら`true`
// Specify the path to the Dart SDK you are using.
"dart.sdkPath": ".fvm/flutter_sdk/bin/cache/dart-sdk",
// Mark external packages as debuggable and enable stepping into them during debugging if `true`.
"dart.debugExternalPackageLibraries": false,
// Dart SDKライブラリをデバッグ可能としてマークし、デバッグ中のステップインを可能にするなら`true`
// Mark Dart SDK libraries as debuggable and enable stepping into them during debugging if `true`.
"dart.debugSdkLibraries": false,
// 実験的な(未完成や不安定な可能性のある)リファクタを有効にするなら`true`
// Enable experimental refactoring (that might be unfinished or unstable) if `true`.
"dart.experimentalRefactors": true,
// スキップしたテストをテストツリーに表示させるなら`true`
// Display skipped tests in the test tree if `true`.
"dart.showSkippedTests": false,
// pubspec.yamlが保存されるたびにpub getするなら`always`
// Run `pub get` every time pubspec.yaml is saved if set to `always`.
"dart.runPubGetOnPubspecChanges": "always",
// クラス名を変更するとファイル名も自動で変更される。always, prompt, never
// When the class name is changed, the file name is also automatically changed. Options: always, prompt, never.
"dart.renameFilesWithClasses": "always",
// エクスプローラでファイルやフォルダをドラッグ&ドロップした時に確認を求めるなら`true`
// Ask for confirmation when dragging and dropping files or folders in the Explorer if `true`.
"explorer.confirmDragAndDrop": false,
// Explorer上でファイルをグループ化しネスト表示させる
// Group and nest display files on the Explorer.
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
Expand All @@ -119,16 +119,16 @@
"readme.*": "authors, backers.md, changelog*, citation*, code_of_conduct.md, codeowners, contributing.md, contributors, copying, credits, governance.md, history.md, license*, maintainers, readme*, security.md, sponsors.md",
"*.dart": "$(capture).g.dart, $(capture).freezed.dart, $(capture).mocks.dart"
},
// 指定したファイルを監視から除外する
// Exclude specified files from monitoring.
"files.watcherExclude": {
"**/.fvm": true
},
// 現在のGitリポジトリのデフォルトリモートからコミットを自動で取得するなら`true`
// `all` に設定すると、全てのリモートから取得する
// Fetch commits automatically from the default remote of the current Git repository if `true`.
// When set to `all`, fetch from all remotes.
"git.autofetch": true,
// ステージングされた変更が無い場合に全ての変更をコミットさせる場合は`true`.
// Commit all changes when there are no staged changes if `true`.
"git.enableSmartCommit": true,
// 検索対象から生成ファイルを除外する
// Exclude generated files from the search targets.
"search.exclude": {
"**/.fvm": true,
"**/*.freezed.dart": true,
Expand Down
Loading

0 comments on commit f2e7211

Please sign in to comment.