Skip to content

Commit

Permalink
Merge pull request #57 from perldoc-jp/add-makefile-and-github-action
Browse files Browse the repository at this point in the history
Add Makefile and GitHub action
  • Loading branch information
kfly8 authored Dec 6, 2023
2 parents ba958df + 7d11f32 commit 7e937bf
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 105 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: test

on:
push:
branches:
- master
pull_request:

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run test
run: |
make test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
Makefile
inc/
MANIFEST
*.bak
Expand Down
9 changes: 8 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM perl:5.38-bookworm
FROM perl:5.38-bookworm as base

ENV DEBIAN_FRONTEND=noninteractive

Expand All @@ -22,4 +22,11 @@ ENV PATH=/usr/src/app/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi
# 翻訳データの更新
RUN perl script/update.pl


# テスト用のステージ
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"]
45 changes: 0 additions & 45 deletions META.yml

This file was deleted.

18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

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

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

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

.PHONY: test
test:
docker-compose -f docker-compose.yml build test
docker-compose -f docker-compose.yml run test prove -Ilib -r -v t
57 changes: 0 additions & 57 deletions Makefile.PL

This file was deleted.

3 changes: 3 additions & 0 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,6 @@ requires 'Router::Simple';
requires 'Router::Simple::Sinatraish';
requires 'Log::Minimal';

on 'test' => sub {
requires 'Test::WWW::Mechanize::PSGI';
};
9 changes: 8 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
version: '3'
services:
web:
build: .
build:
context: .
target: web
ports:
- "8080:5000"

test:
build:
context: .
target: test

0 comments on commit 7e937bf

Please sign in to comment.