Bladeren bron

feat: nutshell on self hosted (#1416)

tsk 4 weken geleden
bovenliggende
commit
48a900c67f
2 gewijzigde bestanden met toevoegingen van 33 en 54 verwijderingen
  1. 18 52
      .github/workflows/nutshell_itest.yml
  2. 15 2
      justfile

+ 18 - 52
.github/workflows/nutshell_itest.yml

@@ -10,38 +10,25 @@ on:
   release:
     types: [created]
 
+# Cancel previous runs on same PR
+concurrency:
+  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   nutshell-integration-tests:
     name: Nutshell Mint Integration Tests
-    runs-on: ubuntu-latest
+    runs-on: self-hosted
     timeout-minutes: 30
     steps:
       - name: checkout
         uses: actions/checkout@v4
-      - name: Get flake hash
-        id: flake-hash
-        run: echo "hash=$(sha256sum flake.lock | cut -d' ' -f1 | cut -c1-8)" >> $GITHUB_OUTPUT
-      - name: Free Disk Space (Ubuntu)
-        uses: jlumbroso/free-disk-space@main
-        with:
-          tool-cache: false
-          android: true
-          dotnet: true
-          haskell: true
-          large-packages: true
-          docker-images: true
-          swap-storage: true
-      - name: Install Nix
-        uses: DeterminateSystems/nix-installer-action@v17
-      - name: Nix Cache
-        uses: DeterminateSystems/magic-nix-cache-action@main
-        with:
-          diagnostic-endpoint: ""
-          use-flakehub: false
-      - name: Rust Cache
-        uses: Swatinem/rust-cache@v2
+      - uses: cachix/cachix-action@v16
         with:
-          shared-key: "integration-${{ steps.flake-hash.outputs.hash }}"
+          name: cashudevkit
+          authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
+          useDaemon: false
+        continue-on-error: true
       - name: Test Nutshell
         run: nix develop -i -L .#integration --command just test-nutshell
       - name: Show logs if tests fail
@@ -50,40 +37,19 @@ jobs:
 
   nutshell-wallet-integration-tests:
     name: Nutshell Wallet Integration Tests
-    runs-on: ubuntu-latest
+    runs-on: self-hosted
     timeout-minutes: 30
     steps:
       - name: checkout
         uses: actions/checkout@v4
-      - name: Get flake hash
-        id: flake-hash
-        run: echo "hash=$(sha256sum flake.lock | cut -d' ' -f1 | cut -c1-8)" >> $GITHUB_OUTPUT
-      - name: Free Disk Space (Ubuntu)
-        uses: jlumbroso/free-disk-space@main
-        with:
-          tool-cache: false
-          android: true
-          dotnet: true
-          haskell: true
-          large-packages: true
-          docker-images: true
-          swap-storage: true
-      - name: Pull Nutshell Docker image
-        run: docker pull cashubtc/nutshell:latest
-      - name: Install Nix
-        uses: DeterminateSystems/nix-installer-action@v17
-      - name: Nix Cache
-        uses: DeterminateSystems/magic-nix-cache-action@main
-        with:
-          diagnostic-endpoint: ""
-          use-flakehub: false
-      - name: Rust Cache
-        uses: Swatinem/rust-cache@v2
+      - uses: cachix/cachix-action@v16
         with:
-          shared-key: "integration-${{ steps.flake-hash.outputs.hash }}"
+          name: cashudevkit
+          authToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
+          useDaemon: false
+        continue-on-error: true
       - name: Test Nutshell Wallet
-        run: |
-          nix develop -i -L .#integration --command just nutshell-wallet-itest
+        run: nix develop -i -L .#integration --command just nutshell-wallet-itest
       - name: Show Docker logs if tests fail
         if: failure()
         run: docker logs nutshell-wallet || true

+ 15 - 2
justfile

@@ -180,8 +180,12 @@ test-nutshell:
   
   # Trap to ensure cleanup happens on exit (success or failure)
   trap cleanup EXIT
-  
-  docker run -d -p 3338:3338 --name nutshell -e MINT_LIGHTNING_BACKEND=FakeWallet -e MINT_LISTEN_HOST=0.0.0.0 -e MINT_LISTEN_PORT=3338 -e MINT_PRIVATE_KEY=TEST_PRIVATE_KEY -e MINT_INPUT_FEE_PPK=100  cashubtc/nutshell:latest poetry run mint
+
+  # Clean up any leftover containers from previous runs
+  docker stop nutshell 2>/dev/null || true
+  docker rm nutshell 2>/dev/null || true
+
+  docker run -d --network=host --name nutshell -e MINT_LIGHTNING_BACKEND=FakeWallet -e MINT_LISTEN_HOST=0.0.0.0 -e MINT_LISTEN_PORT=3338 -e MINT_PRIVATE_KEY=TEST_PRIVATE_KEY -e MINT_INPUT_FEE_PPK=100  cashubtc/nutshell:latest poetry run mint
   
   export CDK_ITESTS_DIR=$(mktemp -d)
 
@@ -193,9 +197,18 @@ test-nutshell:
     attempt=$((attempt+1))
     if [ $attempt -ge $max_attempts ]; then
       echo "Nutshell failed to start after $max_attempts attempts"
+      echo "=== Docker container status ==="
+      docker ps -a --filter name=nutshell
+      echo "=== Docker logs ==="
+      docker logs nutshell 2>&1 || true
       exit 1
     fi
     echo "Waiting for Nutshell to start (attempt $attempt/$max_attempts)..."
+    # Show container status every 10 attempts
+    if [ $((attempt % 10)) -eq 0 ]; then
+      echo "=== Container status check ==="
+      docker ps -a --filter name=nutshell
+    fi
     sleep 1
   done
   echo "Nutshell is ready!"