Refactor CI workflow to build and push NixOS schemes, replacing parallel builds with sequential processing for better cache management. Introduce a new script for pushing builds to Attic cache and remove the obsolete build-all-schemes script.
This commit is contained in:
64
.github/workflows/build-schemes.yml
vendored
64
.github/workflows/build-schemes.yml
vendored
@@ -35,38 +35,55 @@ jobs:
|
||||
echo "schemes=$SCHEMES" >> $GITHUB_OUTPUT
|
||||
echo "Available schemes: $SCHEMES"
|
||||
|
||||
- name: Build all schemes
|
||||
run: |
|
||||
for scheme in ${{ steps.schemes.outputs.schemes }}; do
|
||||
echo "Building scheme: $scheme"
|
||||
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
|
||||
--override-input stylix-scheme $scheme \
|
||||
--out-link ./result-$scheme &
|
||||
done
|
||||
wait
|
||||
echo "All schemes built successfully!"
|
||||
|
||||
- name: Configure Attic cache
|
||||
run: |
|
||||
# Configure attic client to use your cache server
|
||||
attic login servidos https://cache.servidos.lat ${{ secrets.ATTIC_TOKEN }}
|
||||
|
||||
- name: Push schemes to cache
|
||||
- name: Build and push all schemes
|
||||
run: |
|
||||
echo "Pushing all scheme builds to cache..."
|
||||
# Push all built derivations to cache
|
||||
if ls result* 1> /dev/null 2>&1; then
|
||||
attic push servidos:nixos result*
|
||||
fi
|
||||
echo "Building and pushing all schemes..."
|
||||
|
||||
# Push each scheme build individually for better cache granularity
|
||||
# Store original scheme
|
||||
ORIGINAL_SCHEME=$(grep -oP "scheme = schemesFile\.schemes\.\K\w+" config/stylix.nix)
|
||||
echo "Original scheme: $ORIGINAL_SCHEME"
|
||||
|
||||
# Build and push each scheme
|
||||
for scheme in ${{ steps.schemes.outputs.schemes }}; do
|
||||
echo "Pushing scheme $scheme to cache..."
|
||||
echo "========================================="
|
||||
echo "Processing scheme: $scheme"
|
||||
echo "========================================="
|
||||
|
||||
# Update stylix.nix to use this scheme
|
||||
sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$scheme;/" config/stylix.nix
|
||||
|
||||
# Verify the change
|
||||
grep "scheme = schemesFile.schemes" config/stylix.nix
|
||||
|
||||
# Build the configuration
|
||||
echo "Building $scheme..."
|
||||
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
|
||||
--out-link ./result-$scheme
|
||||
|
||||
# Push to cache
|
||||
echo "Pushing $scheme to cache..."
|
||||
attic push servidos:nixos ./result-$scheme
|
||||
|
||||
# Also push using print-out-paths for better cache coverage
|
||||
nix build .#nixosConfigurations.${HOSTNAME}.config.system.build.toplevel \
|
||||
--override-input stylix-scheme $scheme \
|
||||
--print-out-paths | attic push servidos:nixos --stdin
|
||||
|
||||
echo "✓ Completed $scheme"
|
||||
echo ""
|
||||
done
|
||||
echo "All schemes pushed to cache successfully!"
|
||||
|
||||
# Restore original scheme
|
||||
echo "Restoring original scheme: $ORIGINAL_SCHEME"
|
||||
sed -i "s/scheme = schemesFile\.schemes\.\w\+;/scheme = schemesFile.schemes.$ORIGINAL_SCHEME;/" config/stylix.nix
|
||||
|
||||
echo "========================================="
|
||||
echo "All schemes built and pushed successfully!"
|
||||
echo "========================================="
|
||||
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
@@ -77,7 +94,10 @@ jobs:
|
||||
|
||||
- name: Summary
|
||||
run: |
|
||||
SCHEME_COUNT=$(echo "${{ steps.schemes.outputs.schemes }}" | wc -w)
|
||||
echo "✅ Color scheme builds completed successfully!"
|
||||
echo "- Built all ${{ steps.schemes.outputs.schemes }} schemes"
|
||||
echo "- Built $SCHEME_COUNT schemes: ${{ steps.schemes.outputs.schemes }}"
|
||||
echo "- Pushed all builds to Atticd cache"
|
||||
echo "- Uploaded artifacts for backup"
|
||||
echo ""
|
||||
echo "You can now switch schemes quickly without waiting for builds!"
|
||||
|
||||
Reference in New Issue
Block a user