Skip to content

Commit

Permalink
Merge pull request #62 from TechBooster/update-2023Oct
Browse files Browse the repository at this point in the history
Re:VIEW環境を5.8相当に変更
  • Loading branch information
mhidaka authored Nov 4, 2023
2 parents 95ede9b + 3d6b073 commit 17e7a63
Show file tree
Hide file tree
Showing 112 changed files with 12,281 additions and 3,861 deletions.
33 changes: 0 additions & 33 deletions .circleci/config.yml

This file was deleted.

237 changes: 237 additions & 0 deletions .circleci_template/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,237 @@
version: 2.1

# -------------------------
# EXECUTORS
# -------------------------
# Re:VIEWのバージョンアップ時はここが変わる or 増える
# ここ以外にCircleCIで考慮しなくていいようにする
executors:
# Executorではジョブ間で再利用するDockerイメージを定義する
# https://circleci.com/docs/2.0/reusing-config/#authoring-reusable-executors
vvakame-executor:
working_directory: ~/review
docker:
- image: vvakame/review:5.8

# -------------------------
# COMMANDS
# -------------------------
commands:
# ジョブ内で実行するステップシーケンスをマップとして定義する。複数のジョブ間でコマンド定義を再利用できる
# https://circleci.com/docs/ja/2.0/configuration-reference/#commandsversion21-%E3%81%8C%E5%BF%85%E9%A0%88
restore_cache_checkout:
steps:
- restore_cache:
key: v1-review-repo-{{ .Environment.CIRCLE_SHA1 }}

save_cache_checkout:
# save_cache_checkoutコマンドは再利用できるようにしていますが実質的にはsetupのタイミングでしか利用しません
steps:
- save_cache:
# working_directoryはsave_cacheには効かないので同じpathになるようにpathsを指定しておく
key: v1-review-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/review

restore_npm_deps:
steps:
- restore_cache:
name: Restore npm dependencies
key: v1-npm-cache-{{ checksum "package-lock.json" }}

save_npm_deps:
steps:
- save_cache:
key: v1-npm-cache-{{ checksum "package-lock.json" }}
paths:
- ./node_modules

restore_npm_deps_subdir:
parameters:
target_dir:
description: ビルド対象ソースがあるディレクトリを指定する
type: string
steps:
- restore_cache:
name: Restore npm dependencies
key: v1-npm-cache-<< parameters.target_dir >>-{{ checksum "<< parameters.target_dir >>/package-lock.json" }}

save_npm_deps_subdir:
parameters:
target_dir:
description: ビルド対象ソースがあるディレクトリを指定する
type: string
steps:
- save_cache:
name: Cache npm dependencies
key: v1-npm-cache-<< parameters.target_dir >>-{{ checksum "<< parameters.target_dir >>/package-lock.json" }}
paths:
- ./<< parameters.target_dir >>/node_modules

# -------------------------
# JOBS
# -------------------------
jobs:
setup:
executor: vvakame-executor
parameters:
target_dir:
description: ビルド対象ソースがあるディレクトリを指定する
type: string
default: ""
steps:
- checkout
- save_cache_checkout
- when:
condition: << parameters.target_dir >>
steps:
- restore_npm_deps_subdir:
target_dir: << parameters.target_dir >>
- run:
name: Initial Setup
command: cd << parameters.target_dir >> && npm install
- save_npm_deps_subdir:
target_dir: << parameters.target_dir >>
- unless:
condition: << parameters.target_dir >>
steps:
- restore_npm_deps
- run:
name: Initial Setup
command: npm install
- save_npm_deps
# ワークスペースの保存(後続のWorkflowsのjobで利用可能)
# https://circleci.com/docs/ja/2.0/configuration-reference/#persist_to_workspace
# rootはWorkspace のルートディレクトリとなるコンテナ内のディレクトリなので=working_directoryが無難
# pathsは相対パス
- persist_to_workspace:
root: ~/review
paths:
- node_modules
- "*/node_modules"

test:
executor: vvakame-executor
parameters:
target_dir:
description: ビルド対象ソースがあるディレクトリを指定する
type: string
default: ""
steps:
- restore_cache_checkout
- attach_workspace:
at: ~/review
- when:
condition: << parameters.target_dir >>
steps:
- run:
name: Test
command: cd << parameters.target_dir >> && npm test
- unless:
condition: << parameters.target_dir >>
steps:
- run:
name: Test
command: npm test

