-
Notifications
You must be signed in to change notification settings - Fork 9
executable file
·93 lines (77 loc) · 3.64 KB
/
Copy pathtestnet-hetzner.yml
File metadata and controls
executable file
·93 lines (77 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: public cloud testnet
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc
# https://github.com/<org>/<repo>/settings/secrets/actions/new
# - HCLOUD_TOKEN # console.hetzner.cloud -> [select project] -> security -> API Tokens -> Generate API Token (Red)
# - SSH_PRIVATE_KEY # The raw contents of an RSA / ed25519 private key (cat ~/.ssh/id_ed25519)
env:
# NOTE: Your repo must be public to use this action. If not, use the self hosted action.
GO_VERSION: 1.22.3
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
LOCALIC_PORT: 8080
LOCALIC_AUTH_KEY: ""
HETZNER_SSH_KEY: "reece-hetzner" # console.hetzner.cloud -> [select project] -> security -> Add SSH Key
# HETZNER_MACHINE_TYPE: "cpx31" # shared 4vCPU ($7/Mo)
HETZNER_MACHINE_TYPE: "ccx23" # dedicated 4 CPU 16GB Ram ($25/Mo)z
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
launch-testnet:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: TimDaub/hetzner-cloud-deploy-server-action@v2
with:
# gh-actions-tn-v1.0.0
server-name: "gh-actions-tn-${{github.ref_name}}"
server-image: "ubuntu-22.04"
server-type: ${{ env.HETZNER_MACHINE_TYPE }}
ssh-key-name: ${{ env.HETZNER_SSH_KEY }}
delete-server: false
startup-timeout: 40000 # ms
hcloud-token: ${{ secrets.HCLOUD_TOKEN }}
- name: Set env variables
run: |
mkdir -p ~/.ssh/ && ssh-keyscan -H $SERVER_IPV4 >> ~/.ssh/known_hosts
echo "SERVER_IPV4_ADDR=$SERVER_IPV4" >> $GITHUB_ENV
echo "GITHUB_SHA=${{github.sha}}" >> $GITHUB_ENV
echo "GITHUB_REF_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
echo "LOCALIC_PORT=${{ env.LOCALIC_PORT }}" >> $GITHUB_ENV
- name: Output Information
run: |
echo "Server IP: ${{ env.SERVER_IPV4_ADDR }}"
echo "GITHUB_SHA: $GITHUB_SHA"
echo "GITHUB_REF_NAME: $GITHUB_REF_NAME"
echo "LOCAL_IC API: http://${{ env.SERVER_IPV4_ADDR }}:${{ env.LOCALIC_PORT }}"
- name: Testnet setup
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ env.SERVER_IPV4_ADDR }}
username: root
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt -y install make gcc jq bison ca-certificates curl
wget https://go.dev/dl/go1.22.1.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.22.1.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> ~/.bashrc
export PATH=$PATH:/usr/local/go/bin
bash # idk if I can use this or not
sudo DEBIAN_FRONTEND=noninteractive apt-get remove -y containerd.io
sudo DEBIAN_FRONTEND=noninteractive apt-get -y install docker.io docker-compose
sudo apt-get update
wget https://github.com/strangelove-ventures/interchaintest/releases/download/v8.8.0/local-ic && chmod +x local-ic
sudo mv local-ic /usr/local/bin
git clone https://github.com/strangelove-ventures/heighliner.git && cd heighliner
go build && chmod +x heighliner
sudo mv heighliner /usr/local/bin
cd ~/
git clone https://github.com/${{ github.repository }}.git chain && cd chain
git checkout ${{ github.ref_name }}
make local-image
sudo screen -S testnet -d -m local-ic start testnet --api-address=0.0.0.0 --api-port=${{ env.LOCALIC_PORT }} --auth-key=${{ env.LOCALIC_AUTH_KEY }}