emerge test all ebuilds #973
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: 'emerge test all ebuilds' | |
on: | |
workflow_dispatch: | |
inputs: | |
grep-ebuilds: | |
description: 'Which ebuilds to build' | |
required: true | |
default: 'all' | |
schedule: | |
- cron: '17 20 * * *' # @Daily | |
env: | |
DEFAULT_EBUILDS: 'all' | |
jobs: | |
list-all-ebuilds: | |
outputs: | |
matrix-first: ${{ steps.list-all-ebuilds.outputs.matrix-first }} | |
matrix-other: ${{ steps.list-all-ebuilds.outputs.matrix-other }} | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/antonfischl1980/gentoo-ci:main | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# emerge --sync not needed in this run | |
- name: repos.conf/icinga | |
run: | | |
mkdir -p /etc/portage/repos.conf/ | |
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf | |
pwd -P >> /etc/portage/repos.conf/icinga.conf | |
cat /etc/portage/repos.conf/*.conf | |
- name: list-all-ebuilds | |
id: list-all-ebuilds | |
run: | | |
equery --no-color l -o "*/*::icinga" -F '$cp =$cpv' | \ | |
( | |
if [ "${{ github.event.inputs.grep-ebuilds || env.DEFAULT_EBUILDS }}" == "all" ];then | |
grep -vf .github/workflows/emerge-test.filter | |
else | |
grep "${{ github.event.inputs.grep-ebuilds }}" | |
fi | |
) | \ | |
sort -u | \ | |
awk ' | |
{ | |
all[$1][$2]=$2;last[$1]=$2;pkg[$1]=$1 | |
} | |
END{ | |
asort(pkg); | |
for(p in pkg){ | |
print last[pkg[p]] > "/todo-first.lst"; | |
for(a in all[pkg[p]]){ | |
if(all[pkg[p]][a]!=last[pkg[p]]){ | |
other=sprintf("%s%s\n",other,all[pkg[p]][a]) | |
} | |
} | |
} | |
print other > "/todo-other.lst"}' | |
ls -la /todo*.lst | |
cat /todo*.lst | |
echo -n "::set-output name=matrix-first::" | |
jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))' /todo-first.lst | |
echo -n "::set-output name=matrix-other::" | |
jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))' /todo-other.lst | |
emerge-ebuild-first: | |
needs: list-all-ebuilds | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/antonfischl1980/gentoo-ci:main | |
options: --privileged | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: | |
ebuild: ${{ fromJSON(needs.list-all-ebuilds.outputs.matrix-first) }} | |
steps: | |
- name: verify variables | |
run: | | |
echo "ebuild: ${{ matrix.ebuild }}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: setup portage | |
env: | |
BINPKG_URL: ${{ secrets.BINPKG_URL }} | |
run: | | |
mkdir -p /etc/portage/repos.conf/ | |
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf | |
pwd -P >> /etc/portage/repos.conf/icinga.conf | |
cat /etc/portage/repos.conf/*.conf | |
echo 'FEATURES="${FEATURES} buildpkg binpkg-multi-instance getbinpkg"' >> /etc/portage/make.conf | |
echo "make.conf:" | |
cat /etc/portage/make.conf | |
mkdir -p /etc/portage/package.license | |
cat .github/workflows/emerge-test/package.license >> /etc/portage/package.license/90_SETUP | |
mkdir -p /etc/portage/package.mask | |
cat .github/workflows/emerge-test/package.mask >> /etc/portage/package.mask/90_SETUP | |
mkdir -p /etc/portage/package.use | |
cat .github/workflows/emerge-test/package.use >> /etc/portage/package.use/90_SETUP | |
eselect profile set 'icinga:default/linux/amd64/17.1/no-multilib/icinga' | |
echo "PORTAGE_BINHOST=${BINPKG_URL}" >> /etc/portage/make.conf | |
- name: emerge-sync | |
run: | | |
sudo -u portage git -C /var/db/repos/gentoo pull | |
emerge --sync | |
- name: emerge ${{ matrix.ebuild }} | |
run: | | |
echo "${{ matrix.ebuild }} ~amd64" >/etc/portage/package.accept_keywords/99_TEST | |
LOGNAME="/var/cache/binpkgs/$(date '+%F-%T')-$(echo "${{ matrix.ebuild }}"|sed 's#/#-#g').log" | |
emerge -t1v --jobs=4 --buildpkg-exclude="dev-lang/rust-bin" "${{ matrix.ebuild }}" |& tee "${LOGNAME}" | |
- name: Cache binpkg | |
if: ${{ always() && !cancelled() }} | |
env: | |
BINPKG_UPLOAD: ${{ secrets.BINPKG_UPLOAD }} | |
RSYNC_PASSWORD: ${{ secrets.BINPKG_PASSWORD }} | |
run: | | |
rsync-ssl -zaHDPSv --exclude='Packages' /var/cache/binpkgs/ $BINPKG_UPLOAD | |
emerge-ebuild-other: | |
needs: [list-all-ebuilds, emerge-ebuild-first] | |
runs-on: ubuntu-latest | |
container: | |
image: ghcr.io/antonfischl1980/gentoo-ci:main | |
options: --privileged | |
strategy: | |
fail-fast: false | |
matrix: | |
ebuild: ${{ fromJSON(needs.list-all-ebuilds.outputs.matrix-other) }} | |
steps: | |
- name: verify variables | |
run: | | |
echo "ebuild: ${{ matrix.ebuild }}" | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: setup portage | |
env: | |
BINPKG_URL: ${{ secrets.BINPKG_URL }} | |
run: | | |
mkdir -p /etc/portage/repos.conf/ | |
echo -en "[icinga]\nlocation = " >/etc/portage/repos.conf/icinga.conf | |
pwd -P >> /etc/portage/repos.conf/icinga.conf | |
cat /etc/portage/repos.conf/*.conf | |
echo 'FEATURES="${FEATURES} buildpkg binpkg-multi-instance getbinpkg"' >> /etc/portage/make.conf | |
echo "make.conf:" | |
cat /etc/portage/make.conf | |
mkdir -p /etc/portage/package.license | |
cat .github/workflows/emerge-test/package.license >> /etc/portage/package.license/90_SETUP | |
mkdir -p /etc/portage/package.mask | |
cat .github/workflows/emerge-test/package.mask >> /etc/portage/package.mask/90_SETUP | |
mkdir -p /etc/portage/package.use | |
cat .github/workflows/emerge-test/package.use >> /etc/portage/package.use/90_SETUP | |
eselect profile set 'icinga:default/linux/amd64/17.1/no-multilib/icinga' | |
echo "PORTAGE_BINHOST=${BINPKG_URL}" >> /etc/portage/make.conf | |
- name: emerge-sync | |
run: | | |
sudo -u portage git -C /var/db/repos/gentoo pull | |
emerge --sync | |
- name: emerge ${{ matrix.ebuild }} | |
run: | | |
echo "${{ matrix.ebuild }} ~amd64" >/etc/portage/package.accept_keywords/99_TEST | |
LOGNAME="/var/cache/binpkgs/$(date '+%F-%T')-$(echo "${{ matrix.ebuild }}"|sed 's#/#-#g').log" | |
emerge -t1v --jobs=4 --buildpkg-exclude="dev-lang/rust-bin" "${{ matrix.ebuild }}" |& tee "${LOGNAME}" | |
- name: Cache binpkg | |
if: ${{ always() && !cancelled() }} | |
env: | |
BINPKG_UPLOAD: ${{ secrets.BINPKG_UPLOAD }} | |
RSYNC_PASSWORD: ${{ secrets.BINPKG_PASSWORD }} | |
run: | | |
rsync-ssl -zaHDPSv --exclude='Packages' /var/cache/binpkgs/ $BINPKG_UPLOAD | |