Skip to content

Commit

Permalink
Merge pull request #65 from perldoc-jp/fence
Browse files Browse the repository at this point in the history
markdownで書かれた翻訳は、GitHub Flavored Markdownを利用したい
  • Loading branch information
kfly8 authored Apr 25, 2024
2 parents 8afe022 + 73001fd commit 5d2da6c
Show file tree
Hide file tree
Showing 10 changed files with 411 additions and 409 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/update-cpanfile-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Update cpanfile.snapshot

on:
pull_request:
paths:
- cpanfile
- cpanfile.target
workflow_dispatch:

jobs:
update-cpanfile-snapshot:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}

- name: Check cpanfile.target
id: check-cpanfile-target
continue-on-error: true
run: sha256sum -c cpanfile.target

- name: Update cpanfile.snapshot and cpanfile.target
if: steps.check-cpanfile-target.outcome == 'failure'
run: |
docker build . -t perl-app-image --target base
docker run --rm -v $(pwd):/usr/src/app perl-app-image bash -c 'carton install'
sha256sum cpanfile > cpanfile.target
- uses: stefanzweifel/[email protected]
with:
commit_user_name: GitHub Actions
commit_user_email: [email protected]
commit_message: Update cpanfile.snapshot and cpanfile.target
file_pattern: cpanfile.snapshot cpanfile.target cpanfile

26 changes: 12 additions & 14 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,25 @@ RUN apt-get update && \
apt-get -y upgrade && \
apt-get install -y wget gcc g++ make sqlite3

RUN cpm install -g Carton

WORKDIR /usr/src/app

COPY cpanfile ./
RUN cpm install
COPY . .

RUN sqlite3 perldocjp.master.db < sql/sqlite.sql
RUN cp perldocjp.master.db perldocjp.slave.db
COPY cpanfile cpanfile.snapshot .

ENV PLACK_ENV=docker
ENV PERL5LIB=/usr/src/app/local/lib/perl5
ENV PATH=/usr/src/app/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# 翻訳データの更新
RUN perl script/update.pl

FROM base as app

# テスト用のステージ
FROM base as test
RUN cpm install --with-test --with-develop --show-build-log-on-failure
RUN carton install --deployment
COPY . .

RUN sqlite3 perldocjp.master.db < sql/sqlite.sql
RUN cp perldocjp.master.db perldocjp.slave.db

# 翻訳データの更新
RUN perl script/update.pl

# サーバーを起動したい時のステージ
FROM base as web
CMD ["./local/bin/plackup", "-p", "5000", "-Ilib", "app.psgi"]
11 changes: 5 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@

.PHONY: build
build:
docker-compose -f docker-compose.yml build web
docker compose build

.PHONY: up
up:
make build
docker-compose -f docker-compose.yml up -d web
docker compose up

.PHONY: down
down:
docker-compose -f docker-compose.yml down
docker compose down

.PHONY: test
test: TEST_TARGET = t
test:
docker-compose -f docker-compose.yml build test
docker-compose -f docker-compose.yml run test prove -Ilib -r -v t
docker compose run --rm app prove -lrv $(TEST_TARGET)
4 changes: 3 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ requires 'DBIx::TransactionManager';
requires 'Regexp::Common';
requires 'Regexp::Assemble';
requires 'Text::Diff::FormattedHTML';
requires 'Text::Markdown';
requires 'YAML::Tiny'; # for Markdown::Perl
requires 'Unicode::CaseFold'; # for Markdown::Perl
requires 'Markdown::Perl' => '1.03';
requires 'SQL::Interp';
requires 'Carp::Clan';
requires 'JSON';
Expand Down
Loading

0 comments on commit 5d2da6c

Please sign in to comment.