2 # Copyright: 2021, The Geany contributors
3 # License: GNU GPL v2 or later
16 # cancel already running builds of the same branch or pull request
18 group: ci-${{ github.head_ref }} || concat(${{ github.ref }}
19 cancel-in-progress: true
22 CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration
23 CCACHE_DIR: ${{ github.workspace }}/.ccache
32 name: Linux Build (BINRELOC=${{ matrix.binreloc }})
43 CONFIGURE_FLAGS: --enable-binreloc=${{ matrix.binreloc }}
48 - uses: actions/checkout@v4
50 # create and use a timestamp for the cache key: GH Actions will never update a cache
51 # only use an existing cache item or create a new one. To use an existing cache *and*
52 # push back the the updated cache after build, we use a always new cache key (to force
53 # the creation of the cache item at the end) in combination with "restore-keys" as fallback
54 - name: Prepare ccache timestamp
55 id: ccache_cache_timestamp
56 run: echo "timestamp=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_OUTPUT
58 - name: Configure ccache
59 uses: actions/cache@v4
61 path: ${{ env.CCACHE_DIR }}
62 key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
63 restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-
65 - name: Show environment
67 if: ${{ env.DEBUG == '1' }}
69 - name: Install dependencies
71 sudo apt-get update -qq
72 sudo apt-get install --assume-yes --no-install-recommends \
84 NOCONFIGURE=1 ./autogen.sh
87 { ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; }
92 make -j ${{ env.JOBS }}
97 make -j ${{ env.JOBS }} check
102 make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="$CONFIGURE_FLAGS";
104 - name: ccache statistics
105 run: ccache --show-stats
106 if: ${{ env.DEBUG == '1' }}
109 name: Linux Meson Build
110 runs-on: ubuntu-20.04
120 - uses: actions/checkout@v4
122 # create and use a timestamp for the cache key: GH Actions will never update a cache
123 # only use an existing cache item or create a new one. To use an existing cache *and*
124 # push back the the updated cache after build, we use a always new cache key (to force
125 # the creation of the cache item at the end) in combination with "restore-keys" as fallback
126 - name: Prepare ccache timestamp
127 id: ccache_cache_timestamp
128 run: echo "timestamp=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_OUTPUT
130 - name: Configure ccache
131 uses: actions/cache@v4
133 path: ${{ env.CCACHE_DIR }}
134 key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
135 restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-
137 - name: Show environment
139 if: ${{ env.DEBUG == '1' }}
141 - name: Install dependencies
143 sudo apt-get update -qq
144 sudo apt-get install --assume-yes --no-install-recommends \
155 - name: Configuration
167 # distcheck not applicable, meson exports the source tree per git-archive
169 - name: ccache statistics
170 run: ccache --show-stats
171 if: ${{ env.DEBUG == '1' }}
174 name: Mingw-w64 Build (Windows)
175 runs-on: ubuntu-20.04
178 INFRASTRUCTURE_PATH: ${{ github.workspace }}/.infrastructure
179 BUILDER_PATH: ${{ github.workspace }}/.infrastructure/builders
180 DOCKER_REGISTRY: "ghcr.io"
181 DOCKER_IMAGE_NAME: "geany-mingw64-ci"
182 DOCKER_IMAGE_TAG: "ghcr.io/geany/geany-mingw64-ci:latest"
185 - name: Checkout Geany
186 uses: actions/checkout@v4
188 - name: Checkout Build Scripts
189 uses: actions/checkout@v4
192 repository: geany/infrastructure
193 path: ${{ env.INFRASTRUCTURE_PATH }}
194 token: ${{ github.token }}
196 - uses: jwalton/gh-find-current-pr@v1
197 id: find_pull_request
201 - name: Define environment variables
203 echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
204 echo "GITHUB_PULL_REQUEST=${GITHUB_PULL_REQUEST}" >> $GITHUB_ENV
205 echo "GITHUB_PULL_REQUEST_OR_REF=${GITHUB_PULL_REQUEST:-${{ github.ref_name }}}" | tr '/' '-' >> $GITHUB_ENV
207 GITHUB_PULL_REQUEST: ${{ steps.find_pull_request.outputs.pr }}
209 - name: Show Environment
210 if: ${{ env.DEBUG == '1' }}
214 - name: Log in to the Container registry
215 uses: docker/login-action@v3
217 registry: ${{ env.DOCKER_REGISTRY }}
218 username: ${{ github.actor }}
219 password: ${{ secrets.GITHUB_TOKEN }}
221 - name: Pull Or Build Docker Image
222 working-directory: ${{ env.BUILDER_PATH }}
224 docker_image_created=
225 docker pull ${{ env.DOCKER_IMAGE_TAG }} || true
226 if $(docker image inspect ${{ env.DOCKER_IMAGE_TAG }} --format="ignored" >/dev/null 2>&1); then
227 docker tag ${{ env.DOCKER_IMAGE_TAG }} ${{ env.DOCKER_IMAGE_NAME }}
228 docker_image_created=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
229 echo "Docker image built on: ${docker_image_created}"
232 bash start_build.sh --log-to-stdout --mingw64 --rebuild-images
233 docker_image_created_new=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
235 if [ "${docker_image_created}" != "${docker_image_created_new}" ]; then
236 docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_TAG }}
240 if: steps.geany_cache.outputs.cache-hit != 'true'
241 working-directory: ${{ env.BUILDER_PATH }}
243 bash start_build.sh --log-to-stdout --mingw64 --geany --geany-source "${{ github.workspace }}"
245 - name: Archive Geany Installer
246 uses: actions/upload-artifact@v4
248 name: geany-installer-ci-${{ env.SHORT_SHA }}-pr${{ env.GITHUB_PULL_REQUEST_OR_REF }}
251 ${{ env.BUILDER_PATH }}/output/mingw64/geany-*.exe
252 ${{ env.BUILDER_PATH }}/output/mingw64/geany-*.zip