Skip to content

Commit 8f339b8

Browse files
authored
Merge pull request #67 from perldoc-jp/revert-66-revert-65-fence
markdownのFencedCodeに対応する
2 parents 57f9c10 + 8a76fd3 commit 8f339b8

13 files changed

+442
-414
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,5 @@ jobs:
1515

1616
- name: Run test
1717
run: |
18-
make test
18+
make ci
1919
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: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,23 @@ RUN apt-get update && \
66
apt-get -y upgrade && \
77
apt-get install -y wget gcc g++ make sqlite3
88

9-
WORKDIR /usr/src/app
9+
RUN cpm install -g Carton
1010

11-
COPY cpanfile ./
12-
RUN cpm install
13-
COPY . .
11+
WORKDIR /usr/src/app
1412

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
21+
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
2527

26-
# テスト用のステージ
27-
FROM base as test
28-
RUN cpm install --with-test --with-develop --show-build-log-on-failure
2928

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

Makefile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,30 @@
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 exec app prove -lrv $(TEST_TARGET)
18+
19+
.PHONY: ci
20+
ci:
21+
docker compose up -d
22+
make setup-data
23+
make test
24+
25+
# 翻訳データのセットアップ
26+
# TODO: 翻訳データのセットアップは他にもあるので、全部ひとまとめにできると良さそう
27+
.PHONY: setup-data
28+
setup-data:
29+
docker compose exec app perl script/update.pl
30+

cpanfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ requires 'DBIx::TransactionManager';
1818
requires 'Regexp::Common';
1919
requires 'Regexp::Assemble';
2020
requires 'Text::Diff::FormattedHTML';
21-
requires 'Text::Markdown';
21+
requires 'Text::Markdown::Discount';
2222
requires 'SQL::Interp';
2323
requires 'Carp::Clan';
2424
requires 'JSON';
@@ -39,4 +39,5 @@ requires 'Log::Minimal';
3939
on 'test' => sub {
4040
requires 'Test2::V0';
4141
requires 'Test::WWW::Mechanize::PSGI';
42+
requires 'Unicode::GCString';
4243
};

0 commit comments

Comments
 (0)