Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing prove #72

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c6e2ce3
test
shibuiwilliam Jul 5, 2023
8c7935f
changed test; junit
shibuiwilliam Jul 6, 2023
04bc71e
changed test; junit
shibuiwilliam Jul 6, 2023
352c8fc
update
shibuiwilliam Jul 7, 2023
469e548
update
shibuiwilliam Jul 7, 2023
2488345
investigating
shibuiwilliam Jul 11, 2023
a6fbd77
update
shibuiwilliam Jul 11, 2023
515ad74
add prove github actions
shibuiwilliam Aug 3, 2023
380a9fb
update
shibuiwilliam Aug 3, 2023
f304b1e
update
shibuiwilliam Aug 3, 2023
6b17464
update
shibuiwilliam Aug 3, 2023
4593cc8
update
shibuiwilliam Aug 3, 2023
13b45eb
update
shibuiwilliam Aug 3, 2023
2f80984
update
shibuiwilliam Aug 3, 2023
b308a8b
update
shibuiwilliam Aug 3, 2023
1b7c199
update
shibuiwilliam Aug 3, 2023
46f2971
update
shibuiwilliam Aug 3, 2023
c80a71c
update
shibuiwilliam Aug 3, 2023
f025032
update
shibuiwilliam Aug 3, 2023
2fed711
update
shibuiwilliam Aug 3, 2023
8b5a0f3
update
shibuiwilliam Aug 3, 2023
7580913
update
shibuiwilliam Aug 3, 2023
68fbcdc
update
shibuiwilliam Aug 3, 2023
945143c
update
shibuiwilliam Aug 4, 2023
0bfee38
update
shibuiwilliam Aug 4, 2023
fbd2977
update
shibuiwilliam Aug 4, 2023
0eb303c
update
shibuiwilliam Aug 4, 2023
daec72f
update
shibuiwilliam Aug 4, 2023
44409f1
update
shibuiwilliam Aug 4, 2023
256eeab
update
shibuiwilliam Aug 4, 2023
0c74032
update
shibuiwilliam Aug 4, 2023
944f9e7
update
shibuiwilliam Aug 4, 2023
da5f6d1
update
shibuiwilliam Aug 4, 2023
0c50ff2
update
shibuiwilliam Aug 4, 2023
186360b
update
shibuiwilliam Aug 4, 2023
a6281ec
update
shibuiwilliam Aug 4, 2023
66e1b29
update
shibuiwilliam Aug 4, 2023
2615e2b
update
shibuiwilliam Aug 4, 2023
3352b5d
update
shibuiwilliam Aug 4, 2023
51e6575
update
shibuiwilliam Aug 4, 2023
3a2f368
update
shibuiwilliam Aug 4, 2023
1414fcf
update
shibuiwilliam Aug 4, 2023
dd9c021
update
shibuiwilliam Aug 4, 2023
0378915
update
shibuiwilliam Aug 4, 2023
9cb4084
update
shibuiwilliam Aug 4, 2023
d885b6a
update
shibuiwilliam Aug 4, 2023
4615516
update
shibuiwilliam Aug 4, 2023
a35b5c0
update
shibuiwilliam Aug 4, 2023
62d88fc
udpate
shibuiwilliam Aug 4, 2023
57f25cf
udpate
shibuiwilliam Aug 4, 2023
eff3b5a
add centos
shibuiwilliam Aug 13, 2023
414155c
add centos
shibuiwilliam Aug 13, 2023
35cbfbb
add centos
shibuiwilliam Aug 13, 2023
6e8e750
add centos
shibuiwilliam Aug 13, 2023
09954f1
add centos
shibuiwilliam Aug 14, 2023
3407c44
add centos
shibuiwilliam Aug 14, 2023
cf35ce6
add centos
shibuiwilliam Aug 14, 2023
df0b437
add centos
shibuiwilliam Aug 14, 2023
d601d44
add centos
shibuiwilliam Aug 14, 2023
1418cee
add centos
shibuiwilliam Aug 14, 2023
24f9546
add centos
shibuiwilliam Aug 14, 2023
8957d67
add centos
shibuiwilliam Aug 14, 2023
e66a926
add centos
shibuiwilliam Aug 14, 2023
0ee1182
add centos
shibuiwilliam Aug 14, 2023
f47e8b6
add centos
shibuiwilliam Aug 14, 2023
666d1aa
add centos
shibuiwilliam Aug 14, 2023
5361447
add centos
shibuiwilliam Aug 15, 2023
ee55f83
add centos
shibuiwilliam Aug 15, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 117 additions & 0 deletions .github/workflows/prove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
name: PerlProve

