chore: Update flake, fix issues after updating and fix flake update action (#88)

Was running behind with the updating the config, all flake inputs have
been updated and produced error's and warnings have been fixed.

Also fixed the action to test the build and create an issue with the
results.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Roel de Cort 2025-03-07 22:29:43 +01:00 committed by GitHub
parent ce61453ce9
commit 56740db4be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 223 additions and 175 deletions

View file

@ -5,8 +5,61 @@ on:
- cron: "30 00 * * 1" - cron: "30 00 * * 1"
workflow_dispatch: # Allow manual triggering workflow_dispatch: # Allow manual triggering
# Set default permissions as read only
permissions: read-all
jobs: jobs:
build-and-update: update-flake:
runs-on: ubuntu-latest
permissions:
# Only need contents write to update the flake lock file
contents: write
outputs:
update_available: ${{ steps.check_updates.outputs.update_available }}
steps:
- name: Repository Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16
- name: Check for Updates
id: check_updates
run: |
# Create a temporary copy of flake.lock
cp flake.lock flake.lock.backup
# Try to update flake.lock
nix flake update
# Check if there are differences
if ! cmp -s flake.lock flake.lock.backup; then
echo "update_available=true" >> "$GITHUB_OUTPUT"
# Restore original flake.lock
mv flake.lock.backup flake.lock
else
echo "update_available=false" >> "$GITHUB_OUTPUT"
fi
- name: Update flake.lock
if: steps.check_updates.outputs.update_available == 'true'
uses: DeterminateSystems/update-flake-lock@v24
with:
nix-options: --debug --log-format raw
token: ${{ secrets.FLAKE_TOKEN }}
pr-title: "deps: update flake.lock"
pr-labels: |
dependencies
automated
build-and-check:
needs: update-flake
permissions:
# Needed for checking out code
contents: read
# Needed for creating issues
issues: write
strategy: strategy:
matrix: matrix:
os: [ubuntu-latest, macos-latest] os: [ubuntu-latest, macos-latest]
@ -17,6 +70,8 @@ jobs:
steps: steps:
- name: Repository Checkout - name: Repository Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
with:
ref: update_flake_lock_action
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@v16 uses: DeterminateSystems/nix-installer-action@v16
@ -25,17 +80,22 @@ jobs:
id: build id: build
continue-on-error: true # Continue to next steps even if build fails continue-on-error: true # Continue to next steps even if build fails
run: | run: |
set +e # Don't exit immediately on error
# Run the build and capture output # Run the build and capture output
OUTPUT=$(nix build .# 2>&1) OUTPUT=$(nix build .# 2>&1)
BUILD_EXIT_CODE=$?
echo "build_output<<EOF" >> $GITHUB_ENV echo "build_output<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV echo "$OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV echo "EOF" >> $GITHUB_ENV
# Check if build succeeded # Check if build succeeded
if [ $? -eq 0 ]; then if [ $BUILD_EXIT_CODE -eq 0 ]; then
echo "build_status=success" >> $GITHUB_ENV echo "build_status=success" >> $GITHUB_ENV
else else
echo "build_status=failure" >> $GITHUB_ENV echo "build_status=failure" >> $GITHUB_ENV
# Ensure the error is visible in the logs
echo "::error::Build failed with exit code $BUILD_EXIT_CODE"
echo "$OUTPUT"
fi fi
- name: Create Issue on Build Failure - name: Create Issue on Build Failure
@ -45,12 +105,33 @@ jobs:
script: | script: |
const os = '${{ matrix.os }}'; const os = '${{ matrix.os }}';
const buildOutput = process.env.build_output; const buildOutput = process.env.build_output;
const isUpdate = '${{ needs.update-flake.outputs.update_available }}' === 'true';
// Extract warnings and errors from build output
const warnings = buildOutput.match(/evaluation warning:[^\n]+/g) || [];
const errors = buildOutput.match(/error:[^\n]+/g) || [];
// Create a summary section
const summary = [
warnings.length > 0 ? `${warnings.length} evaluation warnings` : '',
errors.length > 0 ? `${errors.length} errors` : ''
].filter(Boolean).join(' and ');
// Get repository information from context
const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/');
await github.rest.issues.create({ await github.rest.issues.create({
owner: context.repo.owner, owner,
repo: context.repo.name, repo,
title: `🔨 Build Failed on ${os}`, title: `🔨 Build Failed on ${os}: ${summary}${isUpdate ? ' (Dependency Update)' : ''}`,
body: `Build failed during automated validation on ${os}. body: `Build failed during automated validation on ${os}${isUpdate ? ' while testing dependency updates.' : '.'}\n
${isUpdate ? 'This failure occurred on the dependency update branch `deps/update-flake-lock`.' : 'This failure occurred on the main branch.'}\n
### Summary
${summary}\n
${warnings.length > 0 ? `### Warnings\n\`\`\`\n${warnings.join('\n')}\n\`\`\`\n` : ''}
${errors.length > 0 ? `### Errors\n\`\`\`\n${errors.join('\n')}\n\`\`\`\n` : ''}
<details> <details>
<summary>Build Output</summary> <summary>Build Output</summary>
@ -61,60 +142,10 @@ jobs:
</details> </details>
Please review the build output and fix any issues.`, Please review the build output and fix any issues.`,
labels: ['build-failure', 'bug'] labels: [
}); 'build-failure',
'bug',
- name: Update flake.lock ...(warnings.length > 0 ? ['has-warnings'] : []),
if: matrix.os == 'ubuntu-latest' && env.build_status == 'success' ...(errors.length > 0 ? ['has-errors'] : [])
uses: DeterminateSystems/update-flake-lock@v24 ]
with:
nix-options: --debug --log-format raw
token: ${{ secrets.FLAKE_TOKEN }}
pr-title: "deps: update flake.lock"
pr-labels: |
dependencies
automated
- name: Run Checks
id: checks
if: env.build_status == 'success'
continue-on-error: true
run: |
# Run the checks and capture output
OUTPUT=$(nix flake check 2>&1)
echo "check_output<<EOF" >> $GITHUB_ENV
echo "$OUTPUT" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
# Check if checks succeeded
if [ $? -eq 0 ]; then
echo "check_status=success" >> $GITHUB_ENV
else
echo "check_status=failure" >> $GITHUB_ENV
fi
- name: Create Issue on Check Failure
if: env.check_status == 'failure'
uses: actions/github-script@v7
with:
script: |
const os = '${{ matrix.os }}';
const checkOutput = process.env.check_output;
await github.rest.issues.create({
owner: context.repo.owner,
repo: context.repo.name,
title: `⚠️ Checks Failed on ${os}`,
body: `Checks failed during automated validation on ${os}.
<details>
<summary>Check Output</summary>
\`\`\`
${checkOutput}
\`\`\`
</details>
Please review the check output and fix any issues.`,
labels: ['check-failure', 'bug']
}); });

View file

@ -3,12 +3,15 @@
enable = true; enable = true;
}; };
plugins.copilot-lua = { plugins.copilot-lua = {
enable = true; settings = {
suggestion = { copilot = {
enabled = false; suggestion = {
}; enabled = false;
panel = { };
enabled = false; panel = {
enabled = false;
};
};
}; };
}; };

