Debian Codegraph @

.github/workflows/test-and-pack-docker.yml

raw symbols SCIP
1 # ----------------------------------------------------------------------------
2 # GitHub Action workflow to
3 #
4 # - test CGE compilation and automatic tests (using various FPC versions available in Docker)
5 # - pack CGE into zip (using only stable FPC, since our pack_release checks it)
6 #
7 # Uses CGE Docker image https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/
8 # inside GH hosted runner.
9 #
10 # See https://docs.github.com/en/actions for docs.
11 # ----------------------------------------------------------------------------
12
13 name: Test And Pack (Docker)
14
15 # Called by everything.yml
16 on: [workflow_call]
17 #on: [push, pull_request]
18
19 defaults:
20 run:
21 shell: bash
22
23 jobs:
24 test-docker-base:
25 strategy:
26 matrix:
27 fpc-name: [stable, fpc320, fpc331]
28 include:
29 - fpc-name: stable
30 docker-tag: cge-none
31 - fpc-name: fpc320
32 docker-tag: cge-none-fpc320
33 - fpc-name: fpc331
34 docker-tag: cge-none-fpc331
35 name: Base Tests
36 runs-on: ubuntu-latest
37 # Use Docker image with CGE prerequisites (FPC, Lazarus, Android tools etc.)
38 # See https://hub.docker.com/r/kambi/castle-engine-cloud-builds-tools/ .
39 container: kambi/castle-engine-cloud-builds-tools:${{ matrix.docker-tag }}
40 steps:
41 - uses: actions/checkout@v4
42 # Set env CASTLE_ENGINE_PATH following
43 # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
44 # https://brandur.org/fragments/github-actions-env-vars-in-env-vars
45 - name: Set environment
46 run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
47 - name: Build Tools
48 run: make clean default
49 - name: Build And Run Auto-Tests
50 run: make clean tests
51 # fpmake compilation with FPC 3.3.1 from 2022-12-27 is broken,
52 # TODO investigate and report.
53 - name: Build Using FpMake
54 if: ${{ matrix.fpc-name != 'fpc331' }}
55 run: make clean test-fpmake
56 - name: Test CastleWindow backends
57 run: ./tools/internal/check_castle_window_backends_compilation
58 - name: Test build tool --output
59 run: ./tools/internal/check_build_tool_output
60 - name: Test LPG (Lazarus Package Group)
61 run: ./tools/internal/check_lpg_compilation
62
63 test-docker-examples:
64 strategy:
65 matrix:
66 fpc-name: [stable, fpc320, fpc331]
67 include:
68 - fpc-name: stable
69 docker-tag: cge-none
70 - fpc-name: fpc320
71 docker-tag: cge-none-fpc320
72 - fpc-name: fpc331
73 docker-tag: cge-none-fpc331
74 name: Examples
75 runs-on: ubuntu-latest
76 container: kambi/castle-engine-cloud-builds-tools:cge-none
77 steps:
78 - uses: actions/checkout@v4
79 - name: Set environment
80 run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
81 - name: Build Examples
82 run: make clean examples CASTLE_CONSERVE_DISK_SPACE=true
83
84 test-docker-examples-laz:
85 strategy:
86 matrix:
87 fpc-name: [stable, fpc320, fpc331]
88 include:
89 - fpc-name: stable
90 docker-tag: cge-none
91 - fpc-name: fpc320
92 docker-tag: cge-none-fpc320
93 - fpc-name: fpc331
94 docker-tag: cge-none-fpc331
95 name: Examples Using Lazarus
96 runs-on: ubuntu-latest
97 container: kambi/castle-engine-cloud-builds-tools:cge-none
98 steps:
99 - uses: actions/checkout@v4
100 - name: Set environment
101 run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
102
103 # Avoids GIT errors
104 # fatal: detected dubious ownership in repository at '/__w/castle-engine/castle-engine'
105 # To add an exception for this directory, call:
106 # git config --global --add safe.directory /__w/castle-engine/castle-engine
107 #
108 # See https://stackoverflow.com/questions/72978485/git-submodule-update-failed-with-fatal-detected-dubious-ownership-in-repositor
109 # https://github.com/git/git/commit/8959555cee7ec045958f9b6dd62e541affb7e7d9
110 # These errors occur during "examples-laz" because it executes "git clean" to do
111 # CASTLE_CONSERVE_DISK_SPACE job.
112 #
113 - name: Avoid GIT dubious ownership errors
114 run: git config --global --add safe.directory /__w/castle-engine/castle-engine
115
116 - name: Build Examples Using Lazarus (FPC / Lazarus Stable)
117 run: make clean examples-laz CASTLE_CONSERVE_DISK_SPACE=true
118
119
120 pack_1:
121 name: Pack to zip (1)
122 runs-on: ubuntu-latest
123 container: kambi/castle-engine-cloud-builds-tools:cge-none
124 steps:
125 - uses: actions/checkout@v4
126 - name: Set environment
127 run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
128 - name: Remove previous artifacts
129 run: rm -f castle-engine*.zip
130
131 - name: Pack Win64/x86_64
132 run: ./tools/internal/pack_release/pack_release.sh win64 x86_64
133 - name: Pack Win32/i386
134 run: ./tools/internal/pack_release/pack_release.sh win32 i386
135 - name: Pack Linux/x86_64
136 run: ./tools/internal/pack_release/pack_release.sh linux x86_64
137
138 - name: Archive Artifacts
139 uses: actions/upload-artifact@v4
140 with:
141 name: windows-and-linux-release-from-docker-1
142 path: "castle-engine*.zip"
143 if-no-files-found: error
144
145 # We split pack into two jobs to avoid running out of disk space
146 # on GH hosted runners, no other reason.
147 pack_2:
148 name: Pack to zip (2)
149 runs-on: ubuntu-latest
150 container: kambi/castle-engine-cloud-builds-tools:cge-none
151 steps:
152 - uses: actions/checkout@v4
153 - name: Set environment
154 run: echo "CASTLE_ENGINE_PATH=$GITHUB_WORKSPACE" >> $GITHUB_ENV
155
156 - name: Download bundled FPC
157 uses: robinraju/[email protected]
158 with:
159 repository: "castle-engine/cge-fpc"
160 latest: true
161 # Docs suggest we need a wildcard to get all files: https://github.com/marketplace/actions/release-downloader
162 fileName: "*"
163 - name: Pack With Bundled FPC for Win64/x86_64
164 run: CGE_PACK_BUNDLE=yes ./tools/internal/pack_release/pack_release.sh win64 x86_64
165 - name: Pack With Bundled FPC for Linux/x86_64
166 run: CGE_PACK_BUNDLE=yes ./tools/internal/pack_release/pack_release.sh linux x86_64
167
168 - name: Archive Artifacts
169 uses: actions/upload-artifact@v4
170 with:
171 name: windows-and-linux-release-from-docker-2
172 path: "castle-engine*.zip"
173 if-no-files-found: error