Skip to content

Commit

Permalink
*: Migrate to Nix flakes, deprecate non-GHA CI
Browse files Browse the repository at this point in the history
This simplifies the project setup and makes it easier to maintain the
CI pipeline.
  • Loading branch information
diamondburned committed Oct 14, 2024
1 parent 85debd9 commit 8c46c5b
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 139 deletions.
48 changes: 0 additions & 48 deletions .build.yml

This file was deleted.

44 changes: 17 additions & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,13 @@ on:
type: boolean

jobs:
nix-env:
name: Initialize Nix
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Nix packages
uses: diamondburned/cache-install@main

generate:
name: Generate
needs: [nix-env]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Nix packages
uses: diamondburned/cache-install@main
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Generate
run: |
Expand All @@ -46,46 +35,46 @@ jobs:
fi
env:
GITHUB_REF: ${{ github.ref }}
shell: nix develop -c {0}

build:
name: Build
runs-on: ubuntu-latest
needs: [generate]
steps:
- uses: actions/checkout@v2

- name: Install Nix packages
uses: diamondburned/cache-install@main
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Build
run: go build ./...
run: go build -v ./...
shell: nix develop -c {0}

unit-test:
name: Unit Test
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2

- name: Install Nix packages
uses: diamondburned/cache-install@main
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Test
run: go test $TEST_FLAGS ./...
env:
TEST_FLAGS: >-
-v=${{ runner.debug && '1' || '0' }}
shell: nix develop -c {0}

integration-test:
name: Integration Test
concurrency: integration-test
runs-on: ubuntu-latest
needs: [build]
steps:
- uses: actions/checkout@v2

- name: Install Nix packages
uses: diamondburned/cache-install@main
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main

- name: Test
run: |
Expand All @@ -99,6 +88,7 @@ jobs:
GUILD_ID: ${{ secrets.GUILD_ID }}
VOICE_ID: ${{ secrets.VOICE_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
shell: nix develop -c {0}

- name: Upload coverage profile
uses: actions/upload-artifact@v3
Expand Down
53 changes: 0 additions & 53 deletions .gitlab-ci.yml

This file was deleted.

61 changes: 61 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs =
{
self,
nixpkgs,
flake-utils,
}:

flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = pkgs.mkShell {
packages = with pkgs; [
go_1_22
gopls
go-tools

nixfmt-rfc-style
];
};
}
);
}
11 changes: 0 additions & 11 deletions shell.nix

This file was deleted.

0 comments on commit 8c46c5b

Please sign in to comment.