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

feat(modules): use package set for port sources #384

Merged
merged 20 commits into from
Dec 27, 2024
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
12 changes: 0 additions & 12 deletions .github/checkSources.nix

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/backport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Based on https://github.com/NixOS/nixpkgs/blob/c81ecdf95b3a0f73ded448f14416cd66beeb5e1a/.github/workflows/backport.yml
name: Backport

on:
pull_request_target:
types: [closed, labeled]

# WARNING:
# When extending this action, be aware that $GITHUB_TOKEN allows write access to
# the GitHub repository. This means that it should not evaluate user input in a
# way that allows code injection.

jobs:
backport:
name: Backport Pull Request

if: ${{ github.repository_owner == 'catppuccin' && github.event.pull_request.merged == true && (github.event_name != 'labeled' || startsWith('backport', github.event.label.name)) }}

runs-on: ubuntu-latest

permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}

- name: Create backport PRs
uses: korthout/backport-action@v3
with:
pull_description: |-
Bot-based backport to `${target_branch}`, triggered by a label in #${pull_number}.
88 changes: 36 additions & 52 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,56 @@ name: CI

on:
push:
branches: [main]
branches: [ main ]
paths:
- '.sources/**'
- '**.lock'
- '**.nix'
- 'flake.lock'

- '.github/workflows/ci.yml'
pull_request:
paths:
- '.sources/**'
- '**.lock'
- '**.nix'
- 'flake.lock'

- '.github/workflows/ci.yml'
workflow_dispatch:

jobs:
format:
name: Format Nix files
packages:
name: Build Packages

if: github.repository_owner == 'Catppuccin' && github.event_name == 'push' || github.event_name == 'workflow_dispatch'
strategy:
fail-fast: false
matrix:
os: [ macos-latest, macos-13, ubuntu-latest ]

runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PUSH_TOKEN }}

- name: Set Git user info
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Get short revision
id: rev
run:
echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Format changes
run: |
nix run \
--inputs-from ./dev \
'nixpkgs#nixfmt-rfc-style' -- .
- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: catppuccin
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Commit changes
- name: Run build
run: |
if ! git diff --color=always --exit-code; then
git commit -am "style: format ${{ steps.rev.outputs.rev }}"
git push
fi
nix run .#build-outputs -- 'packages'

test:
modules:
name: Test Modules
needs: packages

strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest]
os: [ macos-latest, ubuntu-latest ]

runs-on: ${{ matrix.os }}

Expand All @@ -71,30 +62,23 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Setup cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: catppuccin
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Run tests
run: |
nix run \
--inputs-from ./dev \
github:Mic92/nix-fast-build -- \
--no-nom \
--flake "./dev#checks.$(nix eval --raw --impure --expr builtins.currentSystem)"
nix run .#build-outputs -- 'checks'

validate-sources:
name: Validate sources
release-gate:
name: Release Gate
needs: [ modules, packages ]

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Check for external repositories
run: |
set -e
nix eval --file ./.github/checkSources.nix
- name: Exit with error
if: ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
run: exit 1
46 changes: 46 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Format

on:
push:
branches: [ main ]
paths:
- "**.nix"

- ".github/workflows/format.yml"
workflow_dispatch:

jobs:
nix:
name: Nix files

runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.PUSH_TOKEN }}

- name: Set Git user info
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'

- name: Get short revision
id: rev
run:
echo "rev=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Format changes
run: |
nix fmt

- name: Commit changes
run: |
if ! git diff --color=always --exit-code; then
git commit -am "style: format ${{ steps.rev.outputs.rev }}"
git push
fi
57 changes: 0 additions & 57 deletions .github/workflows/update-locks.yml

This file was deleted.

13 changes: 10 additions & 3 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,16 @@ on:
- 'CHANGELOG.md'
- '**.lock'
- '**.nix'

- '.github/workflows/website.yml'
pull_request:
paths:
- 'docs/**'
- 'CHANGELOG.md'
- '**.lock'
- '**.nix'

- '.github/workflows/website.yml'
workflow_dispatch:

jobs:
Expand All @@ -29,15 +33,18 @@ jobs:
- name: Install Nix
uses: cachix/install-nix-action@V27

- name: Setup cache
uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Install Cachix
uses: cachix/cachix-action@v15
with:
name: catppuccin
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}

- name: Run build
run: |
nix build \
--print-build-logs \
--show-trace \
'./dev#site'
'.#site'

- name: Get artifact directory
id: find-path
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
result
result-*
repl-result-*

gcroot/
65 changes: 0 additions & 65 deletions .sources/default.nix

This file was deleted.

Loading
Loading