Skip to content

Commit

Permalink
CI: Update workflow to support container selection
Browse files Browse the repository at this point in the history
Update the primary CI workflow (renamed from 'main.yml' to 'ci.yml')
to also build for PRs and pushes targeting branches with names of the
form `backports/gnome-*`, and select the corresponding image from
`GSConnect/gsconnect-ci` tagged as `gnome-##`.

This will allow testing branches against GNOME versions other than the
default/current, without requiring separate workflows with near-duplicate
content like the previous `gnome-3-3[68].yml`. (Those are deleted.)
  • Loading branch information
ferdnyc committed Feb 28, 2025
1 parent a1c4493 commit 9960267
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 156 deletions.
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# SPDX-FileCopyrightText: GSConnect Developers https://github.com/GSConnect
#
# SPDX-License-Identifier: GPL-2.0-or-later

name: CI

on:
push:
branches:
- main
- 'backports/gnome-*'
pull_request:
branches:
- main
- 'backports/gnome-*'
workflow_dispatch:

jobs:
select:
runs-on: ubuntu-latest
outputs:
image_id: ${{ steps.select-image.outputs.image_id }}
steps:
- id: step1
if: ${{ ! startsWith(github.event_name, 'pull_request') }}
run: echo "target=${{ github.ref_name }}" >> $GITHUB_OUTPUT
- id: step2
if: ${{ startsWith(github.event_name, 'pull_request') }}
run: echo "target=${{ github.base_ref }}" >> $GITHUB_OUTPUT
- id: select-image
env:
TARGET_BRANCH: ${{ steps.step1.outputs.target || steps.step2.outputs.target }}
run: |
if [[ \
${{ startsWith(env.TARGET_BRANCH, 'backports/') && 1 || 0 }} == 1 \
]]; then
IMAGE_ID=$(echo "$TARGET_BRANCH" | sed -e 's,^backports/,,')
echo "image_id=$IMAGE_ID" >> $GITHUB_OUTPUT
else
echo "image_id=latest" >> $GITHUB_OUTPUT
fi
test:
needs: select
runs-on: ubuntu-latest
container:
image: ghcr.io/gsconnect/gsconnect-ci:${{ needs.select.outputs.image_id }}
steps:
- uses: actions/checkout@v4
- name: Prepare
run: |
meson --prefix=/usr \
--libdir=lib/ \
-Dgnome_shell_libdir=/usr/lib64/ \
_build
- name: Uninstalled Tests
run: |
meson test -C _build --suite gsconnect:data \
--suite gsconnect:lint \
--print-errorlogs
- name: Installed Tests
run: |
ninja -C _build install
xvfb-run -a dbus-run-session -- \
gnome-desktop-testing-runner gsconnect -L _build/meson-logs
- name: Upload Test Logs
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: test-logs
path: _build/meson-logs

- name: Test Build
run: |
ninja -C _build make-zip
- name: Stage packaged extension
run: |
ninja -C _build make-pkgdir
- name: Create and upload packaged artifact
uses: actions/upload-artifact@v3
with:
name: gsconnect@andyholmes.github.io
path: _build/gsconnect@andyholmes.github.io/

51 changes: 0 additions & 51 deletions .github/workflows/gnome-3-36.yml

This file was deleted.

51 changes: 0 additions & 51 deletions .github/workflows/gnome-3-38.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/main.yml

This file was deleted.

0 comments on commit 9960267

Please # to comment.