From 1ecaceb94f7cd39a5e7ee8184e770d64d6b6e164 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 4 Jun 2020 16:04:01 +0100 Subject: [PATCH 1/5] add github action support --- .github/workflows/build.yml | 55 +++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..38ec33c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,55 @@ +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: + - mic92 + # 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//nur-packages/settings/secrets + cachixName: + - + 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 {}).lib.version' + - name: Setup cachix + uses: cachix/cachix-action@v6 + if: ${{ matrix.cachixName != '' }} + 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 + run: curl -XPOST "https://nur-update.herokuapp.com/update?repo=${{ matrix.nurRepo }}" From b6beae4e40faeae86b445435b83ab4d89a6d8133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Mon, 3 Aug 2020 09:29:45 +0100 Subject: [PATCH 2/5] add dependabot to keep github actions up-to-date --- .github/dependabot.yml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5ace460 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" From 391dd61e7ca3f020326594fb824d44fcf0979176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Thu, 13 Aug 2020 08:48:38 +0100 Subject: [PATCH 3/5] README: add github actions documentation --- README.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e719544..4416b96 100644 --- a/README.md +++ b/README.md @@ -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,14 @@ **My personal [NUR](https://github.com/nix-community/NUR) repository** + +![Build and populate cache](https://github.com/nix-community//workflows/Build%20and%20populate%20cache/badge.svg) + + [![Cachix Cache](https://img.shields.io/badge/cachix--blue.svg)](https://.cachix.org) From 7f2bf9072117b2df2ea253d53eeb86c2b0b53123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 14 Aug 2020 13:31:32 +0100 Subject: [PATCH 4/5] Update README.md Co-authored-by: zimbatm --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 4416b96..d543d44 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ **My personal [NUR](https://github.com/nix-community/NUR) repository** -![Build and populate cache](https://github.com/nix-community//workflows/Build%20and%20populate%20cache/badge.svg) +![Build and populate cache](https://github.com/nix-community//workflows/Build%20and%20populate%20cache/badge.svg) [![Cachix Cache](https://img.shields.io/badge/cachix--blue.svg)](https://.cachix.org) - From 52d63e8b8edfb397b03964d763a8adbced17844e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Fri, 14 Aug 2020 13:36:36 +0100 Subject: [PATCH 5/5] github actions: better defaults in case someone forgets to update those --- .github/workflows/build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 38ec33c..8f9207e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,7 +17,7 @@ jobs: # The repo name as used in # https://github.com/nix-community/NUR/blob/master/repos.json nurRepo: - - mic92 + - # Set this to cache your build results in cachix for faster builds # in CI and for everyone who uses your cache. # @@ -27,7 +27,7 @@ jobs: # 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//nur-packages/settings/secrets cachixName: - - + - nixPath: - nixpkgs=channel:nixos-unstable - nixpkgs=channel:nixpkgs-unstable @@ -44,7 +44,7 @@ jobs: run: nix-instantiate --eval -E '(import {}).lib.version' - name: Setup cachix uses: cachix/cachix-action@v6 - if: ${{ matrix.cachixName != '' }} + if: ${{ matrix.cachixName != '' }} with: name: ${{ matrix.cachixName }} signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' @@ -52,4 +52,5 @@ jobs: # 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 != '' }} run: curl -XPOST "https://nur-update.herokuapp.com/update?repo=${{ matrix.nurRepo }}"