test workflow

This commit is contained in:
Dmitriy Kholkin 2023-06-14 03:54:55 +03:00
parent 19939ce067
commit 14f8a90749
2 changed files with 41 additions and 0 deletions

35
.github/workflows/cache.yml vendored Normal file
View File

@ -0,0 +1,35 @@
name: "Build system and deploy to cache"
on:
push:
branches:
- master
paths:
- 'flake.lock'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v21
with:
nix_path: 'nixpkgs=channel:nixos-unstable'
github_access_token: ${{ secrets.GITHUB_TOKEN }}
extra_nix_config: "
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}\n
substituters = https://cache.nixos.org https://nix-community.cachix.org https://hyprland.cachix.org https://ataraxiadev-foss.cachix.org https://cache.ataraxiadev.com/ataraxiadev\n
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc= ataraxiadev-foss.cachix.org-1:ws/jmPRUF5R8TkirnV1b525lP9F/uTBsz2KraV61058= ataraxiadev:V/fCdvz1bMsQzYZcLltcAULST+MoChv53EfedmyJ8Uw=\n
netrc-file = /home/runner/.config/nix/netrc
"
- name: Setup attic cache
run: |
mkdir -p /home/runner/.config/nix
echo "machine cache.ataraxiadev.com" > /home/runner/.config/nix/netrc
echo "password ${{ secrets.ATTIC_TOKEN }}" >> /home/runner/.config/nix/netrc
nix run github:AtaraxiaSjel/attic#attic -- login dev https://cache.ataraxiadev.com/ ${{ secrets.ATTIC_TOKEN }}
- name: Build system and push to cache
run: |
nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix
nix run github:AtaraxiaSjel/attic#attic -- attic push ataraxiadev ./result

6
ci.nix Normal file
View File

@ -0,0 +1,6 @@
let
outputs = builtins.getFlake (toString ./.);
pkgs = outputs.inputs.nixpkgs;
host-workstation = pkgs.lib.collect pkgs.lib.isDerivation outputs.packages.x86_64-linux.host-workstation;
host-hypervisor = pkgs.lib.collect pkgs.lib.isDerivation outputs.packages.x86_64-linux.host-hypervisor;
in host-workstation ++ host-hypervisor