-
Notifications
You must be signed in to change notification settings - Fork 0
131 lines (112 loc) · 3.77 KB
/
build.yaml
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Build
on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: minafoundation-default-runners
steps:
- name: 📥 Checkout
uses: actions/checkout@v4
- name: ✅ Format
run: cargo fmt --all -- --check
- name: 🔍 Lint
run: cargo clippy --all-targets --all-features -- -D warnings
- name: 🛠️ Build
run: |
if [[ ${{ github.ref }} == "refs/heads/main" ]] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
cargo build --verbose --release
else
cargo build --verbose
fi
- name: 🧪 Test
run: cargo test --verbose
integration:
runs-on: minafoundation-default-runners
steps:
- name: 🪄 Extract reference name
id: extract_ref
shell: bash
run: |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
REF_NAME=${{ github.head_ref }}
else
REF_NAME=$(echo ${GITHUB_REF#refs/*/})
fi
echo "Extracted reference name: $REF_NAME"
echo "ref=$REF_NAME" >> $GITHUB_OUTPUT
- name: 🤌 Get MiniMina from source
uses: MinaFoundation/install-minimina-action@v1
with:
# Current commit or branch to use for MiniMina
commit_or_branch: ${{ steps.extract_ref.outputs.ref }}
- name: 🧪 Test default network
shell: bash
run: |
minimina network create
minimina network start
minimina network status
minimina network info
minimina node stop -i mina-bp-1
minimina node start -i mina-bp-1
minimina network stop
minimina network delete
- name: 🧪 Test network from topology
shell: bash
run: |
cd minimina
minimina network create -n large -t tests/data/large_network/topology.json -g tests/data/large_network/genesis_ledger.json
minimina network start -n large
minimina network status -n large
minimina network info -n large
minimina node stop -n large -i empty_node-1
minimina node start -n large -i empty_node-1
minimina network stop -n large
minimina network delete -n large
deploy:
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
needs:
- build
- integration
runs-on: minafoundation-default-runners
environment: package
steps:
- name: 📥 Checkout
uses: actions/checkout@v3
- name: 📦 Package
run: |
cargo install cargo-deb
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
cargo deb
else
# add -main suffix to version
version=$(grep "^version" Cargo.toml | head -1 | awk -F '"' '{print $2}')
modified_version="${version}-main"
cargo deb --deb-version="$modified_version"
fi
- name: 📤 Upload
env:
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS_KEY }}
run: |
sudo apt-get update
sudo apt-get install -y rubygems locales
sudo gem install deb-s3
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
RELEASE=stable
else
RELEASE=unstable
fi
sudo locale-gen en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
deb-s3 upload --s3-region=us-west-2 --bucket packages.o1test.net --lock --preserve-versions --access-key-id=$ACCESS_KEY_ID --secret-access-key=$SECRET_ACCESS_KEY --cache-control=max-age=120 --component $RELEASE --codename "ubuntu" ./target/debian/*.deb