Skip to content

Commit

Permalink
Merge pull request #951 from lightninglabs/compilation-fix
Browse files Browse the repository at this point in the history
GitHub+accounts: fix i386 compilation issue
  • Loading branch information
guggero authored Jan 23, 2025
2 parents 91bc912 + 415e589 commit 396b898
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 21 deletions.
52 changes: 42 additions & 10 deletions .github/actions/setup-go/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ inputs:
go-version:
description: "The version of Golang to set up"
required: true
key-prefix:
description: "A prefix to use for the cache key, to separate cache entries from other workflows"
required: false
use-build-cache:
description: "Whether to use the build cache"
required: false
# Boolean values aren't supported in the workflow syntax, so we use a
# string. To not confuse the value with true/false, we use 'yes' and 'no'.
default: 'yes'

runs:
using: "composite"
Expand All @@ -16,19 +25,42 @@ runs:
git config --global core.autocrlf false
- name: setup go ${{ inputs.go-version }}
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: '${{ inputs.go-version }}'

- name: go cache
uses: actions/cache@v3
- name: go module and build cache
if: ${{ inputs.use-build-cache == 'yes' }}
uses: actions/cache@v4
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
/home/runner/go/pkg/mod
/home/runner/.cache/go-build
key: litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-${{ hashFiles('**/go.sum') }}
litd-${{ runner.os }}-go-${{ inputs.go-version }}-${{ github.job }}-
litd-${{ runner.os }}-go-${{ inputs.go-version }}-
litd-${{ runner.os }}-go-
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-${{ github.job }}-
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-
- name: go module cache
if: ${{ inputs.use-build-cache == 'no' }}
uses: actions/cache@v4
with:
# Just the module download cache.
path: |
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-${{ github.job }}-
${{ runner.os }}-go-${{ inputs.go-version }}-${{ inputs.key-prefix }}-no-build-cache-
- name: set GOPATH
shell: bash
run: |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
61 changes: 52 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ on:
branches:
- "*"

concurrency:
# Cancel any previous workflows if they are from a PR or push.
group: ${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
# If you change this value, please change it in the following files as well:
# /Dockerfile
Expand All @@ -29,7 +38,7 @@ jobs:

steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -68,7 +77,7 @@ jobs:

steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -88,6 +97,40 @@ jobs:
- name: build CLI binaries
run: make go-install-cli

########################
# cross compilation
########################
cross-compile:
name: cross compilation
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
# Please keep this list in sync with make/release_flags.mk!
include:
- name: i386
sys: linux-386
- name: amd64
sys: darwin-amd64 linux-amd64 windows-amd64
- name: arm
sys: darwin-arm64 linux-armv6 linux-armv7 linux-arm64
steps:
- name: cleanup space
run: rm -rf /opt/hostedtoolcache

- name: git checkout
uses: actions/checkout@v4

- name: setup go ${{ env.GO_VERSION }}
uses: ./.github/actions/setup-go
with:
go-version: '${{ env.GO_VERSION }}'
key-prefix: cross-compile
use-build-cache: 'no'

- name: build release for all architectures (skip app build)
run: make go-release sys="${{ matrix.sys }}"

########################
# proto compile check
########################
Expand All @@ -96,7 +139,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -132,7 +175,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -160,7 +203,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

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

- name: run check
run: make lint mod-check
run: make mod-check && make lint

########################
# unit tests
Expand All @@ -190,7 +233,7 @@ jobs:
- unit
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand All @@ -210,7 +253,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

Expand Down Expand Up @@ -253,7 +296,7 @@ jobs:
if: '!contains(github.event.pull_request.labels.*.name, ''no-changelog'')'
steps:
- name: git checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: release notes check
run: scripts/check-release-notes.sh
4 changes: 2 additions & 2 deletions accounts/store_kvdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,8 @@ func (s *BoltStore) IncreaseAccountBalance(_ context.Context, id AccountID,

update := func(account *OffChainBalanceAccount) error {
if amount > math.MaxInt64 {
return fmt.Errorf("amount %d exceeds the maximum of %d",
amount, math.MaxInt64)
return fmt.Errorf("amount %v exceeds the maximum of %v",
amount, int64(math.MaxInt64))
}

account.CurrentBalance += int64(amount)
Expand Down

0 comments on commit 396b898

Please sign in to comment.