Home

Awesome

GitHub release GitHub marketplace Test workflow Codecov Become a sponsor Paypal Donate

About

A GitHub Action for xgo, a Golang CGO cross-compiler.


Usage

name: build

on:
  push:
  pull_request:

jobs:
  xgo:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v4
      -
        name: Build
        uses: crazy-max/ghaction-xgo@v3
        with:
          xgo_version: latest
          go_version: 1.21
          dest: build
          prefix: myapp
          targets: windows/amd64,linux/amd64,linux/arm64,darwin/arm64
          v: true
          x: false
          race: false
          ldflags: -s -w
          buildmode: default
          trimpath: true

Customizing

inputs

The following inputs can be used as step.with keys

NameTypeDefaultDescription
xgo_versionStringlatestxgo version (e.g., v0.24.0)
go_versionStringlatestGo release to use for cross compilation from those docker tags (e.g., 1.19)
destStringbuildDestination folder to put binaries in
pkgStringSub-package to build if not root import
prefixStringpackage namePrefix to use for output naming
targetsString*/*Comma separated targets to build for (e.g. windows/amd64,linux/386)
vBoolfalsePrints the names of packages as they are compiled
xBoolfalsePrints the build commands as compilation progresses
raceBoolfalseEnable data race detection
tagsStringComma separated list of build tags to consider satisfied during the build
ldflagsStringArguments to pass on each go tool link invocation
buildmodeStringdefaultIndicates which kind of object file to build
buildvcsStringWhether to stamp binaries with version control information
trimpathBoolfalseRemove all file system paths from the resulting executable
working_dirString$GITHUB_WORKSPACEWorking directory

Limitation

This action is only available for Linux virtual environments.

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You can also support this project by becoming a sponsor on GitHub or by making a PayPal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! :pray:

License

MIT. See LICENSE for more details.