Skip to content

Commit

Permalink
共通ワークフローを定義、super-linterを導入 (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Oct 7, 2023
1 parent abfe2e3 commit 6d95d4b
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# VOICEVOX .github Workflow README

`shared.yml`は全 VOICEVOX リポジトリで共通するワークフローをまとめたものです。
`test.yml`をコピペして使うことを想定しています。
19 changes: 19 additions & 0 deletions .github/workflows/shared.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: VOICEVOX Shared Workflow

on:
workflow_call:
inputs:
super_linter_env_vars:
type: string
description: "super linter用の環境変数定義。複数行のenv_name=env_value"

defaults:
run:
shell: bash

jobs:
super-linter:
name: Super Linter
uses: VOICEVOX/.github/.github/workflows/super-linter.yml@main
with:
env_vars: ${{ inputs.super_linter_env_vars }}
38 changes: 38 additions & 0 deletions .github/workflows/super-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# https://github.com/super-linter/super-linter/blob/main/TEMPLATES/linter.yml
---
name: Super Linter

on:
workflow_call:
inputs:
env_vars:
type: string
description: "env_name=env_value,..."

jobs:
super-linter:
name: Super Linter
runs-on: ubuntu-latest

permissions:
contents: read
packages: read
statuses: write

steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0 # 差分を取得するために必要

- name: Setup Environment Variables
if: ${{ inputs.env_vars }}
run: for line in "${{ inputs.env_vars }}"; do echo "$line" >> $GITHUB_ENV; done

- name: Lint Code Base
uses: super-linter/super-linter/slim@v5
env:
VALIDATE_ALL_CODEBASE: true # すべてのファイルを検証する。
VALIDATE_JSCPD: false # コピペ検出。厳しすぎるので無効化。
VALIDATE_NATURAL_LANGUAGE: false # 自然言語検出。英語のみなので無効化。
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test VOICEVOX Shared Workflow

on:
push:
pull_request:

defaults:
run:
shell: bash

jobs:
voicevox-shared-workflow:
uses: VOICEVOX/.github/.github/workflows/shared.yml@main

# Super Linter に必要
permissions:
contents: read
packages: read
statuses: write

# Pythonの検証を無効化する例
# with:
# super_linter_env_vars: |
# VALIDATE_PYTHON=false
# VALIDATE_PYTHON_BLACK=false
# VALIDATE_PYTHON_FLAKE8=false
# VALIDATE_PYTHON_ISORT=false
# VALIDATE_PYTHON_MYPY=false
# VALIDATE_PYTHON_PYLINT=false

0 comments on commit 6d95d4b

Please sign in to comment.