ci for golang

This commit is contained in:
Jesse de Wit
2023-11-10 12:33:53 +01:00
committed by ok300
parent 8ba143498a
commit 33b1597da7
4 changed files with 55 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ jobs:
repository: breez/breez-sdk
ref: ${{ needs.setup.outputs.sdk-ref }}
package-version: ${{ needs.setup.outputs.package-version }}
packages-to-publish: '["csharp", "flutter"]'
packages-to-publish: '["csharp", "flutter", "golang"]'
use-dummy-binaries: true
check-rust:
@@ -157,6 +157,49 @@ jobs:
working-directory: snippets/csharp
run: dotnet build
check-golang:
needs:
- setup
- build-packages
name: Check Go snippets
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Download archived package
uses: actions/download-artifact@v3
with:
name: breez-sdk-go-${{ needs.setup.outputs.package-version }}
path: snippets/go/packages/breez-sdk-go
- name: Format the Go snippets
working-directory: snippets/go
run: go fmt
- name: Test formatted correctly
working-directory: snippets/go
run: |
status=$(git status --porcelain)
if [[ -n "$status" ]]; then
echo "Git status has changes"
echo "$status"
git diff
exit 1
else
echo "No changes in git status"
fi
- name: Build the Go snippets
working-directory: snippets/go
run: |
go get
go build .
build:
name: Build mdbook
runs-on: ubuntu-latest

View File

@@ -23,4 +23,7 @@ go.work
# Ignore Go binaries
**/*
!**/*.go
!**/*.md
!**/
breez-sdk-go

6
snippets/go/README.md Normal file
View File

@@ -0,0 +1,6 @@
## Steps to compile the snippets locally
1. Build a golang package
- By running the publish-all-platforms CI in the breez-sdk repository (use dummy binaries)
- or by cloning https://github.com/breez/breez-sdk-go
2. Place the files in the folder `snippets/go/packages/breez-sdk-go`
3. Happy coding

View File

@@ -3,3 +3,4 @@ module main
go 1.19
require github.com/breez/breez-sdk-go v0.2.7
replace github.com/breez/breez-sdk-go => ./packages/breez-sdk-go