Skip to content

Commit 396b898

Browse files
authored
Merge pull request #951 from lightninglabs/compilation-fix
GitHub+accounts: fix i386 compilation issue
2 parents 91bc912 + 415e589 commit 396b898

File tree

3 files changed

+96
-21
lines changed

3 files changed

+96
-21
lines changed

.github/actions/setup-go/action.yml

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,15 @@ inputs:
44
go-version:
55
description: "The version of Golang to set up"
66
required: true
7+
key-prefix:
8+
description: "A prefix to use for the cache key, to separate cache entries from other workflows"
9+
required: false
10+
use-build-cache:
11+
description: "Whether to use the build cache"
12+
required: false
13+
# Boolean values aren't supported in the workflow syntax, so we use a
14+
# string. To not confuse the value with true/false, we use 'yes' and 'no'.
15+
default: 'yes'
716

817
runs:
918
using: "composite"
@@ -16,19 +25,42 @@ runs:
1625
git config --global core.autocrlf false
1726
1827
- name: setup go ${{ inputs.go-version }}
19-
uses: actions/setup-go@v3
28+
uses: actions/setup-go@v5
2029
with:
2130
go-version: '${{ inputs.go-version }}'
2231

23-
- name: go cache
24-
uses: actions/cache@v3
32+
- name: go module and build cache
33+
if: ${{ inputs.use-build-cache == 'yes' }}
34+
uses: actions/cache@v4
2535
with:
36+
# In order:
37+
# * Module download cache
38+
# * Build cache (Linux)
39+
# * Build cache (Mac)
40+
# * Build cache (Windows)
2641
path: |
27-
/home/runner/go/pkg/mod
28-
/home/runner/.cache/go-build
29-
key: litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
42+
~/go/pkg/mod
43+
~/.cache/go-build
44+
~/Library/Caches/go-build
45+
~\AppData\Local\go-build
46+
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
3047
restore-keys: |
31-
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
32-
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-
33-
litd-${{ runner.os }}-go-${{ inputs.go-version }}-
34-
litd-${{ runner.os }}-go-
48+
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-
49+
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-
50+
51+
- name: go module cache
52+
if: ${{ inputs.use-build-cache == 'no' }}
53+
uses: actions/cache@v4
54+
with:
55+
# Just the module download cache.
56+
path: |
57+
~/go/pkg/mod
58+
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-${{ hashFiles('**/go.sum') }}
59+
restore-keys: |
60+
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-
61+
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-
62+
63+
- name: set GOPATH
64+
shell: bash
65+
run: |
66+
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

.github/workflows/main.yml

Lines changed: 52 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ on:
88
branches:
99
- "*"
1010

11+
concurrency:
12+
# Cancel any previous workflows if they are from a PR or push.
13+
group: ${{ github.event.pull_request.number || github.ref }}
14+
cancel-in-progress: true
15+
16+
defaults:
17+
run:
18+
shell: bash
19+
1120
env:
1221
# If you change this value, please change it in the following files as well:
1322
# /Dockerfile
@@ -29,7 +38,7 @@ jobs:
2938

3039
steps:
3140
- name: git checkout
32-
uses: actions/checkout@v3
41+
uses: actions/checkout@v4
3342
with:
3443
fetch-depth: 0
3544

@@ -68,7 +77,7 @@ jobs:
6877

6978
steps:
7079
- name: git checkout
71-
uses: actions/checkout@v3
80+
uses: actions/checkout@v4
7281
with:
7382
fetch-depth: 0
7483

@@ -88,6 +97,40 @@ jobs:
8897
- name: build CLI binaries
8998
run: make go-install-cli
9099

100+
########################
101+
# cross compilation
102+
########################
103+
cross-compile:
104+
name: cross compilation
105+
runs-on: ubuntu-latest
106+
strategy:
107+
fail-fast: true
108+
matrix:
109+
# Please keep this list in sync with make/release_flags.mk!
110+
include:
111+
- name: i386
112+
sys: linux-386
113+
- name: amd64
114+
sys: darwin-amd64 linux-amd64 windows-amd64
115+
- name: arm
116+
sys: darwin-arm64 linux-armv6 linux-armv7 linux-arm64
117+
steps:
118+
- name: cleanup space
119+
run: rm -rf /opt/hostedtoolcache
120+
121+
- name: git checkout
122+
uses: actions/checkout@v4
123+
124+
- name: setup go ${{ env.GO_VERSION }}
125+
uses: ./.github/actions/setup-go
126+
with:
127+
go-version: '${{ env.GO_VERSION }}'
128+
key-prefix: cross-compile
129+
use-build-cache: 'no'
130+
131+
- name: build release for all architectures (skip app build)
132+
run: make go-release sys="${{ matrix.sys }}"
133+
91134
########################
92135
# proto compile check
93136
########################
@@ -96,7 +139,7 @@ jobs:
96139
runs-on: ubuntu-latest
97140
steps:
98141
- name: git checkout
99-
uses: actions/checkout@v3
142+
uses: actions/checkout@v4
100143
with:
101144
fetch-depth: 0
102145

@@ -132,7 +175,7 @@ jobs:
132175
runs-on: ubuntu-latest
133176
steps:
134177
- name: git checkout
135-
uses: actions/checkout@v3
178+
uses: actions/checkout@v4
136179
with:
137180
fetch-depth: 0
138181

@@ -160,7 +203,7 @@ jobs:
160203
runs-on: ubuntu-latest
161204
steps:
162205
- name: git checkout
163-
uses: actions/checkout@v3
206+
uses: actions/checkout@v4
164207
with:
165208
fetch-depth: 0
166209

@@ -173,7 +216,7 @@ jobs:
173216
run: mkdir -p app/build; touch app/build/index.html
174217

175218
- name: run check
176-
run: make lint mod-check
219+
run: make mod-check && make lint
177220

178221
########################
179222
# unit tests
@@ -190,7 +233,7 @@ jobs:
190233
- unit
191234
steps:
192235
- name: git checkout
193-
uses: actions/checkout@v3
236+
uses: actions/checkout@v4
194237
with:
195238
fetch-depth: 0
196239

@@ -210,7 +253,7 @@ jobs:
210253
runs-on: ubuntu-latest
211254
steps:
212255
- name: git checkout
213-
uses: actions/checkout@v3
256+
uses: actions/checkout@v4
214257
with:
215258
fetch-depth: 0
216259

@@ -253,7 +296,7 @@ jobs:
253296
if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')'
254297
steps:
255298
- name: git checkout
256-
uses: actions/checkout@v3
299+
uses: actions/checkout@v4
257300

258301
- name: release notes check
259302
run: scripts/check-release-notes.sh

accounts/store_kvdb.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,8 @@ func (s *BoltStore) IncreaseAccountBalance(_ context.Context, id AccountID,
232232

233233
update := func(account *OffChainBalanceAccount) error {
234234
if amount > math.MaxInt64 {
235-
return fmt.Errorf("amount %d exceeds the maximum of %d",
236-
amount, math.MaxInt64)
235+
return fmt.Errorf("amount %v exceeds the maximum of %v",
236+
amount, int64(math.MaxInt64))
237237
}
238238

239239
account.CurrentBalance += int64(amount)

0 commit comments

Comments
 (0)