aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yaml
blob: d860feff70d383f20df0f07d560d9424c6786f0d (plain) (blame)
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
name: Check build

on:
  pull_request:
    paths:
      - 'srcpkgs/**'
  push:
    branches:
      - 'ci-**'
    paths:
      - 'srcpkgs/**'

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  # Lint changed templates.
  xlint:
    name: Lint templates
    runs-on: ubuntu-latest

    container:
      image: 'ghcr.io/void-linux/void-buildroot-musl:20230904R2'
      env:
        PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
        LICENSE_LIST: common/travis/license.lst

    steps:
      - name: Prepare container
        run: |
          # switch to repo-ci mirror
          mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
          sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
          # Sync and upgrade once, assume error comes from xbps update
          xbps-install -Syu || xbps-install -yu xbps
          # Upgrade again (in case there was a xbps update)
          xbps-install -yu
          # install tools needed for lints
          xbps-install -y grep curl
      - name: Clone and checkout
        uses: classabbyamp/treeless-checkout-action@v1
      - name: Create hostrepo and prepare masterdir
        run: |
         ln -s "$(pwd)" /hostrepo &&
         common/travis/set_mirror.sh &&
         common/travis/prepare.sh &&
         common/travis/fetch-xtools.sh
      - run: common/travis/changed_templates.sh
      - name: Run lints
        run: |
          rv=0
          common/travis/xlint.sh || rv=1
          common/travis/verify-update-check.sh || rv=1
          exit $rv

  # Build changed packages.
  build:
    name: Build packages
    runs-on: ubuntu-latest
    if: "!contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"

    container:
      image: ghcr.io/void-linux/void-buildroot-${{ matrix.config.libc }}:20230904R2
      options: --platform ${{ matrix.config.platform }}
      env:
        PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
        ARCH: '${{ matrix.config.arch }}'
        BOOTSTRAP: '${{ matrix.config.host }}'
        TEST: '${{ matrix.config.test }}'
        HOSTREPO: /hostrepo

    strategy:
      fail-fast: false
      matrix:
        config:
          - { arch: x86_64,       host: x86_64,      libc: glibc, platform: linux/amd64, test: 1 }
          - { arch: i686,         host: i686,        libc: glibc, platform: linux/386,   test: 1 }
          - { arch: aarch64,      host: x86_64,      libc: glibc, platform: linux/amd64, test: 0 }
          - { arch: armv7l,       host: x86_64,      libc: glibc, platform: linux/amd64, test: 0 }
          - { arch: x86_64-musl,  host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 1 }
          - { arch: armv6l-musl,  host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 0 }
          - { arch: aarch64-musl, host: x86_64-musl, libc: musl,  platform: linux/amd64, test: 0 }

    steps:
      - name: Prepare container
        run: |
          # switch to repo-ci mirror
          mkdir -p /etc/xbps.d && cp /usr/share/xbps.d/*-repository-*.conf /etc/xbps.d/
          sed -i 's|repo-default|repo-ci|g' /etc/xbps.d/*-repository-*.conf
          # Sync and upgrade once, assume error comes from xbps update
          xbps-install -Syu || xbps-install -yu xbps
          # Upgrade again (in case there was a xbps update)
          xbps-install -yu

      - name: Clone and checkout
        uses: classabbyamp/treeless-checkout-action@v1
      - name: Create hostrepo and prepare masterdir
        run: |
         ln -s "$(pwd)" /hostrepo &&
         common/travis/set_mirror.sh &&
         common/travis/prepare.sh &&
         common/travis/fetch-xtools.sh
      - run: common/travis/changed_templates.sh

      - name: Build and check packages
        run: |
          (
          here="$(pwd)"
          cd /
          "$here/common/travis/build.sh" "$BOOTSTRAP" "$ARCH" "$TEST"
          )

      - name: Show files
        run: |
          (
          here="$(pwd)"
          cd /
          "$here/common/travis/show_files.sh" "$BOOTSTRAP" "$ARCH"
          )

      - name: Compare to previous
        run: |
          (
          here="$(pwd)"
          cd /
          "$here/common/travis/xpkgdiff.sh" "$BOOTSTRAP" "$ARCH"
          )

      - name: Check file conflicts
        if: matrix.config.arch == 'x86_64' # the arch indexed in xlocate
        run: |
          if [ -s /tmp/templates ]; then
              xlocate -S &&
              common/scripts/lint-conflicts $HOME/hostdir/binpkgs
          fi

      - name: Verify repository state
        run: |
          (
          here="$(pwd)"
          cd /
          "$here/common/travis/check-install.sh" "$BOOTSTRAP" "$ARCH"
          )