oh no! #3875
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 | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
generate-matrix-sets: | |
name: Generate matrix sets for build | |
runs-on: ubuntu-latest | |
outputs: | |
matrix-sets: ${{ steps.set-matrix-sets.outputs.matrix-sets }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install deps | |
run: | | |
curl https://luet.io/install.sh | sudo sh | |
sudo luet install -y repository/mocaccino-extra | |
sudo luet install -y utils/jq | |
- name: Set matrix sets for build | |
id: set-matrix-sets | |
run: | | |
PACKAGES="" | |
PKG_LIST=$(luet tree pkglist --tree packages -o json | jq '{"packages":[.packages[] | select(.path != "")]}') | |
for i in $(echo "$PKG_LIST" | jq -rc '.packages[]'); do | |
PACKAGE_PATH=$(echo "$i" | jq -r ".path") | |
PACKAGE_NAME=$(echo "$i" | jq -r ".name") | |
PACKAGE_CATEGORY=$(echo "$i" | jq -r ".category") | |
PACKAGE_VERSION=$(echo "$i" | jq -r ".version") | |
PACKAGE_VERSION=${PACKAGE_VERSION//\+/\-} | |
PACKAGE=$PACKAGE_NAME-$PACKAGE_CATEGORY-$PACKAGE_VERSION | |
if ! luet util image-exist "quay.io/mocaccino/mocaccino-community:$PACKAGE"; then | |
PACKAGES="${PACKAGES}${PACKAGES:+,}$i" | |
fi | |
done | |
PACKAGES="{\"packages\":[${PACKAGES}]}" | |
echo "matrix-sets=$(jq -rc '[.packages | _nwise(256)]' <<< ${PACKAGES})" >> $GITHUB_OUTPUT | |
build-set-0: | |
name: Set 0 | |
needs: generate-matrix-sets | |
uses: ./.github/workflows/build_set.yaml | |
with: | |
build-sets: ${{ needs.generate-matrix-sets.outputs.matrix-sets }} | |
set-id: 0 | |
secrets: | |
QUAY_ROBOT_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }} | |
QUAY_ROBOT_PASSWORD: ${{ secrets.QUAY_ROBOT_PASSWORD }} | |
build-set-1: | |
name: Set 1 | |
needs: [generate-matrix-sets, build-set-0] | |
uses: ./.github/workflows/build_set.yaml | |
with: | |
build-sets: ${{ needs.generate-matrix-sets.outputs.matrix-sets }} | |
set-id: 1 | |
secrets: | |
QUAY_ROBOT_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }} | |
QUAY_ROBOT_PASSWORD: ${{ secrets.QUAY_ROBOT_PASSWORD }} | |
create-repo: | |
needs: [build-set-0, build-set-1] | |
if: | | |
always() && | |
(needs.build-set-0.result == 'success' || needs.build-set-0.result == 'failure' || needs.build-set-0.result == 'skipped') && | |
(needs.build-set-1.result == 'success' || needs.build-set-0.result == 'failure' || needs.build-set-1.result == 'skipped') | |
env: | |
FINAL_REPO: quay.io/mocaccino/mocaccino-community | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Release space from worker ♻ | |
run: | | |
echo "Listing top largest packages" | |
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr) | |
head -n 30 <<< "${pkgs}" | |
echo | |
df -h | |
echo | |
sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true | |
sudo apt-get remove --auto-remove android-sdk-platform-tools || true | |
sudo apt-get purge --auto-remove android-sdk-platform-tools || true | |
sudo rm -rf /usr/local/lib/android | |
sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true | |
sudo rm -rf /usr/share/dotnet | |
sudo apt-get remove -y '^mono-.*' || true | |
sudo apt-get remove -y '^ghc-.*' || true | |
sudo apt-get remove -y '.*jdk.*|.*jre.*' || true | |
sudo apt-get remove -y 'php.*' || true | |
sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true | |
sudo apt-get remove -y '^google-.*' || true | |
sudo apt-get remove -y azure-cli || true | |
sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true | |
sudo apt-get remove -y '^gfortran-.*' || true | |
sudo apt-get remove -y 'microsoft-edge-.*' || true | |
sudo apt-get remove -y 'firefox.*' || true | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
echo | |
echo "Listing top largest packages" | |
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr) | |
head -n 30 <<< "${pkgs}" | |
echo | |
echo "Finding the Current Storage Location" | |
docker info -f '{{ .DockerRootDir }}' | |
echo | |
df -h | |
- run: | | |
git fetch --prune --unshallow | |
- name: Login to Quay Registry | |
run: echo ${{ secrets.QUAY_ROBOT_PASSWORD }} | docker login -u ${{ secrets.QUAY_ROBOT_USERNAME }} --password-stdin quay.io | |
- name: Install deps 🔧 | |
run: | | |
curl https://luet.io/install.sh | sudo sh | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.16' | |
cache: false | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
- name: Merge artifacts 🔧 | |
run: | | |
# if [ ! -f *.zip ] ; then echo "No artifacts to create a new repo." ; exit 1 ; fi | |
mkdir build || true | |
for i in $(ls | grep zip); do | |
cp -rfv $i/* build | |
done | |
ls -liah | |
ls -liah build | |
- name: Fetch metadata of packages 🔧 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: | | |
ls -liah | |
export PATH=$PATH:/usr/local/go/bin | |
pushd ./.github | |
go build -o build | |
popd | |
sudo -E ./.github/build | |
ls -liah $PWD/build | |
sudo chmod -R 777 $PWD/build | |
- name: Create repo 🔧 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: | | |
sudo -E luet create-repo \ | |
--push-images \ | |
--type docker \ | |
--output $FINAL_REPO \ | |
--name "mocaccino-community" \ | |
--packages ${PWD}/build \ | |
--tree ${PWD}/packages | |
# - name: Deploy GH Pages 🚀 | |
# if: github.ref == 'refs/heads/master' && github.event_name == 'push' | |
# uses: JamesIves/[email protected] | |
# with: | |
# token: ${{ secrets.GITHUB_TOKEN }} | |
# branch: gh-pages # The branch the action should deploy to. | |
# folder: build # The folder the action should deploy. | |
# clean: true # Automatically remove deleted files from the deploy branch | |
# single-commit: true |