Skip to content

Commit 5d2da6c

Browse files
authored
Merge pull request #65 from perldoc-jp/fence
markdownで書かれた翻訳は、GitHub Flavored Markdownを利用したい
2 parents 8afe022 + 73001fd commit 5d2da6c

10 files changed

+411
-409
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Update cpanfile.snapshot
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- cpanfile
7+
- cpanfile.target
8+
workflow_dispatch:
9+
10+
jobs:
11+
update-cpanfile-snapshot:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.head_ref }}
22+
23+
- name: Check cpanfile.target
24+
id: check-cpanfile-target
25+
continue-on-error: true
26+
run: sha256sum -c cpanfile.target
27+
28+
- name: Update cpanfile.snapshot and cpanfile.target
29+
if: steps.check-cpanfile-target.outcome == 'failure'
30+
run: |
31+
docker build . -t perl-app-image --target base
32+
docker run --rm -v $(pwd):/usr/src/app perl-app-image bash -c 'carton install'
33+
sha256sum cpanfile > cpanfile.target
34+
35+
- uses: stefanzweifel/[email protected]
36+
with:
37+
commit_user_name: GitHub Actions
38+
commit_user_email: [email protected]
39+
commit_message: Update cpanfile.snapshot and cpanfile.target
40+
file_pattern: cpanfile.snapshot cpanfile.target cpanfile
41+

Dockerfile

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,25 @@ RUN apt-get update && \
66
apt-get -y upgrade && \
77
apt-get install -y wget gcc g++ make sqlite3
88

9+
RUN cpm install -g Carton
10+
911
WORKDIR /usr/src/app
1012

11-
COPY cpanfile ./
12-
RUN cpm install
13-
COPY . .
14-
15-
RUN sqlite3 perldocjp.master.db < sql/sqlite.sql
16-
RUN cp perldocjp.master.db perldocjp.slave.db
13+
COPY cpanfile cpanfile.snapshot .
1714

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

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

20+
FROM base as app
2521

26-
# テスト用のステージ
27-
FROM base as test
28-
RUN cpm install --with-test --with-develop --show-build-log-on-failure
22+
RUN carton install --deployment
23+
COPY . .
24+
25+
RUN sqlite3 perldocjp.master.db < sql/sqlite.sql
26+
RUN cp perldocjp.master.db perldocjp.slave.db
27+
28+
# 翻訳データの更新
29+
RUN perl script/update.pl
2930

30-
# サーバーを起動したい時のステージ
31-
FROM base as web
32-
CMD ["./local/bin/plackup", "-p", "5000", "-Ilib", "app.psgi"]

Makefile

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11

22
.PHONY: build
33
build:
4-
docker-compose -f docker-compose.yml build web
4+
docker compose build
55

66
.PHONY: up
77
up:
8-
make build
9-
docker-compose -f docker-compose.yml up -d web
8+
docker compose up
109

1110
.PHONY: down
1211
down:
13-
docker-compose -f docker-compose.yml down
12+
docker compose down
1413

1514
.PHONY: test
15+
test: TEST_TARGET = t
1616
test:
17-
docker-compose -f docker-compose.yml build test
18-
docker-compose -f docker-compose.yml run test prove -Ilib -r -v t
17+
docker compose run --rm app prove -lrv $(TEST_TARGET)

cpanfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ requires 'DBIx::TransactionManager';
1818
requires 'Regexp::Common';
1919
requires 'Regexp::Assemble';
2020
requires 'Text::Diff::FormattedHTML';
21-
requires 'Text::Markdown';
21+
requires 'YAML::Tiny'; # for Markdown::Perl
22+
requires 'Unicode::CaseFold'; # for Markdown::Perl
23+
requires 'Markdown::Perl' => '1.03';
2224
requires 'SQL::Interp';
2325
requires 'Carp::Clan';
2426
requires 'JSON';

0 commit comments

Comments
 (0)