Skip to content

Commit

Permalink
CI: add reusable actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fufexan committed Sep 11, 2023
1 parent 1e60802 commit 5a638d9
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 77 deletions.
10 changes: 4 additions & 6 deletions .github/workflows/man-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ jobs:
steps:
- name: Install deps
run: sudo apt install pandoc

- name: Clone repository
uses: actions/checkout@v3
# Not needed
# with:
# submodules: recursive

- name: Build man pages
run: make man

- uses: stefanzweifel/git-auto-commit-action@v4
name: Commit
with:
commit_message: "[gha] build man pages"
commit_user_name: Mihai Fufezan
commit_user_email: [email protected]
commit_author: Mihai Fufezan <[email protected]>
push_options: --force
26 changes: 0 additions & 26 deletions .github/workflows/nix-build.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on:
workflow_call:
secrets:
CACHIX_AUTH_TOKEN:
required: false

jobs:
build:
strategy:
matrix:
package:
- hyprland
- hyprland-nvidia
- xdg-desktop-portal-hyprland

runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install Nix
uses: cachix/install-nix-action@v22
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- run: nix build -L ${{ matrix.command }}
11 changes: 11 additions & 0 deletions .github/workflows/nix-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Nix

on: [push, pull_request, workflow_dispatch]

jobs:
wlroots:
uses: ./.github/workflows/nix-update-wlroots.yml

build:
uses: ./.github/workflows/nix-build.yml
secrets: inherit
52 changes: 24 additions & 28 deletions .github/workflows/nix-update-inputs.yaml
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
name: "Nix update"
name: Nix

on:
schedule:
- cron: '0 0 * * *'
- cron: '0 0 * * *' # check daily

jobs:
update:
name: "inputs"
name: inputs
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Clone repository
uses: actions/checkout@v3

- name: Install nix
uses: cachix/install-nix-action@v20
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Install nix
uses: cachix/install-nix-action@v22
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- name: Update lockfile
run: nix/update-inputs.sh
- name: Update inputs
run: nix/update-inputs.sh

- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] Nix: update inputs"
push_options: --force

- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] Nix: bump inputs"
commit_user_name: Mihai Fufezan
commit_user_email: [email protected]
commit_author: Mihai Fufezan <[email protected]>
update-build:
needs: update
uses: ./.github/workflows/nix-build.yml
secrets: inherit
26 changes: 9 additions & 17 deletions .github/workflows/nix-update-wlroots.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
name: "Nix update"
name: Nix

on: [push, workflow_dispatch]
on:
workflow_call:

jobs:
update:
name: "wlroots"
name: wlroots
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3

- name: Install nix
uses: cachix/install-nix-action@v20
uses: cachix/install-nix-action@v22
with:
install_url: https://nixos.org/nix/install
extra_nix_config: |
Expand All @@ -22,17 +23,8 @@ jobs:
- name: Update lockfile
run: nix/update-wlroots.sh

- uses: cachix/cachix-action@v12
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] Nix: bump wlroots"
commit_user_name: Mihai Fufezan
commit_user_email: [email protected]
commit_author: Mihai Fufezan <[email protected]>
commit_message: "[gha] Nix: update wlroots"
push_options: --force

0 comments on commit 5a638d9

Please sign in to comment.