Skip to content

Commit be316f3

Browse files
authored
Merge pull request #168 from input-output-hk/fix-nix-build
Improve nix setup and fix nix build
2 parents 5a00f51 + 905a58a commit be316f3

File tree

20 files changed

+168
-80
lines changed

20 files changed

+168
-80
lines changed

.github/CODEOWNERS

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# DEVOPS
2+
3+
/.github/action/nix-common-setup* @input-output-hk/jormungandr-devops
4+
/.github/workflows/nix.yml @input-output-hk/jormungandr-devops
5+
/default.nix @input-output-hk/jormungandr-devops
6+
/flake.lock @input-output-hk/jormungandr-devops
7+
/flake.nix @input-output-hk/jormungandr-devops
8+
/shell.nix @input-output-hk/jormungandr-devops
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Setup Nix Environment
2+
inputs:
3+
CACHIX_AUTH_TOKEN:
4+
required: true
5+
description: 'Cachix Auth Token'
6+
runs:
7+
using: "composite"
8+
steps:
9+
10+
- name: Installing Nix
11+
uses: cachix/install-nix-action@v16
12+
with:
13+
nix_path: nixpkgs=channel:nixpkgs-unstable
14+
15+
- uses: cachix/cachix-action@v10
16+
with:
17+
name: iog
18+
authToken: '${{ inputs.CACHIX_AUTH_TOKEN }}'

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
4+
- package-ecosystem: github-actions
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
time: '00:00'
9+
timezone: UTC
10+
open-pull-requests-limit: 10
11+
commit-message:
12+
prefix: "chore"
13+
include: "scope"

.github/workflows/nix.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Nix CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
- catalyst-fund*
7+
pull_request:
8+
9+
jobs:
10+
decision:
11+
name: Decide what we need to build
12+
runs-on: ubuntu-latest
13+
14+
outputs:
15+
packages: ${{ steps.packages.outputs.packages }}
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Setup
22+
uses: ./.github/actions/nix-common-setup
23+
with:
24+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
25+
26+
- name: Packages
27+
id: packages
28+
run: |
29+
packages=$(nix eval .#packages.x86_64-linux --apply builtins.attrNames --json)
30+
echo "PACKAGES -> $packages"
31+
echo "::set-output name=packages::$packages"
32+
33+
build:
34+
name: Build ${{ matrix.package }} package
35+
needs:
36+
- decision
37+
runs-on: ubuntu-latest
38+
39+
strategy:
40+
fail-fast: false
41+
matrix:
42+
package: ${{ fromJSON(needs.decision.outputs.packages) }}
43+
exclude:
44+
- package: default
45+
46+
steps:
47+
48+
- name: Checkout
49+
uses: actions/checkout@v3
50+
51+
- name: Setup
52+
uses: ./.github/actions/nix-common-setup
53+
with:
54+
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
55+
56+
- name: Build package
57+
run: |
58+
path=$(nix eval --raw .#packages.x86_64-linux.${{ matrix.package }})
59+
hash=${path:11:32}
60+
url="https://iog.cachix.org/$hash.narinfo";
61+
if curl --output /dev/null --silent --head --fail "$url"; then
62+
echo "Nothing to build!!!"
63+
echo ""
64+
echo "See build log with:"
65+
echo " nix log $path"
66+
echo ""
67+
else
68+
nix build .#packages.x86_64-linux.${{ matrix.package }} --show-trace -L
69+
fi
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: update-flake-lock
2+
on:
3+
workflow_dispatch: # allows manual triggering
4+
schedule:
5+
- cron: '0 0 * * 0' # runs weekly on Sunday at 00:00
6+
7+
jobs:
8+
lockfile:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
- name: Install Nix
14+
uses: cachix/install-nix-action@v17
15+
with:
16+
extra_nix_config: |
17+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
18+
- name: Update flake.lock
19+
uses: DeterminateSystems/update-flake-lock@v14

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
This file was deleted.

Cargo.lock

Lines changed: 16 additions & 31 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

0 commit comments

Comments
 (0)