Skip to content
This repository has been archived by the owner on Jun 2, 2024. It is now read-only.

Commit

Permalink
ref: improving performance on build job by executing all flavors at the
Browse files Browse the repository at this point in the history
same time
  • Loading branch information
iruzo committed May 25, 2024
1 parent 8688c20 commit 8f2e518
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
name: "Generate test artifacts"


on:
workflow_dispatch:
pull_request:
types: [opened, reopened, synchronize]


jobs:
build:
runs-on: ubuntu-latest

steps:

- name: Checkout
uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -42,4 +39,3 @@ jobs:
with:
name: '${{ github.sha }}-artifacts'
path: ./releases/*.zip

3 changes: 2 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from src.build import main

if __name__ == "__main__":
main()
main(os.path.dirname(os.path.realpath(__file__)))
19 changes: 10 additions & 9 deletions src/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os
import sys
import argparse
import shutil
from src.patches import apply_colloid_patches
from src.theme import build_theme, gnome_shell_version
from src.utils import init_tweaks_temp, copy_dir
Expand All @@ -9,7 +9,6 @@
from catppuccin import PALETTE


THIS_DIR = os.path.dirname(os.path.realpath(__file__))
GS_VERSION = "46-0"


Expand Down Expand Up @@ -112,10 +111,16 @@ def parse_args():
return parser.parse_args()


def main():
def main(context):
args = parse_args()

COLLOID_DIR = f"{context}/colloid"
COLLOID_TMP_DIR = f"{context}/colloid-tmp-{args.flavor}"
copy_dir(COLLOID_DIR, COLLOID_TMP_DIR)
SRC_DIR = COLLOID_TMP_DIR + "/src"

if args.patch:
apply_colloid_patches()
apply_colloid_patches(COLLOID_TMP_DIR)

if args.zip:
output_format = "zip"
Expand Down Expand Up @@ -145,11 +150,6 @@ def main():
"lavender",
]

COLLOID_DIR = f"{THIS_DIR}/../colloid/src"
SRC_DIR = f"{THIS_DIR}/../colloid-tmp-" + args.flavor

copy_dir(COLLOID_DIR, SRC_DIR)

for accent in accents:
accent = getattr(palette.colors, accent)

Expand Down Expand Up @@ -177,6 +177,7 @@ def main():
build_theme(ctx, SRC_DIR)
logger.info(f"Completed {palette.identifier} with {accent.identifier}")

shutil.rmtree(COLLOID_TMP_DIR)
logger.info("Done!")


Expand Down
8 changes: 4 additions & 4 deletions src/patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from src.logger import logger


def apply_colloid_patches():
if os.path.isfile("colloid/.patched"):
def apply_colloid_patches(colloid_dir):
if os.path.isfile(colloid_dir + "/.patched"):
logger.info(
'Patches seem to be applied, remove "colloid/.patched" to force application (this may fail)'
)
Expand All @@ -24,9 +24,9 @@ def apply_colloid_patches():
path = f"./patches/colloid/{patch}"
logger.info(f"Applying patch '{patch}', located at '{path}'")
subprocess.check_call(
["git", "apply", path, "--directory", f"colloid"])
["git", "apply", path, "--directory", colloid_dir])

with open("colloid/.patched", "w") as f:
with open(colloid_dir + "/.patched", "w") as f:
f.write("true")

logger.info("Patching finished.")

0 comments on commit 8f2e518

Please sign in to comment.