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 16, 2024
1 parent 9ed5ded commit 18475b6
Show file tree
Hide file tree
Showing 6 changed files with 430 additions and 134 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/cachix-push.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: "Cachix Push"

on:
workflow_run:
workflows: ["CI"]
branches: [master]
types:
- completed

jobs:
cachix-push:
name: Cachix Push
runs-on: [self-hosted, nixos]
permissions:
contents: write
# if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:

- name: 📥 Checkout repository
uses: actions/checkout@v4
with:
repository: cardano-scaling/hydra
ref: release
# Also ensure we have all history with all tags
fetch-depth: 0

- name: ❄ Prepare nix
uses: cachix/install-nix-action@V27
with:
extra_nix_config: |
accept-flake-config = true
log-lines = 1000
- name: Push Cachix
id: cachix-push
uses: actions/github-script@v7
with:
script: nix run .#cachix-push
57 changes: 10 additions & 47 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,12 +44,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: ❓ Test
if: ${{ matrix.package != 'hydra-tui' }}
run: |
Expand All @@ -60,11 +54,6 @@ jobs:
- 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"
run: |
cd ${{ matrix.package }}
nix build .#${{ matrix.package }}-tests
Expand All @@ -91,7 +80,7 @@ jobs:
publish-test-results:
name: Publish test results
needs: [build-test]
runs-on: ubuntu-latest
runs-on: [self-hosted, nixos]
steps:
- name: 📥 Download test results
uses: actions/download-artifact@v4
Expand All @@ -106,7 +95,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 @@ -118,27 +107,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 @@ -165,12 +146,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 @@ -198,7 +173,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 @@ -232,7 +207,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 @@ -244,20 +219,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
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 @@ -269,12 +238,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 @@ -289,7 +252,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 Down
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
Loading

0 comments on commit 18475b6

Please sign in to comment.