void-packages/.github/workflows/build.yaml

153 lines
5.2 KiB
YAML
Raw Normal View History

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
env:
PATH: '/usr/libexec/chroot-git:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/bin:/tmp/bin'
XLINT: '1'
LICENSE_LIST: common/travis/license.lst
steps:
- name: Clone and checkout
run: |
REMOTE_REF=$(echo ${{ github.ref }} | sed 's;refs/;refs/remotes/;')
/bin/echo -e '::group::\x1b[32mCloning repository...\x1b[0m'
git clone --progress --no-checkout --filter=tree:0 \
"${{ github.server_url }}/${{ github.repository }}" "$PWD"
git config --global --add gc.auto 0
git config --global --add safe.directory "$PWD"
echo "::endgroup::"
/bin/echo -e '::group::\x1b[32mFetching repository refs...\x1b[0m'
git fetch --prune --progress --filter=tree:0 origin \
+refs/heads/*:refs/remotes/origin/* \
+${{ github.ref }}:"${REMOTE_REF}"
echo "::endgroup::"
/bin/echo -e '::group::\x1b[32mChecking out repository...\x1b[0m'
git checkout --progress --force "${REMOTE_REF}"
echo "::endgroup::"
- run: common/travis/changed_templates.sh
2021-05-22 00:14:56 +02:00
- run: common/travis/fetch-xbps.sh
- run: common/travis/fetch-xtools.sh
- run: common/travis/xlint.sh
# 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/xbps-src-masterdir:20230111RC01-${{ matrix.config.bootstrap }}'
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.bootstrap }}'
TEST: '${{ matrix.config.test }}'
HOSTREPO: /hostrepo
strategy:
fail-fast: false
matrix:
config:
- { arch: x86_64, bootstrap: x86_64, test: 1 }
- { arch: i686, bootstrap: i686, test: 1 }
- { arch: aarch64, bootstrap: x86_64, test: 0 }
- { arch: armv7l, bootstrap: x86_64, test: 0 }
- { arch: x86_64-musl, bootstrap: x86_64-musl, test: 1 }
- { arch: armv6l-musl, bootstrap: x86_64-musl, test: 0 }
- { arch: aarch64-musl, bootstrap: x86_64-musl, 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
run: |
REMOTE_REF=$(echo ${{ github.ref }} | sed 's;refs/;refs/remotes/;')
/bin/echo -e '::group::\x1b[32mCloning repository...\x1b[0m'
git clone --progress --no-checkout --filter=tree:0 \
"${{ github.server_url }}/${{ github.repository }}" "$PWD"
git config --global --add gc.auto 0
git config --global --add safe.directory "$PWD"
echo "::endgroup::"
/bin/echo -e '::group::\x1b[32mFetching repository refs...\x1b[0m'
git fetch --prune --progress --filter=tree:0 origin \
+refs/heads/*:refs/remotes/origin/* \
+${{ github.ref }}:"${REMOTE_REF}"
echo "::endgroup::"
/bin/echo -e '::group::\x1b[32mChecking out repository...\x1b[0m'
git checkout --progress --force "${REMOTE_REF}"
echo "::endgroup::"
- 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"
)