Merge pull request #20 from nix-community/github-action-support

This commit is contained in:
Jörg Thalheim 2020-08-14 20:17:44 +01:00 committed by GitHub
commit 5905d8221d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 74 additions and 6 deletions

6
.github/dependabot.yml vendored Normal file
View file

@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

56
.github/workflows/build.yml vendored Normal file
View file

@ -0,0 +1,56 @@
name: "Build and populate cache"
on:
pull_request:
push:
schedule:
# rebuild everyday at 2:51
# TIP: Choose a random time here so not all repositories are build at once:
# https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new
- cron: '51 2 * * *'
jobs:
tests:
strategy:
matrix:
# Set this to notify the global nur package registry that changes are
# available.
#
# The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json
nurRepo:
- <YOUR_REPO_NAME>
# Set this to cache your build results in cachix for faster builds
# in CI and for everyone who uses your cache.
#
# Format: Your cachix cache host name without the ".cachix.org" suffix.
# Example: mycache (for mycache.cachix.org)
#
# For this to work, you also need to set the CACHIX_SIGNING_KEY secret
# in your repository settings in Github found at https://github.com/<your_githubname>/nur-packages/settings/secrets
cachixName:
- <YOUR_CACHIX_NAME>
nixPath:
- nixpkgs=channel:nixos-unstable
- nixpkgs=channel:nixpkgs-unstable
- nixpkgs=channel:nixos-20.03
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2.3.1
- name: Install nix
uses: cachix/install-nix-action@v10
with:
nix_path: "${{ matrix.nixPath }}"
- name: Show nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
- name: Setup cachix
uses: cachix/cachix-action@v6
if: ${{ matrix.cachixName != '<YOUR_CACHIX_NAME>' }}
with:
name: ${{ matrix.cachixName }}
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Build nix packages
# TODO switch to default nixpkgs channel once nix-build-uncached 1.0.0 is in stable
run: nix run -I 'nixpkgs=channel:nixos-unstable' nixpkgs.nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs
- name: Trigger NUR update
if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }}
run: curl -XPOST "https://nur-update.herokuapp.com/update?repo=${{ matrix.nurRepo }}"

View file

@ -10,11 +10,11 @@
* Remember to mark the broken packages as `broken = true;` in the `meta`
attribute, or travis (and consequently caching) will fail!
* Library functions, modules and overlays go in the respective directories
3. Add your NUR repo name and your cachix repo name (optional) to
[.travis.yml](./.travis.yml)
4. Enable travis for your repo
* You can add a cron job in the repository settings on travis to keep your
cachix cache fresh
3. Choose your CI: Depending on your preference you can use github actions (recommended) or [Travis ci](https://travis-ci.com).
- Github actions: Change your NUR repo name and optionally add a cachix name in [.github/workflows/build.yml](./.github/workflows/build.yml) and change the cron timer
to a random value as described in the file
- Travis ci: Change your NUR repo name and optionally your cachix repo name in
[.travis.yml](./.travis.yml). Than enable travis in your repo. You can add a cron job in the repository settings on travis to keep your cachix cache fresh
5. Change your travis and cachix names on the README template section and delete
the rest
6. [Add yourself to NUR](https://github.com/nix-community/NUR#how-to-add-your-own-repository)
@ -25,7 +25,13 @@
**My personal [NUR](https://github.com/nix-community/NUR) repository**
<!-- Remove this if you don't use github actions -->
![Build and populate cache](https://github.com/nix-community/<YOUR-GITHUB-USER>/workflows/Build%20and%20populate%20cache/badge.svg)
<!--
Uncomment this if you use travis:
[![Build Status](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages.svg?branch=master)](https://travis-ci.com/<YOUR_TRAVIS_USERNAME>/nur-packages)
-->
[![Cachix Cache](https://img.shields.io/badge/cachix-<YOUR_CACHIX_CACHE_NAME>-blue.svg)](https://<YOUR_CACHIX_CACHE_NAME>.cachix.org)