Skip to content

Commit

Permalink
[IMP] Parallelize nightly build.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleepy-monax committed Feb 8, 2024
1 parent 3e9fbfd commit daf5b25
Show file tree
Hide file tree
Showing 8 changed files with 49 additions and 26 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ jobs:
if: ${{ github.event_name == 'schedule' }}
run: test -z $(git rev-list --after="24 hours" ${{ github.sha }}) && echo "::set-output name=should_run::false"

linux:
build-distro:
strategy:
matrix:
distro: [alpine-3.18, arch, debian-bookworm, fedora-39, ubuntu-jammy]
needs: check_date
if: ${{ needs.check_date.outputs.should_run != 'false' }}
name: Build for x86_64 Linux
name: Build for ${{ matrix.distro }}
runs-on: ubuntu-latest
permissions: write-all
steps:
Expand All @@ -47,9 +50,9 @@ jobs:
- name: Set up the build environment
run: ./bootstrap.sh tools setup

- name: Build & package for all supported distros
- name: Build & package for ${{ matrix.distro }}
run: |
meta/scripts/build-all.sh --flavore=nightly
meta/scripts/build-distro.sh ${{ matrix.distro }} --flavore=nightly
- name: Upload Packages to GitHub
uses: svenstaro/upload-release-action@v2
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "alpine",
"id": "alpine-3.18",
"package": "apk",
"extension": "apk",
"requires": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "debian",
"id": "debian-bookworm",
"package": "deb",
"extension": "deb",
"requires": [
Expand Down
2 changes: 1 addition & 1 deletion meta/data/pod-fedora.json → meta/data/pod-fedora-39.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "fedora",
"id": "fedora-39",
"package": "rpm",
"extension": "rpm",
"requires": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "ubuntu",
"id": "ubuntu-jammy",
"package": "deb",
"extension": "deb",
"requires": [
Expand Down
21 changes: 10 additions & 11 deletions meta/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,24 @@ def loadData(name: str) -> jexpr.Json:
_dataCache[name] = jexpr.read(Path(f"meta/data/{name}.json"))
return _dataCache[name]


pods.IMAGES["ubuntu"].setup += [
f"apt -y install {' '.join(loadData('pod-ubuntu')['requires'] + loadData('pod-ubuntu')['devRequires'])}",
pods.IMAGES["ubuntu-jammy"].setup += [
f"apt -y install {' '.join(loadData('pod-ubuntu-jammy')['requires'] + loadData('pod-ubuntu-jammy')['devRequires'])}",
"gem install fpm",
]
pods.IMAGES["debian"].setup += [
f"apt -y install {' '.join(loadData('pod-debian')['requires'] + loadData('pod-debian')['devRequires'])}",
pods.IMAGES["debian-bookworm"].setup += [
f"apt -y install {' '.join(loadData('pod-debian-bookworm')['requires'] + loadData('pod-debian-bookworm')['devRequires'])}",
"gem install fpm",
]
pods.IMAGES["alpine"].setup += [
f"apk add {' '.join(loadData('pod-alpine')['requires'] + loadData('pod-alpine')['devRequires'])}",
pods.IMAGES["alpine-3.18"].setup += [
f"apk add {' '.join(loadData('pod-alpine-3.18')['requires'] + loadData('pod-alpine-3.18')['devRequires'])}",
"gem install fpm",
]
pods.IMAGES["arch"].setup += [
f"pacman --noconfirm -S {' '.join(loadData('pod-arch')['requires'] + loadData('pod-arch')['devRequires'])}",
"gem install fpm",
]
pods.IMAGES["fedora"].setup += [
f"dnf -y install {' '.join(loadData('pod-fedora')['requires'] + loadData('pod-fedora')['devRequires'])}",
pods.IMAGES["fedora-39"].setup += [
f"dnf -y install {' '.join(loadData('pod-fedora-39')['requires'] + loadData('pod-fedora-39')['devRequires'])}",
"gem install fpm",
]

Expand Down Expand Up @@ -155,7 +154,7 @@ def _(args: cli.Args):

model.Project.use(args)
target = useTarget(args)
prefix = "/opt/odoo-wkhtmltopdf"
prefix = "/usr/"
distro = args.consumeOpt("distro", None)
if distro is None:
import sys
Expand Down Expand Up @@ -209,5 +208,5 @@ def _(args: cli.Args):
prefix,
"-p",
str(dist / output),
"/opt/odoo-wkhtmltopdf",
"/usr/bin/wkhtmltopdf",
)
18 changes: 11 additions & 7 deletions meta/scripts/build-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,24 @@

set -e

if [ -z "$CUTEKIT" ]; then
export CUTEKIT="./bootstrap.sh"
fi

# for each target build the project
DISTROS="\
alpine \
alpine-3.18 \
arch \
debian \
fedora \
ubuntu"
debian-bookworm \
fedora-39 \
ubuntu-jammy"

for DISTRO in $DISTROS; do
echo "Building for $DISTRO"
BUILDER=$DISTRO-builder
./bootstrap.sh pod create --name=$BUILDER --image=$DISTRO || true
./bootstrap.sh --pod=$BUILDER wk dist --distro=$DISTRO $@
$CUTEKIT pod create --name=$BUILDER --image=$DISTRO || true
$CUTEKIT --pod=$BUILDER wk dist --distro=$DISTRO $@
done

./bootstrap.sh ck pod kill --all
$CUTEKIT pod kill --all
docker system prune -fa
17 changes: 17 additions & 0 deletions meta/scripts/build-distro.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/usr/bin/env bash

set -e

if [ -z "$CUTEKIT" ]; then
export CUTEKIT="./bootstrap.sh"
fi

DISTRO=$1
shift

echo "Building for $DISTRO"
BUILDER=$DISTRO-builder
$CUTEKIT pod create --name=$BUILDER --image=$DISTRO || true
$CUTEKIT --pod=$BUILDER wk dist --distro=$DISTRO $@
$CUTEKIT pod kill --all
docker system prune -fa

0 comments on commit daf5b25

Please sign in to comment.