Skip to content

Commit

Permalink
Switch to self-hosted CI machine.
Browse files Browse the repository at this point in the history
  • Loading branch information
locallycompact committed Sep 19, 2024
1 parent aa61177 commit 3048284
Show file tree
Hide file tree
Showing 13 changed files with 206 additions and 99 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/cachix-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Cachix push

on:
pull_request:

jobs:
cachix:
name: Cachix push
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4

- name: ❄ Prepare nix
uses: cachix/install-nix-action@V28
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: 📐 Cachix push
run: |
export CACHIX_AUTH_TOKEN="${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}"
nix run .#cachix-push
96 changes: 23 additions & 73 deletions .github/workflows/ci-nix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ permissions:
jobs:
build-test:
name: "Build & test"
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
strategy:
matrix:
include:
- package: plutus-cbor
- package: plutus-merkle-tree
- package: hydra-plutus
- package: hydra-tui
- package: hydra-node
- package: hydra-tui
- package: hydra-tx
- package: hydra-cluster
steps:
Expand All @@ -44,32 +44,22 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: ❓ Test
if: ${{ matrix.package != 'hydra-tui' }}
if: ${{ matrix.package != 'hydra-tui'
&& matrix.package != 'hydra-cluster'
&& matrix.package != 'hydra-node'
}}
run: |
cd ${{ matrix.package }}
nix build .#${{ matrix.package }}-tests
nix develop .#${{ matrix.package }}-tests --command tests
# This one is special, as it requires a tty.
- name: ❓ Test (TUI)
id: test_tui
if: ${{ matrix.package == 'hydra-tui' }}
# https://giters.com/gfx/example-github-actions-with-tty
# The default shell does not allocate a TTY which breaks some tests
shell: 'script -q -e -c "bash {0}"'
env:
TERM: "xterm"
- name: ❓ Test
if: ${{ matrix.package == 'hydra-cluster'
|| matrix.package == 'hydra-node'
|| matrix.package == 'hydra-tui' }}
run: |
cd ${{ matrix.package }}
nix build .#${{ matrix.package }}-tests
nix develop .#${{ matrix.package }}-tests --command tests
nix build --option sandbox false .#checks.x86_64-linux.${{ matrix.package }} -L
- name: 💾 Upload build & test artifacts
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -107,7 +97,7 @@ jobs:

haddock:
name: "Build haddock using nix"
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
Expand All @@ -119,27 +109,19 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: 📚 Documentation (Haddock)
run: |
nix build .#haddocks
mkdir -p haddocks
cp -aL result/* haddocks/
- name: 💾 Upload haddock artifact
uses: actions/upload-artifact@v4
with:
name: haddocks
path: haddocks
path: result

benchmarks:
name: "Benchmarks"
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
strategy:
matrix:
include:
Expand All @@ -166,12 +148,6 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: 📈 Benchmark
run: |
mkdir -p benchmarks
Expand Down Expand Up @@ -199,7 +175,7 @@ jobs:
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository
# TODO: this is actually only requires the tx-cost benchmark results
needs: [benchmarks]
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Download generated documentation
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -233,7 +209,7 @@ jobs:

nix-flake-check:
name: "nix flake check"
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
Expand All @@ -245,20 +221,14 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: ❄ Nix Flake Check
run: |
nix flake check -L
nix --option sandbox false flake check -L
build-specification:
name: "Build specification using nix"
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
Expand All @@ -270,12 +240,6 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: ❄ Build specification PDF
run: |
nix build .#spec && cp result/*.pdf .
Expand All @@ -290,7 +254,7 @@ jobs:
documentation:
name: Documentation
needs: [haddock,benchmarks,build-test,build-specification]
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
Expand All @@ -307,25 +271,11 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: Set up and use the "ci" devShell
uses: nicknovitski/nix-develop@v1
with:
arguments: ".#ci"

# Technically, we don't need this, given we're in a Nix shell;
# but we will keep it for the caching.
- name: 🚧 Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
cache: 'yarn'
cache-dependency-path: docs/yarn.lock

- name: ❓ Test API reference
working-directory: docs
run: |
yarn
yarn validate
nix develop .#ci --command yarn
nix develop .#ci --command bash -c "yarn validate"
- name: 📥 Download benchmark results
uses: actions/download-artifact@v4
Expand Down Expand Up @@ -356,5 +306,5 @@ jobs:
- name: 📚 Documentation sanity check
working-directory: docs
run: |
yarn
yarn build-dev
nix develop .#ci --command yarn
nix develop .#ci --command bash -c "yarn build-dev"
8 changes: 1 addition & 7 deletions .github/workflows/formatting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:
formatting:
name: Check code formatting
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v4
Expand All @@ -18,12 +18,6 @@ jobs:
accept-flake-config = true
log-lines = 1000
- name: ❄ Cachix cache of nix derivations
uses: cachix/cachix-action@v15
with:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: 📐 Check code formatting
run: |
nix build .#checks.x86_64-linux.treefmt
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# <p align="center">Hydra :dragon_face:</p>


<div align="center">
<p>Implementation of the Hydra scalability protocols.</p>
<a href='https://github.com/cardano-scaling/hydra/actions'><img src="https://img.shields.io/github/actions/workflow/status/cardano-scaling/hydra/ci-nix.yaml?branch=master&label=Tests&style=for-the-badge" /></a>
Expand Down
30 changes: 23 additions & 7 deletions flake.lock

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

Loading

0 comments on commit 3048284

Please sign in to comment.