From 74f8a66726e310aae5f67b0e45120dd2e405e2b4 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 18:46:14 +0300 Subject: [PATCH 1/6] add simple github workflow --- .github/workflows/ci.yml | 97 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..b611e850e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,97 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: +# schedule: +# - cron: '42 5 * * *' + +jobs: + test: + strategy: + fail-fast: false + matrix: + runner: [ubuntu-latest] + #runner: [ubuntu-latest, macos-latest, windows-latest] + perl: [ '5.36' ] + exclude: + - runner: windows-latest + perl: '5.36' + + runs-on: ${{matrix.runner}} + name: OS ${{matrix.runner}} Perl ${{matrix.perl}} + + steps: + - uses: actions/checkout@v3 + + - name: Set up perl + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: ${{ matrix.perl }} + distribution: ${{ ( matrix.runner == 'windows-latest' && 'strawberry' ) || 'default' }} + + - name: Show Perl Version + run: | + perl -v + + - name: Install Modules + run: | + cpanm -v + cpanm --notest Module::Install + cpanm --installdeps --notest . + + cpanm --notest Class::DBI::Plugin::DeepAbstractSearch + cpanm --notest Class::MethodCache + cpanm --notest Class::Unload + cpanm --notest Date::Simple + cpanm --notest DateTime::Format::MySQL + cpanm --notest DateTime::Format::Pg + cpanm --notest DateTime::Format::SQLite + cpanm --notest DateTime::Format::Strptime + cpanm --notest JSON + cpanm --notest JSON::Any + cpanm --notest JSON::DWIW + cpanm --notest JSON::XS + cpanm --notest Math::Base36 + cpanm --notest MooseX::Types::JSON + cpanm --notest MooseX::Types::LoadableClass + cpanm --notest MooseX::Types::Path::Class + cpanm --notest PadWalker + cpanm --notest Pod::Coverage + cpanm --notest SQL::Translator + cpanm --notest Test::EOL + cpanm --notest Test::NoTabs + cpanm --notest Test::Pod + cpanm --notest Test::Pod::Coverage + cpanm --notest Test::Strict + cpanm --notest Text::CSV + cpanm --notest Time::Piece::MySQL + + - name: Show Errors on Windows + if: ${{ failure() && matrix.runner == 'windows-latest' }} + run: | + ls -l C:/Users/ + ls -l C:/Users/RUNNER~1/ + cat C:/Users/runneradmin/.cpanm/work/*/build.log + + - name: Show Errors on Ubuntu + if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}} + run: | + cat /home/runner/.cpanm/work/*/build.log + + - name: Show Errors on OSX + if: ${{ failure() && startsWith( matrix.runner, 'macos-')}} + run: | + cat /Users/runner/.cpanm/work/*/build.log + + - name: Run tests + env: + AUTHOR_TESTING: 1 + RELEASE_TESTING: 1 + run: | + perl Makefile.PL + make + make test + + From 82492e3168ac47a4d3b8c143abb63e539f92a49f Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 19:15:00 +0300 Subject: [PATCH 2/6] add ci using docker container --- .github/workflows/with_pg.yaml | 73 ++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/with_pg.yaml diff --git a/.github/workflows/with_pg.yaml b/.github/workflows/with_pg.yaml new file mode 100644 index 000000000..e10991050 --- /dev/null +++ b/.github/workflows/with_pg.yaml @@ -0,0 +1,73 @@ +name: CI + +on: + push: + pull_request: + workflow_dispatch: +# schedule: +# - cron: '42 5 * * *' + +jobs: + test: + strategy: + fail-fast: false + matrix: + perl: [ '5.36' ] + + runs-on: ubuntu-latest + container: perl:${{ matrix.perl }} + + steps: + - uses: actions/checkout@v3 + + - name: Show Perl Version + run: | + perl -v + + - name: Install Modules + run: | + cpanm -v + cpanm --notest Module::Install + cpanm --installdeps --notest . + + cpanm --notest Class::DBI::Plugin::DeepAbstractSearch + cpanm --notest Class::MethodCache + cpanm --notest Class::Unload + cpanm --notest Date::Simple + cpanm --notest DateTime::Format::MySQL + cpanm --notest DateTime::Format::Pg + cpanm --notest DateTime::Format::SQLite + cpanm --notest DateTime::Format::Strptime + cpanm --notest JSON + cpanm --notest JSON::Any + cpanm --notest JSON::DWIW + cpanm --notest JSON::XS + cpanm --notest Math::Base36 + cpanm --notest MooseX::Types::JSON + cpanm --notest MooseX::Types::LoadableClass + cpanm --notest MooseX::Types::Path::Class + cpanm --notest PadWalker + cpanm --notest Pod::Coverage + cpanm --notest SQL::Translator + cpanm --notest Test::EOL + cpanm --notest Test::NoTabs + cpanm --notest Test::Pod + cpanm --notest Test::Pod::Coverage + cpanm --notest Test::Strict + cpanm --notest Text::CSV + cpanm --notest Time::Piece::MySQL + + - name: Show Errors on Ubuntu + if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}} + run: | + cat /home/runner/.cpanm/work/*/build.log + + - name: Run tests + env: + AUTHOR_TESTING: 1 + RELEASE_TESTING: 1 + run: | + perl Makefile.PL + make + make test + From 5042d7410b167ac9bbefc2cb14fc72ae359f6871 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 19:34:42 +0300 Subject: [PATCH 3/6] try to use pg --- .github/workflows/ci.yml | 2 +- .github/workflows/with_pg.yaml | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b611e850e..a7ade54e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,4 @@ -name: CI +name: CI native on: push: diff --git a/.github/workflows/with_pg.yaml b/.github/workflows/with_pg.yaml index e10991050..b1e782a17 100644 --- a/.github/workflows/with_pg.yaml +++ b/.github/workflows/with_pg.yaml @@ -1,4 +1,4 @@ -name: CI +name: CI in Docker container on: push: @@ -14,6 +14,20 @@ jobs: matrix: perl: [ '5.36' ] + services: + postgres_service: + image: postgres:${{matrix.postgres}} + env: + POSTGRES_USER: dbic_user + POSTGRES_PASSWORD: secret + POSTGRES_DB: dbic_test + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + + runs-on: ubuntu-latest container: perl:${{ matrix.perl }} @@ -25,6 +39,10 @@ jobs: perl -v - name: Install Modules + env: + DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=postgres_service' + DBICTEST_PG_USER='dbic_user' + DBICTEST_PG_PASS='secret' run: | cpanm -v cpanm --notest Module::Install @@ -57,6 +75,10 @@ jobs: cpanm --notest Text::CSV cpanm --notest Time::Piece::MySQL + apt-get install libpq-dev + + cpanm --notest DBD::Pg + - name: Show Errors on Ubuntu if: ${{ failure() && startsWith( matrix.runner, 'ubuntu-')}} run: | From a03f3a5c6d627e931c87fcecf8b78ccc502d0e41 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 19:35:39 +0300 Subject: [PATCH 4/6] move env --- .github/workflows/with_pg.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/with_pg.yaml b/.github/workflows/with_pg.yaml index b1e782a17..1468d5062 100644 --- a/.github/workflows/with_pg.yaml +++ b/.github/workflows/with_pg.yaml @@ -39,10 +39,6 @@ jobs: perl -v - name: Install Modules - env: - DBICTEST_PG_DSN='dbi:Pg:database=dbic_test;host=postgres_service' - DBICTEST_PG_USER='dbic_user' - DBICTEST_PG_PASS='secret' run: | cpanm -v cpanm --notest Module::Install @@ -88,6 +84,9 @@ jobs: env: AUTHOR_TESTING: 1 RELEASE_TESTING: 1 + DBICTEST_PG_DSN: 'dbi:Pg:database=dbic_test;host=postgres_service' + DBICTEST_PG_USER: 'dbic_user' + DBICTEST_PG_PASS: 'secret' run: | perl Makefile.PL make From 757062df03efec297f7ce0d848d37f3bb97bfc4e Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 19:37:15 +0300 Subject: [PATCH 5/6] pg version --- .github/workflows/with_pg.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/with_pg.yaml b/.github/workflows/with_pg.yaml index 1468d5062..e91c3e51e 100644 --- a/.github/workflows/with_pg.yaml +++ b/.github/workflows/with_pg.yaml @@ -13,6 +13,7 @@ jobs: fail-fast: false matrix: perl: [ '5.36' ] + postgres: [ 'latest' ] services: postgres_service: From 263b944f56ce0ad5a39c9f59c5e3893bd5ff7e49 Mon Sep 17 00:00:00 2001 From: Gabor Szabo Date: Tue, 28 Mar 2023 19:50:28 +0300 Subject: [PATCH 6/6] split steps; add prove --- .github/workflows/with_pg.yaml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/with_pg.yaml b/.github/workflows/with_pg.yaml index e91c3e51e..e562c6d84 100644 --- a/.github/workflows/with_pg.yaml +++ b/.github/workflows/with_pg.yaml @@ -81,6 +81,21 @@ jobs: run: | cat /home/runner/.cpanm/work/*/build.log + - name: Run make + run: | + perl Makefile.PL + make + + - name: Run tests with prove + env: + AUTHOR_TESTING: 1 + RELEASE_TESTING: 1 + DBICTEST_PG_DSN: 'dbi:Pg:database=dbic_test;host=postgres_service' + DBICTEST_PG_USER: 'dbic_user' + DBICTEST_PG_PASS: 'secret' + run: | + prove -lv t/50fork.t + - name: Run tests env: AUTHOR_TESTING: 1 @@ -89,7 +104,5 @@ jobs: DBICTEST_PG_USER: 'dbic_user' DBICTEST_PG_PASS: 'secret' run: | - perl Makefile.PL - make make test