Swapspace: update to 1.18.1
[void-pkg.git] / .github / workflows / build.yaml
blob182941fec0aa8c63b0dbbf06628fbc0573432f44
1 name: Check build
3 on:
4   pull_request:
5     paths:
6       - 'srcpkgs/**'
7   push:
8     branches:
9       - 'ci-**'
10     paths:
11       - 'srcpkgs/**'
13 concurrency:
14   group: ${{ github.workflow }}-${{ github.ref }}
15   cancel-in-progress: true
17 jobs:
18   # Lint changed templates.
19   xlint:
20     name: Lint templates
21     runs-on: ubuntu-latest
23     container:
24       image: 'ghcr.io/void-linux/void-buildroot-musl:20240526R1'
25       env:
26         PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
27         LICENSE_LIST: common/travis/license.lst
29     steps:
30       - name: Prepare container
31         run: |
32           # switch to repo-ci mirror
33           mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
34           sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
35           # Sync and upgrade once, assume error comes from xbps update
36           xbps-install -Syu || xbps-install -yu xbps
37           # Upgrade again (in case there was a xbps update)
38           xbps-install -yu
39           # install tools needed for lints
40           xbps-install -y grep curl git
41       - name: Clone and checkout
42         uses: classabbyamp/treeless-checkout-action@v1
43       - name: Create hostrepo and prepare masterdir
44         run: |
45           ln -s "$(pwd)" /hostrepo &&
46           common/travis/set_mirror.sh &&
47           common/travis/prepare.sh &&
48           common/travis/fetch-xtools.sh
49       - run: common/travis/changed_templates.sh
50       - name: Run lints
51         run: |
52           rv=0
53           common/travis/xlint.sh || rv=1
54           common/travis/verify-update-check.sh || rv=1
55           exit $rv
57   # Build changed packages.
58   build:
59     name: Build packages
60     runs-on: ubuntu-latest
61     if: "!contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"
63     container:
64       image: ghcr.io/void-linux/void-buildroot-${{ matrix.config.libc }}:20240526R1
65       options: --platform ${{ matrix.config.platform }}
66       env:
67         PATH: '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
68         ARCH: '${{ matrix.config.arch }}'
69         BOOTSTRAP: '${{ matrix.config.host }}'
70         TEST: '${{ matrix.config.test }}'
71         HOSTREPO: /hostrepo
73     strategy:
74       fail-fast: false
75       matrix:
76         config:
77           - { arch: x86_64,       host: x86_64,      libc: glibc, platform: linux/amd64, test: 1 }
78           - { arch: i686,         host: i686,        libc: glibc, platform: linux/386,   test: 1 }
79           - { arch: aarch64,      host: x86_64,      libc: glibc, platform: linux/amd64, test: 0 }
80           - { arch: armv7l,       host: x86_64,      libc: glibc, platform: linux/amd64, test: 0 }
81           - { arch: x86_64-musl,  host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 1 }
82           - { arch: armv6l-musl,  host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 0 }
83           - { arch: aarch64-musl, host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 0 }
85     steps:
86       - name: Prepare container
87         run: |
88           # switch to repo-ci mirror
89           mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
90           sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
91           # Sync and upgrade once, assume error comes from xbps update
92           xbps-install -Syu || xbps-install -yu xbps
93           # Upgrade again (in case there was a xbps update)
94           xbps-install -yu
96       - name: Clone and checkout
97         env:
98           PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
99         uses: classabbyamp/treeless-checkout-action@v1
100       - name: Create hostrepo and prepare masterdir
101         run: |
102           ln -s "$(pwd)" /hostrepo &&
103           common/travis/set_mirror.sh &&
104           common/travis/prepare.sh &&
105           common/travis/fetch-xtools.sh
106       - name: Find changed templates
107         env:
108           PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
109         run: common/travis/changed_templates.sh
111       - name: Build and check packages
112         run: |
113           (
114           here="$(pwd)"
115           cd /
116           "$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" "$TEST"
117           )
119       - name: Show files
120         run: |
121           (
122           here="$(pwd)"
123           cd /
124           "$here/common/travis/show_files.sh" "$BOOTSTRAP" "$ARCH"
125           )
127       - name: Compare to previous
128         run: |
129           (
130           here="$(pwd)"
131           cd /
132           "$here/common/travis/xpkgdiff.sh" "$BOOTSTRAP" "$ARCH"
133           )
135       - name: Check file conflicts
136         if: matrix.config.arch == 'x86_64' # the arch indexed in xlocate
137         env:
138           PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
139         run: |
140           if [ -s /tmp/templates ]; then
141               xlocate -S &&
142               common/scripts/lint-conflicts $HOME/hostdir/binpkgs
143           fi
145       - name: Verify repository state
146         run: |
147           (
148           here="$(pwd)"
149           cd /
150           "$here/common/travis/check-install.sh" "$BOOTSTRAP" "$ARCH"
151           )