Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: add reusable actions #2951

Merged
merged 1 commit into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions .github/workflows/man-update.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,16 @@ jobs:
steps:
- name: Install deps
run: sudo apt install pandoc

- name: Clone repository
uses: actions/checkout@v3
# Not needed
# with:
# submodules: recursive
with:
token: ${{ secrets.PAT }}

- 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]>
37 changes: 37 additions & 0 deletions .github/workflows/nix-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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
with:
ref: ${{ github.ref }}

- 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 }}
13 changes: 13 additions & 0 deletions .github/workflows/nix-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Nix

on: [push, pull_request, workflow_dispatch]

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

build:
needs: wlroots
uses: ./.github/workflows/nix-build.yml
secrets: inherit
40 changes: 0 additions & 40 deletions .github/workflows/nix-update-inputs.yaml

This file was deleted.

37 changes: 37 additions & 0 deletions .github/workflows/nix-update-inputs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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
with:
token: ${{ secrets.PAT }}

- 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"

update-build:
needs: update
uses: ./.github/workflows/nix-build.yml
secrets: inherit
38 changes: 0 additions & 38 deletions .github/workflows/nix-update-wlroots.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,26 +1,34 @@
name: Build Hyprland (Nix)
name: Nix

on:
workflow_call:
secrets:
PAT:
required: true

on: [push, pull_request, workflow_dispatch]
jobs:
nix:
name: "Build Hyprland (Nix)"
update:
name: wlroots
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: recursive
token: ${{ secrets.PAT }}

- 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: |
auto-optimise-store = true
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
experimental-features = nix-command flakes
- uses: cachix/cachix-action@v12

- name: Update lockfile
run: nix/update-wlroots.sh

- 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
commit_message: "[gha] Nix: update wlroots"