diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a53863..9321242 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/snippets/go/.gitignore b/snippets/go/.gitignore index 8867f65..4f6c6d1 100644 --- a/snippets/go/.gitignore +++ b/snippets/go/.gitignore @@ -23,4 +23,7 @@ go.work # Ignore Go binaries **/* !**/*.go -!**/ \ No newline at end of file +!**/*.md +!**/ + +breez-sdk-go \ No newline at end of file diff --git a/snippets/go/README.md b/snippets/go/README.md new file mode 100644 index 0000000..6a91a04 --- /dev/null +++ b/snippets/go/README.md @@ -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 \ No newline at end of file diff --git a/snippets/go/go.mod b/snippets/go/go.mod index 1547ad9..e49a183 100644 --- a/snippets/go/go.mod +++ b/snippets/go/go.mod @@ -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