Add build workflow
This commit is contained in:
parent
4a1ae17834
commit
94521d0b1b
1 changed files with 159 additions and 0 deletions
159
.github/workflows/build.yaml
vendored
Normal file
159
.github/workflows/build.yaml
vendored
Normal file
|
@ -0,0 +1,159 @@
|
||||||
|
name: build
|
||||||
|
|
||||||
|
on:
|
||||||
|
# TODO: Enable once we have conditional build logic built
|
||||||
|
# pull_request:
|
||||||
|
# paths:
|
||||||
|
# - 'srcpkgs/**'
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- 'srcpkgs/**'
|
||||||
|
- '.github/**' # for easier debugging
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
changedpkgs:
|
||||||
|
name: Check package changes
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: "!contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
changed: ${{ steps.grabchanged.outputs.changed }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: checkout local templates
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- id: grabchanged
|
||||||
|
run: |
|
||||||
|
# write changes to detected_templates
|
||||||
|
.github/changed_templates.sh
|
||||||
|
# move them to step output
|
||||||
|
echo changed="$(cat detected_templates)" >> $GITHUB_OUTPUT
|
||||||
|
- run: |
|
||||||
|
echo "${{ steps.grabchanged.outputs.changed }}"
|
||||||
|
|
||||||
|
build:
|
||||||
|
name: Build packages
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [ changedpkgs ]
|
||||||
|
if: "needs.changedpkgs.outputs.changed != '' && !contains(github.event.pull_request.title, '[ci skip]') && !contains(github.event.pull_request.body, '[ci skip]')"
|
||||||
|
|
||||||
|
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 }
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: ghcr.io/void-linux/void-${{ matrix.config.libc }}-full:20250227R1
|
||||||
|
options: --platform ${{ matrix.config.platform }} --privileged
|
||||||
|
volumes:
|
||||||
|
- /dev:/dev
|
||||||
|
env:
|
||||||
|
ARCH: '${{ matrix.config.arch }}'
|
||||||
|
BOOTSTRAP: '${{ matrix.config.host }}'
|
||||||
|
TEST: '${{ matrix.config.test }}'
|
||||||
|
|
||||||
|
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
|
||||||
|
# install dependencies
|
||||||
|
xbps-install -Syu xbps && xbps-install -yu && xbps-install -y sudo bash curl git
|
||||||
|
# create non-root user
|
||||||
|
useradd -G xbuilder -M builder
|
||||||
|
|
||||||
|
- name: checkout upstream templates
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: void-linux/void-packages
|
||||||
|
ref: master
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: checkout local templates
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.head_ref }}
|
||||||
|
path: added-packages
|
||||||
|
|
||||||
|
- name: copy
|
||||||
|
run: cp -rv added-packages/srcpkgs/* srcpkgs
|
||||||
|
|
||||||
|
- name: Prepare masterdir
|
||||||
|
run: |
|
||||||
|
chown -R builder:builder . &&
|
||||||
|
sudo -Eu builder common/travis/set_mirror.sh &&
|
||||||
|
sudo -Eu builder common/travis/prepare.sh &&
|
||||||
|
common/travis/fetch-xtools.sh
|
||||||
|
|
||||||
|
- name: Find changed templates
|
||||||
|
env:
|
||||||
|
CHANGED: ${{ needs.changedpkgs.outputs.changed }}
|
||||||
|
run: sudo -Eu builder echo "$CHANGED" | sed 's/ /\n/g' > /tmp/templates
|
||||||
|
|
||||||
|
- name: Build and check packages
|
||||||
|
run: sudo -Eu builder common/travis/build.sh "$BOOTSTRAP" "$ARCH" "$TEST"
|
||||||
|
|
||||||
|
- name: Show files
|
||||||
|
run: sudo -Eu builder common/travis/show_files.sh "$BOOTSTRAP" "$ARCH"
|
||||||
|
|
||||||
|
# - name: Compare to previous
|
||||||
|
# run: sudo -Eu builder 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
|
||||||
|
# export XDG_CACHE_HOME="$PWD/.cache"
|
||||||
|
# sudo -Eu builder xlocate -S &&
|
||||||
|
# sudo -Eu builder common/scripts/lint-conflicts
|
||||||
|
# fi
|
||||||
|
|
||||||
|
# - name: Verify repository state
|
||||||
|
# run: |
|
||||||
|
# mkdir -p /check-install &&
|
||||||
|
# chown builder:builder /check-install &&
|
||||||
|
# sudo -Eu builder common/travis/check-install.sh "$BOOTSTRAP" "$ARCH"
|
||||||
|
|
||||||
|
- name: sign
|
||||||
|
working-directory: hostdir/binpkgs/
|
||||||
|
run: |
|
||||||
|
xbps-rindex -r $PWD
|
||||||
|
|
||||||
|
echo "${{ secrets.PRIV_KEY }}" > $HOME/privkey
|
||||||
|
xbps-rindex -s --signedby "${{ secrets.SIGNER }}" --privkey $HOME/privkey $PWD
|
||||||
|
xbps-rindex -S --privkey $HOME/privkey $PWD/*.xbps
|
||||||
|
rm $HOME/privkey
|
||||||
|
|
||||||
|
xbps-rindex -c $PWD
|
||||||
|
|
||||||
|
- name: checksum
|
||||||
|
working-directory: hostdir/binpkgs/
|
||||||
|
run: |
|
||||||
|
for pkg in *.xbps; do sha256sum "$pkg" | tee "$pkg".sha256sum; done
|
||||||
|
for pkg in *.xbps; do sha512sum "$pkg" | tee "$pkg".sha512sum; done
|
||||||
|
|
||||||
|
- name: publish to pages
|
||||||
|
uses: peaceiris/actions-gh-pages@v4
|
||||||
|
# If you're changing the branch from main,
|
||||||
|
# also change the `main` in `refs/heads/main`
|
||||||
|
# below accordingly.
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: hostdir/binpkgs
|
Loading…
Reference in a new issue