CI: add reusable actions

This commit is contained in:
Mihai Fufezan 2023-09-10 21:51:13 +03:00
parent 1e60802968
commit a5e512fd29
No known key found for this signature in database
8 changed files with 117 additions and 110 deletions

View File

@ -15,17 +15,15 @@ jobs:
steps: steps:
- name: Install deps - name: Install deps
run: sudo apt install pandoc run: sudo apt install pandoc
- name: Clone repository - name: Clone repository
uses: actions/checkout@v3 uses: actions/checkout@v3
# Not needed
# with:
# submodules: recursive
- name: Build man pages - name: Build man pages
run: make man run: make man
- uses: stefanzweifel/git-auto-commit-action@v4 - uses: stefanzweifel/git-auto-commit-action@v4
name: Commit name: Commit
with: with:
commit_message: "[gha] build man pages" commit_message: "[gha] build man pages"
commit_user_name: Mihai Fufezan push_options: --force
commit_user_email: fufexan@protonmail.com
commit_author: Mihai Fufezan <fufexan@protonmail.com>

View File

@ -1,26 +0,0 @@
name: Build Hyprland (Nix)
on: [push, pull_request, workflow_dispatch]
jobs:
nix:
name: "Build Hyprland (Nix)"
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: recursive
- 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
- uses: cachix/cachix-action@v12
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build packages
run: nix flake check --print-build-logs --accept-flake-config

35
.github/workflows/nix-build.yml vendored Normal file
View File

@ -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 }}

12
.github/workflows/nix-ci.yml vendored Normal file
View File

@ -0,0 +1,12 @@
name: Nix
on: [push, pull_request, workflow_dispatch]
jobs:
wlroots:
uses: ./.github/workflows/nix-update-wlroots.yml
build:
needs: wlroots
uses: ./.github/workflows/nix-build.yml
secrets: inherit

View File

@ -1,40 +0,0 @@
name: "Nix update"
on:
schedule:
- cron: '0 0 * * *'
jobs:
update:
name: "inputs"
runs-on: ubuntu-latest
steps:
- 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: Update lockfile
run: nix/update-inputs.sh
- uses: cachix/cachix-action@v12
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 inputs"
commit_user_name: Mihai Fufezan
commit_user_email: fufexan@protonmail.com
commit_author: Mihai Fufezan <fufexan@protonmail.com>

36
.github/workflows/nix-update-inputs.yml vendored Normal file
View File

@ -0,0 +1,36 @@
name: Nix
on:
schedule:
- cron: '0 0 * * *' # check daily
jobs:
update:
name: inputs
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
- name: Update inputs
run: nix/update-inputs.sh
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] Nix: update inputs"
push_options: --force
update-build:
needs: update
uses: ./.github/workflows/nix-build.yml
secrets: inherit

View File

@ -1,38 +0,0 @@
name: "Nix update"
on: [push, workflow_dispatch]
jobs:
update:
name: "wlroots"
runs-on: ubuntu-latest
steps:
- 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: Update lockfile
run: nix/update-wlroots.sh
- uses: cachix/cachix-action@v12
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: fufexan@protonmail.com
commit_author: Mihai Fufezan <fufexan@protonmail.com>

View File

@ -0,0 +1,30 @@
name: Nix
on:
workflow_call:
jobs:
update:
name: wlroots
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
- name: Update lockfile
run: nix/update-wlroots.sh
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] Nix: update wlroots"
push_options: --force