Build test for cp2k-bin 2024.3 #6188
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build test | |
run-name: Build test for ${{ inputs.pkgbase }} ${{ inputs.pkgver }} | |
on: | |
workflow_dispatch: | |
inputs: | |
pkgbase: | |
required: true | |
pkgver: | |
required: true | |
clean-up-ubuntu: | |
required: false | |
type: boolean | |
default: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: archlinux | |
options: --privileged | |
volumes: | |
- /:/ubuntu | |
outputs: | |
built: ${{ steps.export.outputs.built }} | |
diff: ${{ steps.export.outputs.diff }} | |
steps: | |
- uses: arch4edu/cactus/actions/upgrade-archlinux@main | |
- name: Install runtime dependencies | |
run: pacman -S --noconfirm --needed arch-install-scripts base-devel devtools dbus git pacman-contrib | |
- uses: arch4edu/cactus/actions/clean-up-ubuntu@main | |
if: ${{ github.event.inputs.clean-up-ubuntu == 'true' }} | |
- uses: actions/checkout@master | |
- uses: arch4edu/cactus/actions/config-makepkg@main | |
- name: Add path | |
run: echo "$(realpath bin)" >> $GITHUB_PATH | |
- name: Override update script | |
run: | | |
find config -name ${{ github.event.inputs.pkgbase }}.override -exec cp {} bin/update-pkgver \; | |
chmod +x bin/update-pkgver | |
- name: Configure custom repository | |
run: | | |
[ -z "$(find config -name ${{ github.event.inputs.pkgbase }}.repository)" ] && exit 0 | |
cat /usr/share/devtools/pacman.conf.d/extra.conf $(find config -name ${{ github.event.inputs.pkgbase }}.repository) > /usr/share/devtools/pacman.conf.d/custom.conf | |
ln -s /usr/bin/archbuild /usr/bin/custom-x86_64-build | |
- name: Collect telemetry | |
uses: catchpoint/workflow-telemetry-action@v2 | |
- name: Build ${{ github.event.inputs.pkgbase }} ${{ inputs.pkgver }} | |
run: | | |
aur-clone ${{ github.event.inputs.pkgbase }} | |
cd ${{ github.event.inputs.pkgbase }} | |
chown makepkg:root -R . | |
update-pkgver ${{ github.event.inputs.pkgver }} || exit 0 | |
su makepkg -c recv-gpg-keys || : | |
if [ -f /usr/bin/custom-x86_64-build ] | |
then | |
su makepkg -c custom-x86_64-build || : | |
else | |
su makepkg -c extra-x86_64-build || : | |
fi | |
su makepkg -c 'makepkg --printsrcinfo' > .SRCINFO | |
- name: Export build result | |
id: export | |
run: | | |
cd ${{ github.event.inputs.pkgbase }} | |
[ -n "$(find -maxdepth 1 -name '*.pkg.tar.zst')" ] && echo "built=1" >> "$GITHUB_OUTPUT" || echo "built=0" >> "$GITHUB_OUTPUT" | |
echo "diff='$(git diff -- PKGBUILD .SRCINFO | base64 -w 0)'" >> "$GITHUB_OUTPUT" | |
push: | |
needs: build | |
if: ${{ needs.build.outputs.built == 1 }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
with: | |
token: ${{ secrets._GITHUB_TOKEN }} | |
- uses: petronny/git-config-user@master | |
- name: Add path | |
run: echo "$(realpath bin)" >> $GITHUB_PATH | |
- name: Configure git and ssh | |
run: | | |
echo "${{ secrets.SSH_KEY }}" | install -Dm400 /dev/stdin ~/.ssh/aur | |
cp ssh_config ~/.ssh/config | |
git config --global user.name 'Auto update bot' | |
git config --global user.email '[email protected]' | |
- name: Push ${{ github.event.inputs.pkgbase }} ${{ inputs.pkgver }} to AUR | |
run: | | |
[ -z ${{ needs.build.outputs.diff }} ] && exit 0 | |
aur-clone ${{ github.event.inputs.pkgbase }} | |
cd ${{ github.event.inputs.pkgbase }} | |
echo ${{ needs.build.outputs.diff }} | base64 -d | git apply | |
aur-push | |
- name: Update the oldver in yaml | |
run: | | |
yaml=$(find config -name ${{ github.event.inputs.pkgbase }}.yaml) | |
update-yaml $yaml ${{ github.event.inputs.pkgver }} | |
git add $yaml | |
git commit -m "${{ github.event.inputs.pkgbase }}: auto updated to ${{ github.event.inputs.pkgver }}" || : | |
git-push |