on:
push:
branches: [master]
paths:
- "prove/**"
pull_request:
paths:
- "prove/**"

env:
LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN_PROVE }}
LAUNCHABLE_DEBUG: 1
LAUNCHABLE_REPORT_ERROR: 1

jobs:
tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: prove
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install wheel setuptools_scm
# pip install launchable
git clone https://github.com/launchableinc/cli.git
cd cli
git checkout fix-remove_teardown
python3 setup.py install
- uses: shogo82148/actions-setup-perl@v1
with:
perl-version: '5.34'
- name: Install dependencies
run: |
cpan Carton
cpm install
carton install
cpan namespace::autoclean
- run: "launchable verify"
- name: Record commits and build
run: 'launchable record build --name "$GITHUB_RUN_ID" --source ..' # care for working-directory path
- name: Test
continue-on-error: true
run: carton exec prove -Ilib --formatter TAP::Formatter::JUnit -r -j4 --verbose --timer t > junit_output.xml
- name: Record
run: |
cat junit_output.xml
launchable record tests --build "$GITHUB_RUN_ID" prove junit_output.xml
if: always()
- name: Subset
continue-on-error: true
run: |
find ./t -name '*.t' | launchable subset --target 50% --build "$GITHUB_RUN_ID" --rest rest.txt prove > subset.txt
carton exec prove -Ilib --formatter TAP::Formatter::JUnit -r -j4 --verbose --timer $(cat subset.txt)
docker_tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: prove
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install wheel setuptools_scm
pip install launchable
- run: "launchable verify"
- name: Record commits and build
run: 'launchable record build --name "$GITHUB_RUN_ID" --source ..' # care for working-directory path
- name: Build Docker
run: |
docker build -t test:latest .
- name: Run Docker
continue-on-error: true
run: |
docker run -t --name test -e GITHUB_RUN_ID -e LAUNCHABLE_TOKEN -v ${pwd}:/opt/ test:latest /bin/sh -c "./run.sh"
docker_centos_tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: prove
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install wheel setuptools_scm
pip install launchable
- run: "launchable verify"
- name: Record commits and build
run: 'launchable record build --name "$GITHUB_RUN_ID" --source ..' # care for working-directory path
- name: Build Docker
run: |
docker build -t test:latest -f Dockerfile.centos .
- name: Run Docker
continue-on-error: true
run: |
docker run -t --name test -e GITHUB_RUN_ID -e LAUNCHABLE_TOKEN -v ${pwd}:/opt/ test:latest /bin/sh -c "./run.sh"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.vscode/*
.python-version
1 change: 1 addition & 0 deletions prove/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ cpanfile.snapshot
.launchable
subset.txt
rest.txt
*.xml
18 changes: 18 additions & 0 deletions prove/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM ubuntu:latest

COPY . /opt/
WORKDIR /opt/
RUN apt -y update && \
apt -y install python3 python3-pip git zstd default-jdk cpm build-essential && \
python3 -m pip install --upgrade pip && \
pip install wheel setuptools_scm && \
git clone https://github.com/launchableinc/cli.git && \
cd cli && \
git checkout fix-remove_teardown && \
python3 setup.py install && \
cd .. && \
cpan Carton && \
cpm install && \
carton install && \
cpan namespace::autoclean && \
chmod +x /opt/run.sh
50 changes: 50 additions & 0 deletions prove/Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
FROM centos:centos7.9.2009

COPY . /opt/
WORKDIR /opt/
RUN yum update -y && \
yum groupinstall -y "development tools" && \
yum install -y bzip2-devel gdbm-devel libffi-devel libuuid-devel ncurses-devel \
readline-devel sqlite-devel tk-devel wget xz-devel zlib-devel epel-release \
curl make git gcc zstd default-jdk build-essential java-1.8.0-openjdk \
perl perl-core perl-local-lib perl-CPAN perl-App-cpanminus expat-devel perl-XML-SemanticDiff \
perl-Test-Unit-Runner-Xml perl-File-Slurp perl-Moose perl-IPC-Run perl-Test-XML \
perl-XML-SAX perl-XML-SAX-Writer perl-XML-Twig perl-XML-XPath && \
yum -y remove openssl openssl-devel

WORKDIR /opt/
RUN wget https://www.openssl.org/source/openssl-1.1.1t.tar.gz && \
tar xvf openssl-1.1.1t.tar.gz && \
cd openssl-1.1*/ && \
./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib no-shared zlib-dynamic && \
make && \
make test && \
make install && \
echo "export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib64" >> /etc/profile.d/openssl.sh && \
source /etc/profile.d/openssl.sh

