From 8a6969b0228da0adc4ff2c80b605b69724a2c913 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 15 Jul 2025 16:47:03 -0700 Subject: [PATCH 01/12] ci: add windows exe build --- .github/workflows/release.yaml | 43 ++++++++++++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d3d04ec..9a714a0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -7,14 +7,14 @@ on: jobs: build-tag-release: - name: Build, tag, and release Docker image + name: Build, tag, and release Docker image and Windows executable runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Setup release please - uses: google-github-actions/release-please-action@v2 + uses: googleapis/release-please-action@v4 id: release with: token: ${{ secrets.GITHUB_TOKEN }} @@ -22,6 +22,45 @@ jobs: changelog-path: CHANGELOG.md package-name: zap2xml + - name: Setup Perl for Windows build + if: ${{ steps.release.outputs.release_created }} + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: "5.42" + + - name: Install Perl dependencies for Windows build + if: ${{ steps.release.outputs.release_created }} + run: | + cpanm --notest PAR::Packer + cpanm --notest Compress::Zlib + cpanm --notest Encode + cpanm --notest File::Basename + cpanm --notest File::Copy + cpanm --notest Getopt::Std + cpanm --notest HTTP::Cookies + cpanm --notest URI + cpanm --notest URI::Escape + cpanm --notest LWP::UserAgent + cpanm --notest LWP::ConnCache + cpanm --notest POSIX + cpanm --notest Time::Local + cpanm --notest Time::Piece + cpanm --notest JSON + + - name: Build Windows executable + if: ${{ steps.release.outputs.release_created }} + run: pp -o zap2xml.exe zap2xml.pl + + - name: Upload Windows executable to release + if: ${{ steps.release.outputs.release_created }} + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @zap2xml.exe \ + "${{ steps.release.outputs.upload_url }}?name=zap2xml.exe&label=Windows%20Executable" + - name: Login into GitHub Container Registry if: ${{ steps.release.outputs.release_created }} run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin From 06704f18973dc47edbbf0530bd6c03f8b3e7a1aa Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 15 Jul 2025 16:51:36 -0700 Subject: [PATCH 02/12] ci: build exe and update nightly --- .github/workflows/ci.yaml | 42 ++++++++++++++++++++++++-- .github/workflows/nightly-release.yaml | 38 ++++++++++++----------- 2 files changed, 60 insertions(+), 20 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0c0dff6..f5742b1 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,14 +1,52 @@ name: Continuous Integration + on: pull_request: branches: - main + jobs: - build: + build-docker: name: Build runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 + - name: Build service run: docker build . + + build-windows: + name: Build Windows executable + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Perl for Windows build + if: ${{ steps.release.outputs.release_created }} + uses: shogo82148/actions-setup-perl@v1 + with: + perl-version: "5.42" + + - name: Install Perl dependencies for Windows build + if: ${{ steps.release.outputs.release_created }} + run: | + cpanm --notest PAR::Packer + cpanm --notest Compress::Zlib + cpanm --notest Encode + cpanm --notest File::Basename + cpanm --notest File::Copy + cpanm --notest Getopt::Std + cpanm --notest HTTP::Cookies + cpanm --notest URI + cpanm --notest URI::Escape + cpanm --notest LWP::UserAgent + cpanm --notest LWP::ConnCache + cpanm --notest POSIX + cpanm --notest Time::Local + cpanm --notest Time::Piece + cpanm --notest JSON + + - name: Build Windows executable + run: pp -o zap2xml.exe zap2xml.pl diff --git a/.github/workflows/nightly-release.yaml b/.github/workflows/nightly-release.yaml index 306bdcd..1b6e97e 100644 --- a/.github/workflows/nightly-release.yaml +++ b/.github/workflows/nightly-release.yaml @@ -1,38 +1,40 @@ name: Nightly Release + on: schedule: - - cron: '0 0 * * *' + - cron: "0 0 * * *" workflow_dispatch: {} + jobs: - check-date: - name: Check dates + nightly-release: + name: Nightly Build and Release Docker image (if code changed in 24h) runs-on: ubuntu-latest - outputs: - should-run: ${{ steps.code-change.outputs.should-run }} steps: - name: Checkout repository - uses: actions/checkout@v2 - - name: Check if code has changed with 24 hours - continue-on-error: true + uses: actions/checkout@v4 + + - name: Check if code has changed within 24 hours id: code-change run: | - [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]] && echo "::set-output name=should-run::true" - build-release: - name: Build and release Docker image - runs-on: ubuntu-latest - needs: check-date - if: needs.check-date.outputs.should-run == 'true' - steps: - - name: Checkout repository - uses: actions/checkout@v2 + if [[ $(git rev-list --after="24 hours" --first-parent HEAD) ]]; then + echo "should-run=true" >> $GITHUB_OUTPUT + else + echo "should-run=false" >> $GITHUB_OUTPUT + fi + - name: Login into GitHub Container Registry - run: echo ${{ secrets.CR_PAT }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + if: steps.code-change.outputs.should-run == 'true' + run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin + - name: Build Docker image + if: steps.code-change.outputs.should-run == 'true' run: | docker build \ -t "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" \ -t "ghcr.io/${GITHUB_REPOSITORY}:nightly" . + - name: Release Docker image + if: steps.code-change.outputs.should-run == 'true' run: | docker push "ghcr.io/${GITHUB_REPOSITORY}:${GITHUB_SHA:0:7}" docker push "ghcr.io/${GITHUB_REPOSITORY}:nightly" From e0da370d09175b5ea7be4d02adb1790d575a188f Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 15 Jul 2025 16:53:27 -0700 Subject: [PATCH 03/12] ci: remove ifs --- .github/workflows/ci.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f5742b1..b55e782 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,13 +24,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Perl for Windows build - if: ${{ steps.release.outputs.release_created }} uses: shogo82148/actions-setup-perl@v1 with: perl-version: "5.42" - name: Install Perl dependencies for Windows build - if: ${{ steps.release.outputs.release_created }} run: | cpanm --notest PAR::Packer cpanm --notest Compress::Zlib From dc61a7d1ab2a6b35a933bef4b346e56e1cf0ad5d Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 15 Jul 2025 16:57:29 -0700 Subject: [PATCH 04/12] ci: use 5.40 --- .github/workflows/ci.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b55e782..b492bc7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,7 +26,7 @@ jobs: - name: Setup Perl for Windows build uses: shogo82148/actions-setup-perl@v1 with: - perl-version: "5.42" + perl-version: "5.40" - name: Install Perl dependencies for Windows build run: | diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 9a714a0..69278f7 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -26,7 +26,7 @@ jobs: if: ${{ steps.release.outputs.release_created }} uses: shogo82148/actions-setup-perl@v1 with: - perl-version: "5.42" + perl-version: "5.40" - name: Install Perl dependencies for Windows build if: ${{ steps.release.outputs.release_created }} From 3d47419334086c69eca0e99d7bcf82727d94913f Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Tue, 15 Jul 2025 17:00:53 -0700 Subject: [PATCH 05/12] ci: cache for testing --- .github/workflows/ci.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b492bc7..e4eccff 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -48,3 +48,9 @@ jobs: - name: Build Windows executable run: pp -o zap2xml.exe zap2xml.pl + + - name: Cache once for testing + uses: actions/upload-artifact@v4 + with: + path: zap2xml.exe + retention-days: 1 From f9a9866356c3681b4fd0c0617b1b38c9a0ebdfec Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 09:37:37 -0700 Subject: [PATCH 06/12] ci: update deps and build --- .github/workflows/ci.yaml | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e4eccff..503c63e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,25 +29,10 @@ jobs: perl-version: "5.40" - name: Install Perl dependencies for Windows build - run: | - cpanm --notest PAR::Packer - cpanm --notest Compress::Zlib - cpanm --notest Encode - cpanm --notest File::Basename - cpanm --notest File::Copy - cpanm --notest Getopt::Std - cpanm --notest HTTP::Cookies - cpanm --notest URI - cpanm --notest URI::Escape - cpanm --notest LWP::UserAgent - cpanm --notest LWP::ConnCache - cpanm --notest POSIX - cpanm --notest Time::Local - cpanm --notest Time::Piece - cpanm --notest JSON + run: cpan -i PAR PAR::Dist PAR::Packer - name: Build Windows executable - run: pp -o zap2xml.exe zap2xml.pl + run: pp -M sub::Util -o zap2xml.exe zap2xml.pl - name: Cache once for testing uses: actions/upload-artifact@v4 From fb75c9f6670f9e7146bf9bcb78d56928949b2cbb Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 09:44:53 -0700 Subject: [PATCH 07/12] ci: install sub::Util --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 503c63e..7e835e2 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,7 +29,7 @@ jobs: perl-version: "5.40" - name: Install Perl dependencies for Windows build - run: cpan -i PAR PAR::Dist PAR::Packer + run: cpan -i PAR PAR::Dist PAR::Packer sub::Util - name: Build Windows executable run: pp -M sub::Util -o zap2xml.exe zap2xml.pl From f4a3ef0e895344335c01ea8e3a795e31027af26f Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 09:47:36 -0700 Subject: [PATCH 08/12] ci: use cpanm --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7e835e2..8aa7104 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -7,7 +7,7 @@ on: jobs: build-docker: - name: Build + name: Build Docker runs-on: ubuntu-latest steps: - name: Checkout repository @@ -29,7 +29,7 @@ jobs: perl-version: "5.40" - name: Install Perl dependencies for Windows build - run: cpan -i PAR PAR::Dist PAR::Packer sub::Util + run: cpanm --install --notest PAR PAR::Dist PAR::Packer sub::Util - name: Build Windows executable run: pp -M sub::Util -o zap2xml.exe zap2xml.pl From a08b49bd980174befa9c9a8d6eeb810ba2a86785 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 09:50:53 -0700 Subject: [PATCH 09/12] ci: old --- .github/workflows/ci.yaml | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8aa7104..579f9ae 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,10 +29,25 @@ jobs: perl-version: "5.40" - name: Install Perl dependencies for Windows build - run: cpanm --install --notest PAR PAR::Dist PAR::Packer sub::Util + run: | + cpanm --notest PAR::Packer + cpanm --notest Compress::Zlib + cpanm --notest Encode + cpanm --notest File::Basename + cpanm --notest File::Copy + cpanm --notest Getopt::Std + cpanm --notest HTTP::Cookies + cpanm --notest URI + cpanm --notest URI::Escape + cpanm --notest LWP::UserAgent + cpanm --notest LWP::ConnCache + cpanm --notest POSIX + cpanm --notest Time::Local + cpanm --notest Time::Piece + cpanm --notest JSON - name: Build Windows executable - run: pp -M sub::Util -o zap2xml.exe zap2xml.pl + run: pp -o zap2xml.exe zap2xml.pl - name: Cache once for testing uses: actions/upload-artifact@v4 From b40cfafaa37d211a9f86c4990f8f7e2ed64a9f26 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 10:36:58 -0700 Subject: [PATCH 10/12] ci: entrypoint for windows, build on windows machine --- .github/workflows/ci.yaml | 13 ++++++++++--- entrypoint.bat | 11 +++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 entrypoint.bat diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 579f9ae..f6632eb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -18,7 +18,7 @@ jobs: build-windows: name: Build Windows executable - runs-on: ubuntu-latest + runs-on: windows-latest steps: - name: Checkout repository uses: actions/checkout@v4 @@ -49,8 +49,15 @@ jobs: - name: Build Windows executable run: pp -o zap2xml.exe zap2xml.pl - - name: Cache once for testing + - name: Copy entrypoint.bat + run: | + copy entrypoint.bat dist\entrypoint.bat + copy zap2xml.exe dist\zap2xml.exe + shell: cmd + + - name: Upload Windows artifacts uses: actions/upload-artifact@v4 with: - path: zap2xml.exe + name: zap2xml-windows + path: dist/ retention-days: 1 diff --git a/entrypoint.bat b/entrypoint.bat new file mode 100644 index 0000000..300df24 --- /dev/null +++ b/entrypoint.bat @@ -0,0 +1,11 @@ +@echo off +:loop +set DATESTR=%DATE% %TIME% +echo Running zap2xml.exe at %DATESTR% +zap2xml.exe %OPT_ARGS% +echo Last run time: %DATESTR% +echo Will run again in %SLEEPTIME% seconds +REM Default sleep time if not set +if "%SLEEPTIME%"=="" set SLEEPTIME=43200 +powershell -Command "Start-Sleep -Seconds %SLEEPTIME%" +goto loop From 5905a3a6da98f88d7fb907fb98a4cd686b329341 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 10:41:09 -0700 Subject: [PATCH 11/12] Update ci.yaml --- .github/workflows/ci.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index f6632eb..379b797 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -51,6 +51,7 @@ jobs: - name: Copy entrypoint.bat run: | + mkdir dist copy entrypoint.bat dist\entrypoint.bat copy zap2xml.exe dist\zap2xml.exe shell: cmd From 6c911cf8600154dda2f9f2408bc89d394aaada00 Mon Sep 17 00:00:00 2001 From: Jef LeCompte Date: Wed, 16 Jul 2025 10:48:06 -0700 Subject: [PATCH 12/12] Update ci.yaml --- .github/workflows/ci.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 379b797..df8d88e 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,6 +45,7 @@ jobs: cpanm --notest Time::Local cpanm --notest Time::Piece cpanm --notest JSON + cpanm --notest Sub::Util - name: Build Windows executable run: pp -o zap2xml.exe zap2xml.pl @@ -52,6 +53,7 @@ jobs: - name: Copy entrypoint.bat run: | mkdir dist + copy .zap2xml-example dist\.zap2xml-example copy entrypoint.bat dist\entrypoint.bat copy zap2xml.exe dist\zap2xml.exe shell: cmd