View file

@ -1,98 +1,109 @@
{ {
plugins.fidget = { plugins.fidget = {
enable = true; enable = true;
logger = { settings = {
level = "warn"; # “off”, “error”, “warn”, “info”, “debug”, “trace” logger = {
floatPrecision = 1.0e-2; # Limit the number of decimals displayed for floats level = "warn"; # "off", "error", "warn", "info", "debug", "trace"
}; float_precision = 1.0e-2; # Limit the number of decimals displayed for floats
progress = {
pollRate = 0; # How and when to poll for progress messages
suppressOnInsert = true; # Suppress new messages while in insert mode
ignoreDoneAlready = false; # Ignore new tasks that are already complete
ignoreEmptyMessage = false; # Ignore new tasks that don't contain a message
clearOnDetach =
# Clear notification group when LSP server detaches
''
function(client_id)
local client = vim.lsp.get_client_by_id(client_id)
return client and client.name or nil
end
'';
notificationGroup =
# How to get a progress message's notification group key
''
function(msg) return msg.lsp_client.name end
'';
ignore = [ ]; # List of LSP servers to ignore
lsp = {
progressRingbufSize = 0; # Configure the nvim's LSP progress ring buffer size
}; };
display = { progress = {
renderLimit = 16; # How many LSP messages to show at once poll_rate = 0; # How and when to poll for progress messages
doneTtl = 3; # How long a message should persist after completion suppress_on_insert = true; # Suppress new messages while in insert mode
doneIcon = ""; # Icon shown when all LSP progress tasks are complete ignore_done_already = false; # Ignore new tasks that are already complete
doneStyle = "Constant"; # Highlight group for completed LSP tasks ignore_empty_message = false; # Ignore new tasks that don't contain a message
progressTtl = "math.huge"; # How long a message should persist when in progress clear_on_detach =
progressIcon = { # Clear notification group when LSP server detaches
pattern = "dots"; ''
period = 1; function(client_id)
}; # Icon shown when LSP progress tasks are in progress local client = vim.lsp.get_client_by_id(client_id)
progressStyle = "WarningMsg"; # Highlight group for in-progress LSP tasks return client and client.name or nil
groupStyle = "Title"; # Highlight group for group name (LSP server name) end
iconStyle = "Question"; # Highlight group for group icons '';
priority = 30; # Ordering priority for LSP notification group notification_group =
skipHistory = true; # Whether progress notifications should be omitted from history # How to get a progress message's notification group key
formatMessage = '' ''
require ("fidget.progress.display").default_format_message function(msg) return msg.lsp_client.name end
''; # How to format a progress message '';
formatAnnote = '' ignore = [ ]; # List of LSP servers to ignore
function (msg) return msg.title end lsp = {
''; # How to format a progress annotation progress_ringbuf_size = 0; # Configure the nvim's LSP progress ring buffer size
formatGroupName = '' };
function (group) return tostring (group) end display = {
''; # How to format a progress notification group's name render_limit = 16; # How many LSP messages to show at once
overrides = { done_ttl = 3; # How long a message should persist after completion
rust_analyzer = { done_icon = ""; # Icon shown when all LSP progress tasks are complete
name = "rust-analyzer"; done_style = "Constant"; # Highlight group for completed LSP tasks
progress_ttl = 10; # How long a message should persist when in progress
progress_icon = {
pattern = "dots";
period = 1;
}; # Icon shown when LSP progress tasks are in progress
progress_style = "WarningMsg"; # Highlight group for in-progress LSP tasks
group_style = "Title"; # Highlight group for group name (LSP server name)
icon_style = "Question"; # Highlight group for group icons
priority = 30; # Ordering priority for LSP notification group
skip_history = true; # Whether progress notifications should be omitted from history
format_message = ''
require ("fidget.progress.display").default_format_message
''; # How to format a progress message
format_annote = ''
function (msg) return msg.title end
''; # How to format a progress annotation
format_group_name = ''
function (group) return tostring (group) end
''; # How to format a progress notification group's name
overrides = {
rust_analyzer = {
name = "rust-analyzer";
};
}; # Override options from the default notification config
};
};
notification = {
poll_rate = 10; # How frequently to update and render notifications
filter = "info"; # "off", "error", "warn", "info", "debug", "trace"
history_size = 128; # Number of removed messages to retain in history
override_vim_notify = true;
redirect = {
__raw = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end
'';
};
configs = {
default = {
name = "Notifications";
icon = "󰏪";
group = "Notifications";
annote = true;
debug = false;
debug_rate = 0.25;
}; };
}; # Override options from the default notification config };
};
};
notification = {
pollRate = 10; # How frequently to update and render notifications
filter = "info"; # “off”, “error”, “warn”, “info”, “debug”, “trace”
historySize = 128; # Number of removed messages to retain in history
overrideVimNotify = true;
redirect = ''
function(msg, level, opts)
if opts and opts.on_open then
return require("fidget.integration.nvim-notify").delegate(msg, level, opts)
end
end
'';
configs = {
default = "require('fidget.notification').default_config";
};
window = { window = {
normalHl = "Comment"; normal_hl = "Comment";
winblend = 0; winblend = 0;
border = "none"; # none, single, double, rounded, solid, shadow border = "none"; # none, single, double, rounded, solid, shadow
zindex = 45; zindex = 45;
maxWidth = 0; max_width = 0;
maxHeight = 0; max_height = 0;
xPadding = 1; x_padding = 1;
yPadding = 0; y_padding = 0;
align = "bottom"; align = "bottom";
relative = "editor"; relative = "editor";
}; };
view = { view = {
stackUpwards = true; # Display notification items from bottom to top stack_upwards = true; # Display notification items from bottom to top
iconSeparator = " "; # Separator between group name and icon icon_separator = " "; # Separator between group name and icon
groupSeparator = "---"; # Separator between notification groups group_separator = "---"; # Separator between notification groups
groupSeparatorHl = group_separator_hl =
# Highlight group used for group separator # Highlight group used for group separator
"Comment"; "Comment";
};
}; };
}; };
}; };

39
flake.lock generated
View file

@ -21,11 +21,11 @@
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": { "locked": {
"lastModified": 1740872218, "lastModified": 1741352980,
"narHash": "sha256-ZaMw0pdoUKigLpv9HiNDH2Pjnosg7NBYMJlHTIsHEUo=", "narHash": "sha256-+u2UunDA4Cl5Fci3m7S643HzKmIDAe+fiXrLqYsR2fs=",
"owner": "hercules-ci", "owner": "hercules-ci",
"repo": "flake-parts", "repo": "flake-parts",
"rev": "3876f6b87db82f33775b1ef5ea343986105db764", "rev": "f4330d22f1c5d2ba72d3d22df5597d123fdb60a9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -124,11 +124,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1740828860, "lastModified": 1741246872,
"narHash": "sha256-cjbHI+zUzK5CPsQZqMhE3npTyYFt9tJ3+ohcfaOF/WM=", "narHash": "sha256-Q6pMP4a9ed636qilcYX8XUguvKl/0/LGXhHcRI91p0U=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "303bd8071377433a2d8f76e684ec773d70c5b642", "rev": "10069ef4cf863633f57238f179a0297de84bd8d3",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -140,14 +140,17 @@
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": { "locked": {
"lastModified": 1740872140, "lastModified": 1740877520,
"narHash": "sha256-3wHafybyRfpUCLoE8M+uPVZinImg3xX+Nm6gEfN3G8I=", "narHash": "sha256-oiwv/ZK/2FhGxrCkQkB83i7GnWXPPLzoqFHpDD3uYpk=",
"type": "tarball", "owner": "nix-community",
"url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" "repo": "nixpkgs.lib",
"rev": "147dee35aab2193b174e4c0868bd80ead5ce755c",
"type": "github"
}, },
"original": { "original": {
"type": "tarball", "owner": "nix-community",
"url": "https://github.com/NixOS/nixpkgs/archive/6d3702243441165a03f699f64416f635220f4f15.tar.gz" "repo": "nixpkgs.lib",
"type": "github"
} }
}, },
"nixpkgs_2": { "nixpkgs_2": {
@ -189,11 +192,11 @@
"nuschtosSearch": "nuschtosSearch" "nuschtosSearch": "nuschtosSearch"
}, },
"locked": { "locked": {
"lastModified": 1740520037, "lastModified": 1741098523,
"narHash": "sha256-TpZMYjOre+6GhKDVHFwoW2iBWqpNQppQTuqIAo+OBV8=", "narHash": "sha256-gXDSXDr6tAb+JgxGMvcEjKC9YO8tVOd8hMMZHJLyQ6Q=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "6f8d8f7aee84f377f52c8bb58385015f9168a666", "rev": "03065fd4708bfdf47dd541d655392a60daa25ded",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -232,11 +235,11 @@
"nixpkgs": "nixpkgs_3" "nixpkgs": "nixpkgs_3"
}, },
"locked": { "locked": {
"lastModified": 1740915799, "lastModified": 1741350116,
"narHash": "sha256-JvQvtaphZNmeeV+IpHgNdiNePsIpHD5U/7QN5AeY44A=", "narHash": "sha256-QKp83UTH0hGc7TYkQdX5JdagvBnP5169WyxXkMrkPqY=",
"owner": "cachix", "owner": "cachix",
"repo": "pre-commit-hooks.nix", "repo": "pre-commit-hooks.nix",
"rev": "42b1ba089d2034d910566bf6b40830af6b8ec732", "rev": "ca78dfc9652483f3ae52cfe70fdfbfe664451e2b",
"type": "github" "type": "github"
}, },
"original": { "original": {