Skip to content

Dashboard needs IPC::Run3 #12

Dashboard needs IPC::Run3

Dashboard needs IPC::Run3 #12

Workflow file for this run

---
# Create https://nigelhorne.github.io/Geo-Coder-Free/coverage/
name: Test Dashboard
permissions:
contents: write # needed to push to gh-pages
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
perl: ["5.40"]
steps:
# Checkout repository
- uses: actions/checkout@v6
with:
fetch-depth: 0
# Install Perl via perlbrew
- name: Setup Perl
uses: shogo82148/actions-setup-perl@v1
with:
perl-version: ${{ matrix.perl }}
# install cpanminus
# cpanm-options: --notest
- name: Update Ubuntu Packages
run: |
sudo apt-get update
sudo apt-get -y upgrade
sudo apt install libdb-dev build-essential
if: runner.os == 'Linux'
- name: Upgrade Toolchain
run: cpanm -iqn ExtUtils::MakeMaker Module::Build
# Install module dependencies (from cpanfile or manually)
- name: Install dependencies
run: |
cpanm --configure-timeout=600 --notest --verbose --installdeps .
cpanm -iqn Test::Most Devel::Cover Devel::Cover::Report::Html POSIX File::Glob File::Slurp File::stat Readonly
cpanm -iqn IPC::System::Simple WWW::RT::CPAN IPC::Run3
cpanm -iqn --skip-satisfied HTML::Entities LWP::Protocol::https Log::Any::Adapter::Log4perl Template::Filters Template::Plugin::EnvHash HTML::SocialMedia
cpanm --iqn --skip-satisfied Template::Plugin::JSON
timeout-minutes: 10
# Optional: run Perl::Critic static checks
# - name: Run Perl::Critic
# run: |
# cpanm Perl::Critic
# perlcritic --verbose 5 lib || true
- name: Run tests manually
env:
AUTOMATED_TESTING: 1
NO_NETWORK_TESTING: 1
NONINTERACTIVE_TESTING: 1
run: |
prove -l -b -v t
# Run the tests with Devel::Cover for coverage
- name: Run tests with coverage
env:
PERL5LIB: ${{ github.workspace }}/local/lib/perl5
COVER_VERBOSE: 1
AUTOMATED_TESTING: 1
NO_NETWORK_TESTING: 1
NONINTERACTIVE_TESTING: 1
working-directory: ${{ github.workspace }}
run: |
perl Makefile.PL
cover -test
# Generate HTML coverage report
- name: Generate HTML report
run: |
mkdir -p cover_html
cover -report html -outputdir cover_html
# working-directory: ${{ github.workspace }}
- name: Check for HTML report
run: |
if [ ! -f cover_html/coverage.html ]; then
echo "HTML report not found. Skipping deployment."
exit 1
fi
- name: Rename coverage.html to index.html
run: |
mv cover_html/coverage.html cover_html/index.html
- name: Generate custom coverage index
run: |
mkdir -p cover_db
# cover -dump > cover_db/cover.json
cover -report json -outputdir cover_db
perl scripts/generate_index.pl
- name: Archive coverage snapshot
run: |
mkdir -p coverage_history
TIMESTAMP=$(date +%Y-%m-%d)
SHA=$(git rev-parse --short HEAD)
cp cover_db/cover.json "coverage_history/${TIMESTAMP}-${SHA}.json"
# Remove older history
# ls -t coverage_history/*.json | tail -n +31 | xargs rm -f
- name: Commit coverage snapshot
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@github.com"
git add coverage_history/
git commit -m "Add coverage snapshot for $TIMESTAMP ($SHA)" || echo "No changes to commit"
git push origin HEAD:${{ github.ref_name }}
# Deploy HTML report to GitHub Pages
- name: Publish coverage report
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./cover_html
destination_dir: coverage
user_name: github-actions
user_email: github-actions@github.com
keep_files: true