Skip to content

Commit

Permalink
ci(actions): add basic set up gh actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tsandrini committed Jul 28, 2024
1 parent b613e94 commit 485d978
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

## Describe the bug
A clear and concise description of what the bug is.

## Steps To Reproduce
Steps to reproduce the behavior:
1. ...
2. ...
3. ...

## Expected behavior
A clear and concise description of what you expected to happen.

## Screenshots
If applicable, add screenshots to help explain your problem.

## Additional context
Add any other context about the problem here.

## Notify maintainers

<!--
Please @ people who are in the `meta.maintainers` list of the offending package or module.
If in doubt, check `git blame` for whoever last touched something.
-->

## Metadata
Please run `nix-shell -p nix-info --run "nix-info -m"` and paste the result.

```console
[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
output here
```

---

Add a :+1: [reaction] to [issues you find important].
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature-request
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.

---

Add a :+1: [reaction] to [issues you find important].
38 changes: 38 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## Overview

<!-- Provide a brief overview of what this PR aims to accomplish. For instance,
is it adding a new configuration, updating an existing one, fixing a bug, or
improving the documentation? -->

## Testing

<!-- Describe the testing process for the changes. Include steps to reproduce
any relevant scenarios and the expected outcomes. For example when creating a new
package, test that `nix build` produces the expected binaries/libraries and that
they work as well. Or when adding new NixOS/home-manager modules that you were
able to include them in a NixOS/home-configuration build and that they work.-->

## Dependencies

<!-- List any new dependencies introduced by this PR, or if any existing
dependencies are updated or removed. -->

## Screenshots
<!-- Provide screenshots demonstrating the changes, especially for UI-related
updates (if applicable). -->

## Checklist

<!-- Ensure you've gone through this checklist before submitting your PR. -->

- [ ] I have tested the relevant changes locally.
- [ ] I have checked that `nix flake check` passes.
- [ ] I have ensured my commits follow the project's commits guidelines.
- [ ] I have checked that the changes follow a linear history.
- [ ] (If applicable) I have commented any relevant parts of my code.
- [ ] (If applicable) I have added appropriate unit/feature tests.
- [ ] (If applicable) I have updated the documentation accordingly (in English).

## Additional Notes

<!-- Add any other notes, comments, or considerations regarding the PR here. -->
33 changes: 33 additions & 0 deletions .github/workflows/cachix-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: "Push packages and devshells to the cachix binary cache service"

on:
push:
branches:
- main

jobs:
flake-check:
if: false
runs-on: "ubuntu-latest"
steps:
- name: "Checking out repository..."
uses: actions/checkout@v4

- name: "Installing and configuring the nix package manager..."
uses: DeterminateSystems/nix-installer-action@main

- name: "Setting up magic-nix-cache..."
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Settings up cachix binary cache..."
uses: cachix/cachix-action@main
with:
name: tsandrini
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: "Building project packages..."
run: nix build

- name: "Building project devshells..."
run: nix develop --command echo OK

30 changes: 30 additions & 0 deletions .github/workflows/flake-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "Run `nix flake-check`"

on:
push:
branches:
- main
pull_request:
types: [opened, reopened, synchronize]
repository_dispatch:
types: [create-pull-request]

jobs:
flake-check:
if: false
runs-on: "ubuntu-latest"
steps:
- name: "Checking out repository..."
uses: actions/checkout@v4

- name: "Installing and configuring the nix package manager..."
uses: DeterminateSystems/nix-installer-action@main

- name: "Setting up magic-nix-cache..."
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Running `nix flake check`..."
run: nix flake check --show-trace --accept-flake-config

- name: "Checking flake inputs for stale & insecure nixpkgs versions..."
uses: DeterminateSystems/flake-checker-action@main
29 changes: 29 additions & 0 deletions .github/workflows/flakehub-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Publish flake to FlakeHub"

on:
push:
branches:
- main

jobs:
flakehub-publish:
runs-on: "ubuntu-latest"
permissions:
id-token: "write"
contents: "read"
steps:
- name: "Checking out repository..."
uses: actions/checkout@v4

- name: "Installing and configuring the nix package manager..."
uses: DeterminateSystems/nix-installer-action@main

- name: "Setting up magic-nix-cache..."
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Publishing flake to FlakeHub..."
uses: DeterminateSystems/flakehub-push@main
with:
name: "tsandrini/flake-parts-builder"
rolling: true
visibility: "public"
32 changes: 32 additions & 0 deletions .github/workflows/update-flake-lock.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: "Periodically update flake inputs in flake.lock"

on:
workflow_dispatch: # allows manual triggering
schedule:
- cron: "0 0 * * 0" # runs weekly on Sunday at 00:00

jobs:
update-flake-lock:
runs-on: ubuntu-latest
steps:
- name: "Checking out repository..."
uses: actions/checkout@v4

- name: "Installing and configuring the nix package manager..."
uses: DeterminateSystems/nix-installer-action@main

- name: "Setting up magic-nix-cache..."
uses: DeterminateSystems/magic-nix-cache-action@main

- name: "Updating flake.lock..."
uses: DeterminateSystems/update-flake-lock@main
with:
pr-title: "Automated action - Update flake.lock"
pr-labels: |
dependencies
automated
# NOTE You can use a personal access token to identify
# as a concrete user, this may be useful when you want to
# trigger additional CI actions.
#
token: ${{ secrets.GH_TOKEN_FOR_UPDATES }}

0 comments on commit 485d978

Please sign in to comment.