-
Notifications
You must be signed in to change notification settings - Fork 63
190 lines (165 loc) · 6.18 KB
/
flow-pull-request-checks-on-macos.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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
##
# Copyright (C) 2023-2024 Hedera Hashgraph, LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
##
name: "PR Checks macos"
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
push:
branches:
- main
defaults:
run:
shell: bash
permissions:
contents: read
concurrency:
group: pr-checks-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
smoke-tests:
name: Smoke Tests
runs-on: macos-13
strategy:
fail-fast: false
matrix:
node-version: [20.x]
steps:
- name: Harden Runner
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Update Homebrew
run: |
brew update --preinstall
shell: bash
- name: Install Lima
env:
GH_TOKEN: ${{ github.token }}
INPUT_LIMA: latest
run: |
if [ $INPUT_LIMA == "latest" ]
then
LIMA_VERSION=$(gh release -R lima-vm/lima view --json tagName -q ".tagName")
else
LIMA_VERSION=$INPUT_LIMA
fi
echo "::group::Installing Lima version $LIMA_VERSION"
curl -fsSL "https://github.com/lima-vm/lima/releases/download/${LIMA_VERSION}/lima-${LIMA_VERSION:1}-$(uname -s)-$(uname -m).tar.gz" | tar Cxzvm /usr/local
echo "::endgroup::"
shell: bash
- name: Install Colima
env:
GH_TOKEN: ${{ github.token }}
INPUT_COLIMA: latest
run: |
if [ $INPUT_COLIMA == "latest" ]
then
COLIMA_VERSION=$(gh release -R abiosoft/colima view --json tagName -q ".tagName")
else
COLIMA_VERSION=$INPUT_COLIMA
fi
echo "::group::Installing Colima version $COLIMA_VERSION"
curl -LO https://github.com/abiosoft/colima/releases/download/${COLIMA_VERSION}/colima-$(uname)-$(uname -m)
# install in $PATH
install colima-$(uname)-$(uname -m) /usr/local/bin/colima
echo "::endgroup::"
shell: bash
- name: Workaround for Python conflicts in GHA Runners
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
HOMEBREW_NO_INSTALL_UPGRADE: "1"
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1"
run: |
brew unlink python@3 || true
brew uninstall --ignore-dependencies python@3 || true
brew install --overwrite --force python@3
shell: bash
- name: Install QEMU, Docker client, and Docker Compose
env:
HOMEBREW_NO_AUTO_UPDATE: "1"
HOMEBREW_NO_INSTALL_UPGRADE: "1"
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: "1"
run: |
echo "::group::Installing QEMU, Docker client, and Docker Compose"
brew install docker docker-compose
# Installing QEMU 9.0.2 as a temporary workaround. Version 9.1.0 seems to be broken with Lima/Colima at the moment.
wget https://raw.githubusercontent.com/Homebrew/homebrew-core/f1a9cf104a9a51779c7a532b658c490f69974839/Formula/q/qemu.rb
brew install qemu.rb 2>&1 | tee install.log
echo "::endgroup::"
shell: bash
- name: Configure Docker Compose plugin
run: |
mkdir -p ~/.docker/cli-plugins
ln -sfn "$(brew --prefix)/opt/docker-compose/bin/docker-compose" ~/.docker/cli-plugins/docker-compose
shell: bash
- name: Start Colima
env:
COLIMA_NETWORK_ADDRESS: true
run: |
CPU_COUNT=$(sysctl -n hw.ncpu)
MEMORY=$(sysctl hw.memsize | awk '{print $2/1024/1024/1024}')
COLIMA_ARGS="--cpu 3 --memory 10 --arch x86_64 --network-address"
echo "::group::Starting Colima with args: $COLIMA_ARGS"
colima start $COLIMA_ARGS
echo "::endgroup::"
shell: bash
- name: Install deps
run: |
npm ci
cd test/smoke
npm ci
npx hardhat compile
- name: Pull docker images
run: |
docker compose pull
- name: Create temp folders
run: |
mkdir -p /Users/runner/work/hedera-local-node/hedera-local-node/network-logs/node/logs
mkdir -p /Users/runner/work/hedera-local-node/hedera-local-node/network-logs/node/stats
mkdir -p /Users/runner/work/hedera-local-node/hedera-local-node/network-logs/node/accountBalances/balance0.0.3
mkdir -p /Users/runner/work/hedera-local-node/hedera-local-node/network-logs/node/recordStreams/record0.0.3/sidecar
chmod -R 777 /Users/runner/work/hedera-local-node/hedera-local-node/
- name: Symlink docker host
run: |
sudo ln -sf $HOME/.colima/default/docker.sock /var/run/docker.sock
# - name: Setup tmate session
# env:
# FIRING_UP_RETRY_ATTEMPTS: 2000
# uses: mxschmitt/action-tmate@v3
- name: Run the local node
env:
FIRING_UP_RETRY_ATTEMPTS: 10000
uses: step-security/retry@2ab886c0de89f68f146c9b43f53e61abc59c46dc # v3.0.1
with:
max_attempts: 3
timeout_minutes: 45
command: npm run restart -- --workdir /Users/runner/work/hedera-local-node/hedera-local-node
- name: Run smoke test
uses: step-security/retry@2ab886c0de89f68f146c9b43f53e61abc59c46dc # v3.0.1
with:
max_attempts: 5
timeout_minutes: 5
command: npm run test:smoke
# - name: Setup tmate session
# env:
# FIRING_UP_RETRY_ATTEMPTS: 1000
# uses: mxschmitt/action-tmate@v3