Krolyxon
Commit a67665a

Branches

Refs →

nsxiva67665a

add codeberg ci and cleanup github one (#311)

- apt-get is slow, takes up ~1m40s just to install deps, fix it by not
  using it. instead use alpine linux for codeberg ci, which brings build
  time down to 25s.
- And since alpine uses musl, it's probably a good idea to use it on our
  ci since it might catch us using any glibc extensions. The github ci
  can keep using ubuntu.
- remove duplication of CFLAGS by having it on a separate file instead.
- remove pull_request from github ci since we no longer accept PRs
  there.

Closes: https://codeberg.org/nsxiv/nsxiv/issues/307
Author
NRK
Date
2022-06-16 05:08 +0200
Parent
33a5d54
Commit
a67665a1c1569cdc16366cf635f76eb00c96048a

+54 −45

3 files changed

  1. M .github/workflows/build.yml +13 −45
  2. A .woodpecker/CFLAGS +13 −0
  3. A .woodpecker/build.yml +28 −0
M .github/workflows/build.yml View
@@ -3,12 +3,10 @@ name: Build
33 on:
44 push:
55 branches: [ master ]
6− pull_request:
7− branches: [ master ]
86
97 # NOTE: "stable" tcc is too old and fails at linking. instead fetching a recent known working commit.
108 jobs:
11− full-build:
9+ build:
1210 runs-on: ubuntu-latest
1311 steps:
1412 - uses: actions/checkout@v2
@@ -23,45 +21,15 @@ jobs:
2321 ( cd "tinycc-$TCC_SHA" && ./configure && make && sudo make install; )
2422 - name: build
2523 run: |
26− # vanilla flags
27− CFLAGS="-std=c99 -Wall -pedantic"
28− # extra flags
29− CFLAGS+=" -O3 -flto"
30− CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith"
31− CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
32− CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
33− CFLAGS+=" -Wmissing-prototypes -Wstrict-prototypes"
34− # silence
35− CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
36− echo "### GCC BUILD ###" && make clean && make -s CC=gcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=1
37− echo "### CLANG BUILD ###" && make clean && make -s CC=clang CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=1
38− echo "### TCC BUILD ###" && make clean && make -s CC=tcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=1
39−
40− minimal-build:
41− runs-on: ubuntu-latest
42− steps:
43− - uses: actions/checkout@v2
44− - name: dep
45− run: |
46− sudo apt-get update
47− sudo apt-get install libimlib2 libimlib2-dev xserver-xorg-core xserver-xorg-dev \
48− gcc clang git
49− sudo apt-get remove libxft2 libxft-dev libexif12 libexif-dev
50− TCC_SHA="027b8fb9b88fe137447fb8bb1b61079be9702472"
51− wget "https://github.com/TinyCC/tinycc/archive/${TCC_SHA}.tar.gz" && tar xzf "${TCC_SHA}.tar.gz"
52− ( cd "tinycc-$TCC_SHA" && ./configure && make && sudo make install; )
53− - name: build
54− run: |
55− # vanilla flags
56− CFLAGS="-std=c99 -Wall -pedantic"
57− # extra flags
58− CFLAGS+=" -O3 -flto"
59− CFLAGS+=" -Werror -Wextra -Wshadow -Wvla -Wpointer-arith"
60− CFLAGS+=" -Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code"
61− CFLAGS+=" -Wbad-function-cast -Wdeclaration-after-statement"
62− CFLAGS+=" -Wmissing-prototypes -Wstrict-prototypes"
63− # silence
64− CFLAGS+=" -Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers"
65− echo "### GCC BUILD ###" && make clean && make -s CC=gcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=0
66− echo "### CLANG BUILD ###" && make clean && make -s CC=clang CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=0
67− echo "### TCC BUILD ###" && make clean && make -s CC=tcc CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT=0
24+ CFLAGS="$(sed '/^#/d' .woodpecker/CFLAGS | paste -d ' ' -s)"
25+ build () {
26+ for cc in "gcc" "clang" "tcc"; do
27+ echo "### $cc - $2 build ###"
28+ make clean && make -s -j"$(nproc)" CC="$cc" CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT="$1"
29+ done
30+ }
31+ # full-build #
32+ build "1" "full"
33+ # ensure minimal-build works without opt deps installed
34+ sudo apt-get remove libxft2 libxft-dev libexif12 libexif-dev >/dev/null
35+ build "0" "minimal"
A .woodpecker/CFLAGS View
@@ -0,0 +1,13 @@
1+# vanilla flags
2+-std=c99 -Wall -pedantic
3+# optimizations: enables extra warnings and deeper analysis thus catches more errors/warnings
4+-O3 -flto
5+# treat warnings as errors
6+-Werror
7+# extra flags
8+-Wextra -Wshadow -Wvla -Wpointer-arith
9+-Wundef -Wstrict-overflow=4 -Wwrite-strings -Wunreachable-code
10+-Wbad-function-cast -Wdeclaration-after-statement
11+-Wmissing-prototypes -Wstrict-prototypes
12+# silence
13+-Wno-sign-compare -Wno-unused-parameter -Wno-missing-field-initializers
A .woodpecker/build.yml View
@@ -0,0 +1,28 @@
1+# NOTE: "stable" tcc is too old and fails at linking. instead fetching a recent known working commit.
2+pipeline:
3+ build:
4+ image: alpine
5+ environment:
6+ - TCC_SHA=027b8fb9b88fe137447fb8bb1b61079be9702472
7+ when:
8+ branch: master
9+ commands: |
10+ apk add --no-cache \
11+ imlib2 imlib2-dev xorgproto \
12+ libxft libxft-dev libexif libexif-dev giflib giflib-dev libwebp libwebp-dev \
13+ gcc clang llvm12 llvm12-dev build-base wget ca-certificates >/dev/null
14+ wget "https://github.com/TinyCC/tinycc/archive/$TCC_SHA.tar.gz" >/dev/null
15+ tar xzf "$TCC_SHA.tar.gz" >/dev/null
16+ ( cd "tinycc-$TCC_SHA" && ./configure --config-musl && make -s -j"$(nproc)" && make install; ) >/dev/null
17+ CFLAGS="$(sed '/^#/d' .woodpecker/CFLAGS | paste -d ' ' -s)"
18+ build () {
19+ for cc in "gcc" "clang" "tcc"; do
20+ echo "### $cc - $2 build ###"
21+ make clean && make -s -j"$(nproc)" CC="$cc" CFLAGS="$CFLAGS" LDFLAGS="$CFLAGS" OPT_DEP_DEFAULT="$1"
22+ done
23+ }
24+ # full-build #
25+ build "1" "full"
26+ # ensure minimal-build works without opt deps installed
27+ apk del libxft libxft-dev libexif libexif-dev giflib giflib-dev libwebp libwebp-dev >/dev/null
28+ build "0" "minimal"