Skip to content

Commit

Permalink
Merge branch 'main' into project-sequencer-statemachine
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Dec 9, 2024
2 parents 521a8c0 + 4633856 commit 5fa2bcf
Show file tree
Hide file tree
Showing 399 changed files with 33,749 additions and 24,757 deletions.
73 changes: 55 additions & 18 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,31 @@
/** @type {import('@typescript-eslint/utils').TSESLint.Linter.Config} */
const vueEslintParser = "vue-eslint-parser";
const vueEslintParserOptions = {
ecmaVersion: 2020,
parser: "@typescript-eslint/parser",
};
const tsEslintOptions = {
project: ["./tsconfig.json"],
tsconfigRootDir: __dirname,
};

const tsEslintRules = {
// Storeでよくasyncなしの関数を定義するので無効化
// TODO: いずれは有効化する
"@typescript-eslint/require-await": "off",

"@typescript-eslint/no-misused-promises": [
"error",
{
// (...) => voidに(...) => Promise<void>を渡すのは許可
// ただし特に強い意志でこれを許可しているわけではないので、
// もし問題が発生した場合は有効化する
// ref: https://canary.discord.com/channels/879570910208733277/893889888208977960/1267467454876225536
checksVoidReturn: false,
},
],
};

/** @type {import('@typescript-eslint/utils').TSESLint.Linter.ConfigType} */
module.exports = {
root: true,
env: {
Expand All @@ -15,12 +42,9 @@ module.exports = {
"plugin:storybook/recommended",
],
plugins: ["import"],
parser: "vue-eslint-parser",
parserOptions: {
ecmaVersion: 2020,
parser: "@typescript-eslint/parser",
},
ignorePatterns: ["dist_electron/**/*", "dist/**/*", "node_modules/**/*"],
parser: vueEslintParser,
parserOptions: vueEslintParserOptions,
ignorePatterns: ["dist/**/*", "dist_*/**/*", "node_modules/**/*"],
rules: {
"linebreak-style":
process.env.NODE_ENV === "production" && process.platform !== "win32"
Expand All @@ -35,17 +59,6 @@ module.exports = {
endOfLine: "auto",
},
],
"vue/no-restricted-syntax": [
"error",
{
selector: "LogicalExpression[operator=??]",
message: `template内で"??"を使うとgithubのsyntax highlightが崩れるので\n三項演算子等を使って書き換えてください`,
},
{
selector: "MemberExpression[optional=true]",
message: `template内で"?."を使うとgithubのsyntax highlightが崩れるので\n三項演算子等を使って書き換えてください`,
},
],
"@typescript-eslint/no-unused-vars": [
process.env.NODE_ENV === "development" ? "warn" : "error", // 開発時のみwarn
{
Expand Down Expand Up @@ -89,6 +102,30 @@ module.exports = {
"no-console": "off",
},
},
{
files: ["*.ts", "*.mts"],
parser: "@typescript-eslint/parser",
extends: ["plugin:@typescript-eslint/recommended-type-checked"],
parserOptions: tsEslintOptions,
rules: tsEslintRules,
},
{
files: ["*.vue"],
parser: vueEslintParser,
parserOptions: { ...vueEslintParserOptions, ...tsEslintOptions },
extends: ["plugin:@typescript-eslint/recommended-type-checked"],
rules: {
...tsEslintRules,

// typescript-eslintにVueの型がanyとして認識されるので無効化
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-argument": "off",
"@typescript-eslint/no-unsafe-return": "off",
"@typescript-eslint/no-redundant-type-constituents": "off",
},
},
// Electronのメインプロセス以外でelectronのimportを禁止する
{
files: ["./src/**/*.ts", "./src/**/*.vue"],
Expand Down
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
src/openapi/**/* linguist-generated=true
openapi.json linguist-generated=true

**/__snapshots__/**/*.snap linguist-generated=true

*.woff2 linguist-vendored=true

* text=auto eol=lf
4 changes: 2 additions & 2 deletions .github/actions/download-engine/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,15 @@ runs:
cat $TEMPDIR/target.json | jq -er '[.assets[] | select(.name | contains("'$TARGET'") and endswith(".7z.txt"))][0]' > $TEMPDIR/assets_txt.json
LIST_URL=$(cat $TEMPDIR/assets_txt.json | jq -er '.browser_download_url')
echo "7z.txt url: $LIST_URL"
echo $LIST_URL | xargs curl -sSL > $TEMPDIR/download_name.txt
echo $LIST_URL | xargs curl -sSL --retry 3 --retry-delay 5 > $TEMPDIR/download_name.txt
echo "Files to download:"
cat $TEMPDIR/download_name.txt | sed -e 's|^|- |'
# ファイル一覧のtxtにあるファイルをダウンロード
for i in $(cat $TEMPDIR/download_name.txt); do
URL=$(cat $TEMPDIR/target.json | jq -er "[.assets[] | select(.name == \"$i\")][0].browser_download_url")
echo "Download url: $URL, dest: $TEMPDIR/$i"
curl -sSL $URL -o $TEMPDIR/$i &
curl -sSL $URL --retry 3 --retry-delay 5 -o $TEMPDIR/$i &
done
for job in `jobs -p`; do
wait $job
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/DANGEROUS_trigger_preview_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: "Trigger preview-pages' workflow"

# プレビュー用ページのワークフローを起動する。
# 詳細: https://github.com/voicevox/preview-pages?tab=readme-ov-file#%E4%BB%95%E7%B5%84%E3%81%BF

on:
pull_request_target:
types:
- opened
- synchronize
- closed
- reopened
push:
branches:
- main
- project-*

jobs:
trigger:
runs-on: ubuntu-latest
steps:
- name: Trigger Workflow
run: |
gh workflow run -R voicevox/preview-pages update_pages.yml
env:
GH_TOKEN: ${{ secrets.TRIGGER_PREVIEW_PAGES_TOKEN }}
15 changes: 7 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ on:
default: false

env:
VOICEVOX_ENGINE_REPO_URL: "https://github.com/VOICEVOX/voicevox_engine"
VOICEVOX_ENGINE_VERSION: 0.20.0
VOICEVOX_RESOURCE_VERSION: 0.20.0
VOICEVOX_ENGINE_VERSION: 0.21.1
VOICEVOX_RESOURCE_VERSION: 0.21.1
VOICEVOX_EDITOR_VERSION:
|- # releaseタグ名か、workflow_dispatchでのバージョン名か、999.999.999-developが入る
${{ github.event.release.tag_name || github.event.inputs.version || '999.999.999-develop' }}
Expand Down Expand Up @@ -121,7 +120,7 @@ jobs:
app_asar_dir: prepackage/VOICEVOX.app/Contents/Resources
installer_artifact_name: macos-x64-cpu-dmg
macos_artifact_name: "VOICEVOX.${version}-x64.${ext}"
os: macos-12
os: macos-13
# macOS CPU (arm64)
- artifact_name: macos-arm64-cpu-prepackage
artifact_path: dist_electron/mac-arm64
Expand Down Expand Up @@ -227,7 +226,7 @@ jobs:
- name: Define Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
run: |
bash build/codesign_setup.bash
bash tools/codesign_setup.bash
THUMBPRINT="$(head -n 1 $THUMBPRINT_PATH)"
SIGNTOOL_PATH="$(head -n 1 $SIGNTOOL_PATH_PATH)"
echo "::add-mask::$THUMBPRINT"
Expand Down Expand Up @@ -257,7 +256,7 @@ jobs:
- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
run: |
bash build/codesign_cleanup.bash
bash tools/codesign_cleanup.bash
echo 'WIN_CERTIFICATE_SHA1=' >> $GITHUB_ENV
echo 'WIN_SIGNING_HASH_ALGORITHMS=' >> $GITHUB_ENV
echo 'SIGNTOOL_PATH=' >> $GITHUB_ENV
Expand Down Expand Up @@ -391,7 +390,7 @@ jobs:
- name: Define Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
run: |
bash build/codesign_setup.bash
bash tools/codesign_setup.bash
THUMBPRINT="$(head -n 1 $THUMBPRINT_PATH)"
SIGNTOOL_PATH="$(head -n 1 $SIGNTOOL_PATH_PATH)"
echo "::add-mask::$THUMBPRINT"
Expand Down Expand Up @@ -426,7 +425,7 @@ jobs:
- name: Reset Code Signing Envs
if: startsWith(matrix.os, 'windows-') && github.event.inputs.code_signing == 'true'
run: |
bash build/codesign_cleanup.bash
bash tools/codesign_cleanup.bash
echo 'WIN_CERTIFICATE_SHA1=' >> $GITHUB_ENV
echo 'WIN_SIGNING_HASH_ALGORITHMS=' >> $GITHUB_ENV
echo 'SIGNTOOL_PATH=' >> $GITHUB_ENV
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/build_preview_pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: "Build Preview Pages"

# プレビュー用ページをビルドする。
# 詳細: https://github.com/voicevox/preview-pages?tab=readme-ov-file#%E4%BB%95%E7%B5%84%E3%81%BF

on:
push:
branches:
- main
- project-*
pull_request:

jobs:
# このJobの名前を変更したときは、voicevox/preview-pages側のscripts/collect.tsも変更すること。
build_preview_pages:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup environment
uses: ./.github/actions/setup-environment

- name: Build
run: |
# 追加のバージョン情報
if [ -n "${{ github.event.pull_request.head.sha }}" ]; then
LOCATION="PR#${{ github.event.pull_request.number }}"
SHORT_SHA=$(cut -c 1-7 <<< "${{ github.event.pull_request.head.sha }}")
else
LOCATION="${{ github.ref_name }}"
SHORT_SHA=$(cut -c 1-7 <<< "${{ github.sha }}")
fi
# Storybookのビルド
npm run storybook:build -- --output-dir $(pwd)/dist_preview/storybook
# ブラウザ版エディタのビルド
VITE_EXTRA_VERSION_INFO="${LOCATION} @ ${SHORT_SHA}" \
npm run browser:build -- --base ./ --outDir $(pwd)/dist_preview/editor
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: preview-pages
path: dist_preview
4 changes: 2 additions & 2 deletions .github/workflows/check_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: Check version
on:
pull_request:
paths:
- "/.node-version"
- "/package.json"
- ".node-version"
- "package.json"
workflow_dispatch:

defaults:
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Chromaticにmainブランチをpushする
# お試し運用中なので消滅する可能性あり

# TODO: Enable TurboSnap
# https://www.chromatic.com/docs/github-actions/#enable-turbosnap

name: "Chromatic"

on:
push:
branches:
- main

env:
# Chromatic用にNodeのメモリを増やす
# https://github.com/chromaui/chromatic-cli/issues/550#issuecomment-1150713820
NODE_OPTIONS: --max-old-space-size=16384

jobs:
chromatic:
name: Run Chromatic
Expand All @@ -28,3 +30,4 @@ jobs:
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: "storybook:build"
exitZeroOnChanges: true
onlyChanged: true
Loading

0 comments on commit 5fa2bcf

Please sign in to comment.