-
Notifications
You must be signed in to change notification settings - Fork 25
148 lines (125 loc) · 4.41 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: CI
on: [push, pull_request]
jobs:
build:
# Perform a generic build in case of any critical errors
name: Build
runs-on: ubuntu-22.04
steps:
# Checks out under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4
- name: Check series file
run: |
for patch in $(ls *.patch); do
grep "$patch" series
if [ $? != 0 ]; then
echo "::error title=$patch::Patch is missing from series file"
exit 1
fi
done
- name: Get GTK Version
run: |
source PKGBUILD
echo "GTK_VERSION=${_gtkver}" >> $GITHUB_ENV
- name: Install Dependencies
run: |
echo "deb-src http://gb.archive.ubuntu.com/ubuntu/ focal main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get build-dep gtk+3.0
sudo apt-get install quilt sassc meson ninja-build cmake
sudo apt-get install libgif-dev libelf-dev
- name: Cache GTK Source
uses: actions/cache@v4
id: gtksrc
with:
path: 'gtk+*.tar.xz'
key: gtk-${{ env.GTK_VERSION }}
- name: Download GTK Source
#if: steps.gtksrc.outputs.cache-hit != 'true'
run: |
source PKGBUILD
wget https://download.gnome.org/sources/gtk+/${pkgver%.*}/gtk+-${_gtkver}.tar.xz
- name: Extract GTK Source
run: |
source PKGBUILD
tar -xJf gtk+*.tar.xz
# Uses PKGBUILD prepare() directly
- name: Apply Patches
run: |
source PKGBUILD
srcdir="$(pwd)"
prepare
# Based on PKGBUILD build()
# Build system may connect to GNOME's GitLab to retrieve glib dependency
- name: Build
run: |
source PKGBUILD
CFLAGS+=" -DG_DISABLE_CAST_CHECKS"
meson gtk+-${_gtkver} build \
-D broadway_backend=true \
-D colord=auto \
-D demos=false \
-D examples=false \
-D introspection=true \
-D tests=false \
-D installed_tests=false
ninja -C build
makepkg:
# Create artifacts for the Arch packages for convenient testing, and to
# validate the package integrity with changes.
name: 'Package / Arch'
runs-on: ubuntu-latest
steps:
# Checks out under $GITHUB_WORKSPACE
- name: Checkout
uses: actions/checkout@v4
- name: Get GTK Version
run: |
source PKGBUILD
echo "GTK_VERSION=${_gtkver}" >> $GITHUB_ENV
- name: Cache Pacman Packages
uses: actions/cache@v4
env:
cache-name: pacman-cache
with:
path: ~/pacman-cache
key: pacman-cache
- name: Cache GTK Source
uses: actions/cache@v4
id: gtksrc
with:
path: 'gtk+*.tar.xz'
key: gtk-${{ env.GTK_VERSION }}
- name: Start Arch Linux
run: |
# Start and update Arch Linux within a Docker container
docker run --privileged -d -t -v ~/pacman-cache/pkg:/var/cache/pacman/pkg -v $GITHUB_WORKSPACE:/workspace --name archlinux archlinux:base-devel
docker exec archlinux pacman -Syu --noconfirm namcap
# Add user
docker exec archlinux useradd builder
docker exec archlinux /bin/bash -c "echo 'builder ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers"
# Use as a reference when validating PKGBUILD
cp PKGBUILD PKGBUILD.before
md5sum PKGBUILD >> PKGBUILD.md5
# This 'builder' user will take directory ownership
docker exec archlinux chown -R builder /workspace
- name: Validate PKGBUILD
run: |
# Validate the PKGBUILD - these commands modify the file
docker exec --workdir=/workspace --user builder archlinux makepkg --geninteg
docker exec --workdir=/workspace --user builder archlinux namcap -i PKGBUILD
# Inform the user if changes need to be made
md5sum -c PKGBUILD.md5 || (echo -e "\nTo fix, please push a commit with the following changes to the PKGBUILD file.\nHere's the patch:\n" && diff -u PKGBUILD.before PKGBUILD)
- name: Make Package
run: |
docker exec --workdir=/workspace --user builder archlinux makepkg -s --noconfirm
- name: Stop Arch Linux
run: |
docker stop archlinux -t 1
docker rm archlinux
- name: Upload Package
uses: actions/upload-artifact@v4
with:
name: gtk3-classic-run${{github.run_number}}-pkg
path: gtk3-classic-*.pkg*