-
Notifications
You must be signed in to change notification settings - Fork 75
202 lines (172 loc) · 6.41 KB
/
ubuntu.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
name: CI
on:
push:
branches:
- main
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-20.04 # test slightly older ubuntu.
strategy:
fail-fast: false
matrix:
compiler:
- g++
- clang++
name: Build ${{matrix.compiler}}
steps:
- name: Install minimal dependencies
run: |
sudo apt update
sudo apt install cmake git g++ clang pkg-config libswscale-dev libavutil-dev libdeflate-dev
- name: Get the Source
uses: actions/checkout@v3
- name: Configure shell
run: |
echo "CXX=${{ matrix.compiler }}" >> $GITHUB_ENV
echo "CXXFLAGS=-Werror" >> $GITHUB_ENV
- name: Build minimal dependency timg
# Building a timg with all dependencies removed to the point that it
# can't display anything. Makes sure all the #ifdefs are there.
run: |
mkdir build-limitdep
cd build-limitdep
cmake .. -DWITH_VIDEO_DECODING=Off -DWITH_VIDEO_DEVICE=Off -DWITH_OPENSLIDE_SUPPORT=Off -DWITH_GRAPHICSMAGICK=Off -DWITH_TURBOJPEG=Off -DWITH_RSVG=Off -DWITH_LIBSIXEL=Off
make -k
- name: Install Full Dependencies
run: |
sudo apt update
sudo apt install libgraphicsmagick++-dev
sudo apt install libturbojpeg-dev libexif-dev
sudo apt install libsixel-dev
sudo apt install librsvg2-dev libcairo-dev
sudo apt install libavcodec-dev libavformat-dev libavdevice-dev
sudo apt install libopenslide-dev
sudo apt install libpoppler-glib-dev
sudo apt install pandoc
- name: Build timg with all options enabled
run: |
mkdir build
cd build
cmake .. -DWITH_VIDEO_DECODING=On -DWITH_VIDEO_DEVICE=On -DWITH_OPENSLIDE_SUPPORT=On -DWITH_STB_IMAGE=On -DWITH_RSVG=On -DWITH_POPPLER=On -DWITH_LIBSIXEL=On
make -k
- name: Print timg Version string
run: |
echo "------------------- Limited dependency version string --------"
build-limitdep/src/timg --version
echo
echo "------------------- All dependencies version string ----------"
build/src/timg --version
CodeFormatting:
if: false # currently, there is no clang-format-13 in ubuntu latest
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
run: |
sudo apt-get install clang-format-13
- name: Run formatting style check
run: ./.github/bin/run-clang-format.sh
TagIfNeeded:
name: Version Tagging
runs-on: ubuntu-latest
#if: ${{github.event_name == 'push' && github.ref == 'refs/heads/main'}}
permissions:
contents: write
outputs:
release_tag: ${{ steps.do_tag.outputs.RELEASE_TAG }}
steps:
- name: 📥 Download artifacts
uses: actions/download-artifact@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Tag with CMake version if not already.
id: do_tag
run: |
git config --local user.name "Development Bot"
git config --local user.email "[email protected]"
# We want to tag whenever the cmake version changes. So extract the
# hash of when the current version was entered.
read TAG_HASH TAG_VERSION <<<$(git annotate -l CMakeLists.txt | sed 's/\(^[0-9A-Fa-f]\+\).*project(timg VERSION \([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1 \2/p;d')
echo "timg Version v${TAG_VERSION} at hash ${TAG_HASH}"
# If this is the first time we see this tag: apply.
if [ -z "$(git tag -l "v${TAG_VERSION}")" ]; then
git tag -a "v${TAG_VERSION}" ${TAG_HASH} -m "Update to v${TAG_VERSION}"
git push origin "v${TAG_VERSION}"
echo "RELEASE_TAG=v${TAG_VERSION}" >> $GITHUB_OUTPUT
else
echo "Tag does exist already"
fi
AppImageBuild:
needs: [ TagIfNeeded ]
runs-on: ubuntu-latest
name: Build AppImage
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# TODO: extract version from tag, fix-up yml file.
- name: Install Dependencies
run: |
sudo apt update
sudo apt install cmake git g++ clang pkg-config
sudo apt install libswscale-dev libavutil-dev libdeflate-dev
sudo apt install libturbojpeg-dev libexif-dev
sudo apt install librsvg2-dev libcairo-dev
sudo apt install libsixel-dev
sudo apt install libpoppler-glib-dev
sudo apt install pandoc
- name: Set Version
run: |
echo "PACKAGE_VERSION=$(git describe | sed 's/\(v.*-.*\)-.*/\1/')" >> $GITHUB_ENV
- name: Build AppDir
run: |
# Switch off some or the more expensive dependencies.
# also check apt to include in .github/conf/AppImageBuilder.yml
./.github/bin/prepare-app-image.sh \
-DWITH_GRAPHICSMAGICK=Off \
-DWITH_RSVG=On \
-DWITH_POPPLER=On \
-DWITH_VIDEO_DECODING=Off \
-DWITH_VIDEO_DEVICE=Off \
-DWITH_OPENSLIDE_SUPPORT=Off \
-DWITH_TURBOJPEG=On \
-DWITH_STB_IMAGE=On \
-DWITH_QOI_IMAGE=On \
-DWITH_LIBSIXEL=On
strip AppDir/usr/bin/timg
ldd AppDir/usr/bin/timg
sed "s/@VERSION@/$PACKAGE_VERSION/" \
< .github/conf/AppImageBuilder.yml.in \
> AppImageBuilder.yml
- name: Package
uses: AppImageCrafters/build-appimage@master
env:
UPDATE_INFO: gh-releases-zsync|hzeller|timg|latest|*.AppImage.zsync
with:
recipe: "AppImageBuilder.yml"
- name: 📤 Upload artifact
uses: actions/upload-artifact@v3
with:
name: timg-${{ env.PACKAGE_VERSION }}-x86_64.AppImage
path: timg-${{ env.PACKAGE_VERSION }}-x86_64.AppImage
Release:
needs: [ AppImageBuild ]
if: needs.TagIfNeeded.RELEASE_TAG != ''
runs-on: ubuntu-latest
name: Create Release
steps:
- name: 🎉 Release If Tagged
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: artifact/timg-*.AppImage
tag: ${{ needs.TagIfNeeded.RELEASE_TAG }}
overwrite: true
file_glob: true