Skip to content

Commit

Permalink
Merge pull request #520 from rspier/shh2
Browse files Browse the repository at this point in the history
tests: save plack logs to a file.
rspier authored May 18, 2024
2 parents 438c69e + cd549a3 commit d7f0be5
Showing 3 changed files with 44 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# GitHub Actions Workflows

This directory contains workflow definitions for GitHub actions.

## Local Testing

The easiest way to end to end test them is wih a tool such as
https://github.com/nektos/act (https://nektosact.com/).

```
$ act --artifact-server-path=/tmp/artifacts
... actions run here! ...
```

You can use the `--reuse` flag to reuse information between runs,
which can speed things up. `--action-offline-mode` and `--pull=false`
can be used to test local copies of container images instead.
20 changes: 20 additions & 0 deletions .github/workflows/perl-tests.yml
Original file line number Diff line number Diff line change
@@ -24,6 +24,8 @@ jobs:
image: perldocker/perl-tester:5.36-slim-bookworm
strategy:
fail-fast: false
env:
PLACK_ENV: ghaction
steps:
- name: Check out repo
uses: actions/checkout@v4
@@ -62,13 +64,31 @@ jobs:
- name: Run the tests
if: "!(contains(github.event.pull_request.labels.*.name, 'want-coverage'))"
run: prove -lr -j4 t
continue-on-error: true
- name: Run tests (with coverage)
if: contains(github.event.pull_request.labels.*.name, 'want-coverage')
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cpanm -n Devel::Cover::Report::Coveralls
cover -test -report Coveralls | tee -a $GITHUB_STEP_SUMMARY
continue-on-error: true
# We need different versions of upload-artifact in production or
# local testing due to https://github.com/nektos/act/issues/2135
- name: Archive plack logs (prod)
uses: actions/upload-artifact@v4
if: ${{ env.ACT != 'true' }}
with:
name: plack.log
path: |
/tmp/plack.log
- name: Archive plack logs (dev)
uses: actions/upload-artifact@v3
if: ${{ env.ACT == 'true' }}
with:
name: plack.log
path: |
/tmp/plack.log
# - name: Install yath and JUnit renderer
# run: cpanm --notest Test2::Harness Test2::Harness::Renderer::JUnit
# - name: Run the tests
7 changes: 7 additions & 0 deletions etc/plack_log.conf.ghaction
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dispatchers = file

file.class = Log::Dispatch::File
file.min_level = debug
file.format = [%d{%Y-%m-%d %H:%M:%S}] [%p] %m%n
file.filename = "/tmp/plack.log"
file.mode = ">>"

0 comments on commit d7f0be5

Please sign in to comment.