Skip to content

Commit

Permalink
Merge pull request #69 from perldoc-jp/revert-68-revert-67-revert-66-…
Browse files Browse the repository at this point in the history
…revert-65-fence

Revert "Revert "markdownのFencedCodeに対応する""
  • Loading branch information
kfly8 authored May 16, 2024
2 parents 7de308a + 938ccf5 commit 5e4bc86
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 414 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ jobs:

- name: Run test
run: |
make test
make ci
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

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

WORKDIR /usr/src/app
RUN cpm install -g Carton

COPY cpanfile ./
RUN cpm install
COPY . .
WORKDIR /usr/src/app

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

RUN carton install --deployment
COPY . .

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

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

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

.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 exec app prove -lrv $(TEST_TARGET)

.PHONY: ci
ci:
docker compose up -d
make setup-data
make test

# 翻訳データのセットアップ
# TODO: 翻訳データのセットアップは他にもあるので、全部ひとまとめにできると良さそう
.PHONY: setup-data
setup-data:
docker compose exec app perl script/update.pl

3 changes: 2 additions & 1 deletion cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ requires 'DBIx::TransactionManager';
requires 'Regexp::Common';
requires 'Regexp::Assemble';
requires 'Text::Diff::FormattedHTML';
requires 'Text::Markdown';
requires 'Text::Markdown::Discount';
requires 'SQL::Interp';
requires 'Carp::Clan';
requires 'JSON';
Expand All @@ -39,4 +39,5 @@ requires 'Log::Minimal';
on 'test' => sub {
requires 'Test2::V0';
requires 'Test::WWW::Mechanize::PSGI';
requires 'Unicode::GCString';
};
Loading

0 comments on commit 5e4bc86

Please sign in to comment.