Skip to content

Commit

Permalink
Add Monero CI infra
Browse files Browse the repository at this point in the history
  • Loading branch information
kayabaNerve committed May 13, 2024
1 parent e4fb2bc commit 41a3283
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/actions/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022-2024 Luke Parker

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
49 changes: 49 additions & 0 deletions .github/actions/monero-wallet-rpc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: monero-wallet-rpc
description: Spawns a Monero Wallet-RPC.

inputs:
version:
description: "Version to download and run"
required: false
default: v0.18.3.1

runs:
using: "composite"
steps:
- name: Monero Wallet RPC Cache
id: cache-monero-wallet-rpc
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
with:
path: monero-wallet-rpc
key: monero-wallet-rpc-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}

- name: Download the Monero Wallet RPC
if: steps.cache-monero-wallet-rpc.outputs.cache-hit != 'true'
# Calculates OS/ARCH to demonstrate it, yet then locks to linux-x64 due
# to the contained folder not following the same naming scheme and
# requiring further expansion not worth doing right now
shell: bash
run: |
RUNNER_OS=${{ runner.os }}
RUNNER_ARCH=${{ runner.arch }}
RUNNER_OS=${RUNNER_OS,,}
RUNNER_ARCH=${RUNNER_ARCH,,}
RUNNER_OS=linux
RUNNER_ARCH=x64
FILE=monero-$RUNNER_OS-$RUNNER_ARCH-${{ inputs.version }}.tar.bz2
wget https://downloads.getmonero.org/cli/$FILE
tar -xvf $FILE
mv monero-x86_64-linux-gnu-${{ inputs.version }}/monero-wallet-rpc monero-wallet-rpc
- name: Monero Wallet RPC
shell: bash
run: |
./monero-wallet-rpc --allow-mismatched-daemon-version \
--daemon-address 0.0.0.0:18081 --daemon-login user:pass \
--disable-rpc-login --rpc-bind-port 18082 \
--wallet-dir ./ \
--detach
46 changes: 46 additions & 0 deletions .github/actions/monero/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: monero-regtest
description: Spawns a regtest Monero daemon

inputs:
version:
description: "Version to download and run"
required: false
default: v0.18.3.1

runs:
using: "composite"
steps:
- name: Monero Daemon Cache
id: cache-monerod
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2
with:
path: /usr/bin/monerod
key: monerod-${{ runner.os }}-${{ runner.arch }}-${{ inputs.version }}

- name: Download the Monero Daemon
if: steps.cache-monerod.outputs.cache-hit != 'true'
# Calculates OS/ARCH to demonstrate it, yet then locks to linux-x64 due
# to the contained folder not following the same naming scheme and
# requiring further expansion not worth doing right now
shell: bash
run: |
RUNNER_OS=${{ runner.os }}
RUNNER_ARCH=${{ runner.arch }}
RUNNER_OS=${RUNNER_OS,,}
RUNNER_ARCH=${RUNNER_ARCH,,}
RUNNER_OS=linux
RUNNER_ARCH=x64
FILE=monero-$RUNNER_OS-$RUNNER_ARCH-${{ inputs.version }}.tar.bz2
wget https://downloads.getmonero.org/cli/$FILE
tar -xvf $FILE
sudo mv monero-x86_64-linux-gnu-${{ inputs.version }}/monerod /usr/bin/monerod
sudo chmod 777 /usr/bin/monerod
sudo chmod +x /usr/bin/monerod
- name: Monero Regtest Daemon
shell: bash
run: PATH=$PATH:/usr/bin ./orchestration/dev/coins/monero/run.sh --detach
6 changes: 6 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ jobs:
- name: Setup Litecoin
run: ./ci/setup-coins/litecoin.sh

- name: Run a Monero Regtest Node
uses: ./.github/actions/monero

- name: Run a Monero Wallet-RPC
uses: ./.github/actions/monero-wallet-rpc

- name: Setup Monero
run: ./ci/setup-coins/monero.sh

Expand Down
16 changes: 16 additions & 0 deletions ci/setup-coins/monero.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/bash
set -euxo pipefail

config_dir="$(pwd)/config"
mkdir -p "$config_dir"

cat > "$config_dir/monero.json" << EOF
{
"daemon": "http://127.0.0.1:18081",
"wallet": "http://127.0.0.1:18082",
"wallet_user": "user",
"wallet_pass": "pass",
"destination": "42L9GkQeerChpA4rz4MTagL5mBGbEnvPzWLRL5vfJTr3bd8Diz6okcpd9vkxerLXHADdPMbTW9Xk8JcWj8WbeGEmD3aKdsi",
"refund": "42L9GkQeerChpA4rz4MTagL5mBGbEnvPzWLRL5vfJTr3bd8Diz6okcpd9vkxerLXHADdPMbTW9Xk8JcWj8WbeGEmD3aKdsi"
}
EOF

0 comments on commit 41a3283

Please sign in to comment.