Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub+accounts: fix i386 compilation issue #951

Merged
merged 6 commits into from
Jan 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nice 🙏

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, very nice 🚀!

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great investigation skills 🏅


########################
# 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 @@ -244,8 +244,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))
Comment on lines +247 to +248
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very interesting!

}

account.CurrentBalance += int64(amount)
Expand Down
Loading