Skip to content

Commit dffb838

Browse files
Add: GitHub Action
This will replace the Travis build system
1 parent 012d85b commit dffb838

File tree

1 file changed

+128
-0
lines changed

1 file changed

+128
-0
lines changed

.github/workflows/cicd.yml

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: CI/CD with Lazarus IDE on multiple operating systems.
2+
3+
permissions:
4+
contents: write
5+
6+
on:
7+
push:
8+
pull_request:
9+
workflow_dispatch:
10+
# Automatic cron build every 6 months to check if everything still works.
11+
schedule:
12+
- cron: "0 0 1 1/6 *"
13+
14+
jobs:
15+
build:
16+
runs-on: ${{ matrix.os }}
17+
18+
strategy:
19+
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
20+
fail-fast: false
21+
22+
# Set up an array to perform the following three build configurations.
23+
matrix:
24+
os: [ubuntu-latest, windows-latest, macos-latest]
25+
include:
26+
- os: windows-latest
27+
LAZBUILD_WITH_PATH: c:/lazarus/lazbuild
28+
RELEASE_ZIP_FILE: trackereditor_windows_amd64.zip
29+
LAZ_OPT:
30+
- os: ubuntu-latest
31+
LAZBUILD_WITH_PATH: lazbuild
32+
RELEASE_ZIP_FILE: trackereditor_linux_amd64.zip
33+
LAZ_OPT:
34+
- os: macos-latest
35+
LAZBUILD_WITH_PATH: /Applications/Lazarus/lazbuild
36+
RELEASE_ZIP_FILE: trackereditor_UNSIGNED_macOS_Intel_64.zip
37+
LAZ_OPT: --widgetset=cocoa
38+
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: show LAZBUILD_WITH_PATH (deprecated)
43+
if: ${{ matrix.LAZBUILD_WITH_PATH }}
44+
shell: bash
45+
run: echo ${{ matrix.LAZBUILD_WITH_PATH }}
46+
47+
- name: Install Lazarus IDE
48+
run: |
49+
if [ "$RUNNER_OS" == "Linux" ]; then
50+
sudo apt install -y lazarus zip
51+
elif [ "$RUNNER_OS" == "Windows" ]; then
52+
choco install lazarus zip
53+
# https://wiki.overbyte.eu/wiki/index.php/ICS_Download#Download_OpenSSL_Binaries
54+
curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/Renesas-RX-GCC/releases/latest/download/libssl-3-x64.dll
55+
curl -L -O --output-dir enduser https://github.com/GerryFerdinandus/Renesas-RX-GCC/releases/latest/download/libcrypto-3-x64.dll
56+
elif [ "$RUNNER_OS" == "macOS" ]; then
57+
brew install --cask lazarus
58+
else
59+
echo "$RUNNER_OS not supported"
60+
exit 1
61+
fi
62+
shell: bash
63+
64+
- name: Build Release version
65+
# Build trackereditor project (Release mode)
66+
run: ${{ matrix.LAZBUILD_WITH_PATH }} --build-mode=Release ${{ matrix.LAZ_OPT }} source/project/tracker_editor/trackereditor.lpi
67+
shell: bash
68+
69+
- name: Build Unit Test
70+
# Build unit test project (Debug mode)
71+
run: ${{ matrix.LAZBUILD_WITH_PATH }} --build-mode=Debug ${{ matrix.LAZ_OPT }} source/project/unit_test/tracker_editor_test.lpi
72+
shell: bash
73+
74+
- name: Run Unit Test on Windows
75+
if: matrix.os == 'windows-latest'
76+
# Also remove all the extra file created by test.
77+
# We do not what it in the ZIP release files.
78+
# Undo all changes made by testing.
79+
run: |
80+
set -e
81+
enduser/test_trackereditor -a --format=plain
82+
set +e
83+
84+
# remove file created by unit test
85+
rm -f enduser/console_log.txt
86+
rm -f enduser/export_trackers.txt
87+
git reset --hard
88+
shell: bash
89+
90+
- name: Create a zip file for Linux release.
91+
if: matrix.os == 'ubuntu-latest'
92+
run: zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor
93+
shell: bash
94+
95+
- name: Create a zip file for Windows release.
96+
if: matrix.os == 'windows-latest'
97+
run: |
98+
zip -j ${{ matrix.RELEASE_ZIP_FILE }} enduser/*.txt enduser/trackereditor.exe enduser/*.dll
99+
shell: bash
100+
101+
- name: Create a zip file for macOS .app release. (unsigned macOS app)
102+
if: matrix.os == 'macos-latest'
103+
run: |
104+
# copy everything into enduser/macos/app folder
105+
#
106+
# Move the executable to the application bundle
107+
mv enduser/trackereditor enduser/macos/app/trackereditor.app/Contents/MacOS
108+
# Move the trackers list to application bundle
109+
mv enduser/add_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
110+
mv enduser/remove_trackers.txt enduser/macos/app/trackereditor.app/Contents/MacOS
111+
# move all the *.txt file
112+
mv enduser/*.txt enduser/macos/app
113+
# zip only the app folder with extra text file.
114+
/usr/bin/ditto -c -k "enduser/macos/app" "${{ matrix.RELEASE_ZIP_FILE }}"
115+
shell: bash
116+
117+
- name: Upload Artifact
118+
uses: actions/upload-artifact@v3
119+
with:
120+
path: ${{ matrix.RELEASE_ZIP_FILE }}
121+
if-no-files-found: error # 'warn'. error
122+
123+
- name: Zip file release to end user
124+
uses: softprops/action-gh-release@v1
125+
if: startsWith(github.ref, 'refs/tags/')
126+
with:
127+
files: |
128+
*.zip

0 commit comments

Comments
 (0)