CI/CD on Windows systems. #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD on Windows systems. | |
permissions: | |
contents: write | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
# Automatic cron build every 6 months to check if everything still works. | |
schedule: | |
- cron: "0 0 1 1/6 *" | |
jobs: | |
build: | |
runs-on: windows-2022 | |
timeout-minutes: 60 | |
env: | |
LAZBUILD_WITH_PATH: c:/lazarus/lazbuild | |
RELEASE_ZIP_FILE: trackereditor_windows_amd64.zip | |
LAZ_OPT: | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Install winget | |
# winget will be included in windows server 2025 | |
uses: Cyberboss/install-winget@v1 | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install Lazarus IDE | |
run: winget install lazarus --disable-interactivity --accept-source-agreements --silent | |
- name: Download OpenSSL *.dll | |
run: | | |
# Need OpenSSL *.dll to download updated trackers from the internet. | |
# https://wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries | |
curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/libssl-3-x64.dll | |
curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/bittorrent-tracker-editor/releases/download/V1.32.0/libcrypto-3-x64.dll | |
shell: bash | |
- name: Build Release version | |
# Build trackereditor project (Release mode) | |
run: ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Release ${{ env.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi | |
shell: bash | |
- name: Build Unit Test on Windows | |
# Build unit test project (Debug mode) | |
run: ${{ env.LAZBUILD_WITH_PATH }} --build-all --build-mode=Debug ${{ env.LAZ_OPT }} source/project/unit_test/tracker_editor_test.lpi | |
shell: bash | |
- name: Run Unit Test on Windows | |
# Also remove all the extra file created by test. | |
# We do not what it in the ZIP release files. | |
# Undo all changes made by testing. | |
run: | | |
set -e | |
enduser/test_trackereditor -a --format=plain | |
set +e | |
# remove file created by unit test | |
rm -f enduser/console_log.txt | |
rm -f enduser/export_trackers.txt | |
git reset --hard | |
shell: bash | |
- name: Create a zip file for Windows release. | |
run: | | |
Compress-Archive -Path enduser\*.txt, enduser\trackereditor.exe, enduser\*.dll -DestinationPath $Env:RELEASE_ZIP_FILE | |
shell: pwsh | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-${{ runner.os }} | |
path: ${{ env.RELEASE_ZIP_FILE }} | |
compression-level: 0 # no compression. Content is already a zip file | |
if-no-files-found: error | |
- name: File release to end user | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: ${{ env.RELEASE_ZIP_FILE }} |