WORKDIR /opt/
RUN wget https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tgz && \
tar xzf Python-3.8.16.tgz && \
cd Python-3.8.16 && \
./configure --enable-optimizations && \
make altinstall && \
python3.8 -m pip install --upgrade pip && \
pip install install wheel setuptools_scm && \
git clone https://github.com/launchableinc/cli.git && \
cd cli && \
git checkout fix-remove_teardown && \
python3.8 setup.py install

WORKDIR /opt/
RUN curl -fsSL https://raw.githubusercontent.com/skaji/cpm/main/cpm > cpm && \
chmod +x cpm && \
cpan Carton; exit 0

RUN cpan Carton && \
cpan install MooseX::NonMoose && \
cpan install XML::Parser && \
./cpm install && \
carton install && \
cpan namespace::autoclean && \
chmod +x /opt/run.sh
57 changes: 42 additions & 15 deletions prove/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,55 @@ Example - Example Perl prove project for Launchable

## Install dependencies

Please install [`Carton`](https://metacpan.org/pod/Carton) before trying this project.
Please install [`Carton`](https://metacpan.org/pod/Carton) before trying this project. Also, use [TAP::Formatter::JUnit](https://github.com/bleargh45/TAP-Formatter-JUnit) for generating JUnit XML report. The [TAP::Formatter::JUnit](https://github.com/bleargh45/TAP-Formatter-JUnit) is included in the [cpanfile](./cpanfile).

```sh
$ cpanm Carton (or cpan Carton)
$ cpm install
$ carton install
```

## Run tests

```sh
$ export JUNIT_NAME_MANGLE=none
$ carton exec prove -Ilib --harness TAP::Harness::JUnit -r t

xmlfile argument not supplied, defaulting to "junit_output.xml" at ~/examples/prove/local/lib/perl5/TAP/Harness/JUnit.pm line 125.
t/00_compile.t .... ok
t/easy/01_easy.t .. ok
t/math/01_math.t .. ok
All tests successful.
Files=3, Tests=6, 0.092551 wallclock secs ( 0.01 usr 0.00 sys + 0.06 cusr 0.01 csys = 0.08 CPU)
Result: PASS

$ BUILD_NAME=test
$ carton exec prove -Ilib --formatter TAP::Formatter::JUnit -r -j4 --verbose --timer t > junit_output.xml

# Failed test 'add(1, 2) == 5'
# at t/fail/01_fail.t line 9.
# got: '3'
# expected: '5'

# Failed test 'add(1, 2) == 5'
# at t/fail/02_fail.t line 9.
# +-----+----+-------+
# | GOT | OP | CHECK |
# +-----+----+-------+
# | 3 | eq | 5 |
# +-----+----+-------+

# Failed test '1 + 2'
# at t/fail/01_fail.t line 14.
# got: '3'
# expected: '4'
# Looks like you failed 1 test of 1.

# Failed test 'add'
# at t/fail/01_fail.t line 15.
# Tests were run but no plan was declared and done_testing() was not seen.
# Failed test '1 + 2'
# at t/fail/02_fail.t line 14.
# +-----+----+-------+
# | GOT | OP | CHECK |
# +-----+----+-------+
# | 3 | eq | 4 |
# +-----+----+-------+

# Failed test 'add'
# at t/fail/02_fail.t line 15.
# Tests were run but no plan was declared and done_testing() was not seen.
# Seeded srand with seed '20230711' from local date.

$ BUILD_NAME=test_perl
$ launchable record build --name ${BUILD_NAME} --source ..

Launchable recorded 1 commit from repository ~/examples
Expand Down Expand Up @@ -64,7 +91,7 @@ $ launchable inspect tests --test-session-id 12
## Subsetting your test runs

```shell
$ BUILD_NAME=test
$ BUILD_NAME=test_perl
$ TARGET="50%"

$ find ./t -name '*.t' | launchable subset --target ${TARGET} --build ${BUILD_NAME} --rest rest.txt prove > subset.txt
Expand All @@ -89,7 +116,7 @@ $ launchable inspect subset --subset-id 6
| 2 | file=t/00_compile.t | | 0.00 |
| 3 | file=t/easy/01_easy.t | | 0.00 |

$ carton exec prove -Ilib --harness TAP::Harness::JUnit -r $(cat subset.txt)
$ carton exec prove -Ilib --formatter TAP::Formatter::JUnit -r $(cat subset.txt)

xmlfile argument not supplied, defaulting to "junit_output.xml" at ~/examples/prove/local/lib/perl5/TAP/Harness/JUnit.pm line 125.
t/00_compile.t .. ok
Expand Down
3 changes: 1 addition & 2 deletions prove/cpanfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
requires 'perl', '5.008001';

on 'test' => sub {
requires 'TAP::Harness::JUnit';
requires 'Test::More', '0.98';
requires 'Test2::V0';
requires 'TAP::Formatter::JUnit', git => 'https://github.com/shibuiwilliam/TAP-Formatter-JUnit.git';
};

39 changes: 0 additions & 39 deletions prove/junit_output.xml

This file was deleted.

1 change: 1 addition & 0 deletions prove/lib/Example/Easy.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use utf8;

sub str_concat {
my ($a, $b) = @_;
sleep(1);

return $a.$b;
}
Expand Down
2 changes: 2 additions & 0 deletions prove/lib/Example/Math.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ use utf8;

sub add {
my ($a, $b) = @_;
sleep(2);

return $a + $b;
}

sub double {
my $a = shift;
sleep(1);

return $a * 2;
}
Expand Down
8 changes: 8 additions & 0 deletions prove/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

set +e

launchable verify
carton exec prove -Ilib --formatter TAP::Formatter::JUnit -r -j4 --verbose --timer t > junit_output.xml
cat junit_output.xml
launchable record tests --build "$GITHUB_RUN_ID" prove junit_output.xml
2 changes: 1 addition & 1 deletion prove/t/easy/01_easy.t
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use strict;
use warnings;
use utf8;
use Test2::V0;
use Test::More;

use Example::Easy;

Expand Down
18 changes: 18 additions & 0 deletions prove/t/easy/02_easy.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use strict;
use warnings;
use utf8;
use Test2::V0;

use Example::Easy;

is(Example::Easy::str_concat("b", "a"), "ba", "b + a = ba");

subtest 'str_concat_v2' => sub {
my ($a, $b, $c, $d) = ("a", "bb", "ccc", "dddd");

is(Example::Easy::str_concat($a, $d), "adddd", "$a + $d");
is(Example::Easy::str_concat($b, $c), "bbccc", "$b + $c");
};

done_testing;

Loading