build:
executor: vvakame-executor
parameters:
target_dir:
description: ビルド対象ソースがあるディレクトリを指定する
type: string
default: ""
steps:
- restore_cache_checkout
- attach_workspace:
at: ~/review
- when:
condition: << parameters.target_dir >>
steps:
- run:
name: Build PDF
command: cd << parameters.target_dir >> && npm run pdf
- run:
name: Preparing artifacts
command: |
mkdir -p /tmp/artifacts
cp ./<< parameters.target_dir >>/articles/*.pdf /tmp/artifacts
- unless:
condition: << parameters.target_dir >>
steps:
- run:
name: Build PDF
command: npm run pdf
- run:
name: Preparing artifacts
command: |
mkdir -p /tmp/artifacts
cp ./articles/*.pdf /tmp/artifacts
- store_artifacts:
path: /tmp/artifacts
destination: /

# -------------------------
# WORKFLOWS
# -------------------------
# ここに書いてある順番でCircleCIが動きます。
# Review-Template付属のこの設定は(setup|test|build)それぞれのjobにサブディレクトリが指定できるようになっています
# もしルートに設定ファイルがない場合は次のようにしてください
# jobs:
# - setup:
# target_dir: "subdirectory_name"
# setup以外のtest,buildも同様にtarget_dirを指定してください
workflows:
version: 2
test-and-build:
jobs:
- setup
- test:
requires:
- setup
- build:
requires:
- setup

# ビルド対象が別の場所にあるときのworkflows設定例
# testとbuildはsetupに依存しています
# - setup:
# target_dir: sub_directory_name
# - test:
# target_dir: sub_directory_name
# requires:
# - setup
# - build:
# target_dir: sub_directory_name
# requires:
# - setup

# ビルド対象が2つ以上のworkflows設定例
# リポジトリに2つ以上のRe:VIEWプロジェクトがある場合の指定です。setupも2回以上やる必要があります
# (何度もチェックアウトしてるので気になるならcheckout部分を別jobsにするとよさそう)
#
# ひとつめ(target_dir_a)のsetup,test,build
# - setup:
# name: setup_a
# target_dir: target_dir_a
# - test:
# target_dir: target_dir_a
# requires:
# - setup_a
# - build:
# target_dir: target_dir_a
# requires:
# - setup_a
#
# ふたつめ(target_dir_b)のsetup,test,build
# - setup:
# name: setup_b
# target_dir: target_dir_b
# - test:
# target_dir: target_dir_b
# requires:
# - setup_b
# - build:
# target_dir: target_dir_b
# requires:
# - setup_b
14 changes: 14 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"image": "vvakame/review:5.8",
"settings": {
"editor.wordWrap": "on"
},
"extensions": [
"yuqquu.review-starter-syntax-highlight"
],
"postCreateCommand": [
"npm",
"ci",
],
"remoteUser": "root"
}
21 changes: 21 additions & 0 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build Re:VIEW to make distribution file
# The workflow is triggered on pushes to the repository.
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
# uses v3 Stable version
# https://github.com/actions/checkout
- name: checkout source
uses: actions/checkout@v3
# Build Artifacts
- name: Build distribution file
uses: TechBooster/ReVIEW-build-artifact-action@master
# Upload Distribution file
- name: Upload distribution file to github artifacts
uses: actions/upload-artifact@v3
with:
name: Output documents
path: ./articles/*.pdf
17 changes: 9 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
.DS_Store
node_modules/
npm-debug.log
vendor
.bundle

*~

Gemfile.lock
*.pdf
.sass-cache/
publish/

articles/*.pdf
articles/*.epub
articles/*.html
# articles/*.md
articles/*.xml
articles/*.txt
8 changes: 5 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# A sample Gemfile
source "https://rubygems.org"

gem 'review', '2.3.0'
gem 'review-peg', '0.2.2'
gem 'sass', '3.4.25'
gem 'review', '5.8.0'
gem 'pandoc2review'
gem 'playwright-runner'
gem 'rake'
# gem 'review-peg', '0.2.2'
38 changes: 30 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,21 +1,43 @@
GEM
remote: https://rubygems.org/
specs:
review (2.3.0)
concurrent-ruby (1.2.2)
image_size (3.3.0)
mime-types (3.4.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2023.0218.1)
pandoc2review (1.4.0)
unicode-eaw
pastel (0.8.0)
tty-color (~> 0.5)
playwright-ruby-client (1.35.0)
concurrent-ruby (>= 1.1.6)
mime-types (>= 3.0)
playwright-runner (1.2.0)
playwright-ruby-client (~> 1.0)
rake (13.0.6)
review (5.8.0)
image_size
rexml
rouge
rubyzip
review-peg (0.2.2)
rouge (2.2.0)
rubyzip (1.2.1)
sass (3.4.25)
tty-logger
rexml (3.2.5)
rouge (4.1.2)
rubyzip (2.3.2)
tty-color (0.6.0)
tty-logger (0.6.0)
pastel (~> 0.8)
unicode-eaw (2.2.0)

PLATFORMS
ruby

DEPENDENCIES
review (= 2.3.0)
review-peg (= 0.2.2)
sass (= 3.4.25)
pandoc2review
playwright-runner
rake
review (= 5.8.0)

BUNDLED WITH
1.15.3
Loading

0 comments on commit 17e7a63

Please sign in to comment.