TianTianBigWang / ghaction-xgo

:octocat: GitHub Action for xgo, a Golang CGO cross compiler

Home Page:https://github.com/marketplace/actions/golang-cgo-cross-compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

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

If you are interested, check out my other :octocat: GitHub Actions!


Usage

name: build

on:
  pull_request:
  push:

jobs:
  xgo:
    strategy:
      fail-fast: false
      matrix:
        go_version:
          - 1.12.4
          - 1.13
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      -
        name: Build with xgo
        uses: crazy-max/ghaction-xgo@v1
        with:
          xgo_version: latest
          go_version: ${{ matrix.go_version }}
          dest: build
          prefix: myapp
          targets: windows/386,windows/amd64,linux/386,linux/amd64,darwin/386,darwin/amd64
          v: true
          x: false
          race: false
          ldflags: -s -w
          buildmode: default

Customizing

inputs

Following inputs can be used as step.with keys

Name Type Description
xgo_version String xgo version. Eg. v0.3.2 (default latest)
go_version String Go release to use for cross compilation from those docker tags. Eg. 1.17 (default latest)
dest String Destination folder to put binaries in (default build)
pkg String Sub-package to build if not root import
prefix String Prefix to use for output naming. Default to package name
targets String Comma separated targets to build for. Eg. windows/amd64,linux/386 (default */*)
v Bool Prints the names of packages as they are compiled (default false)
x Bool Prints the build commands as compilation progresses (default false)
race Bool Enable data race detection (supported only on amd64) (default false)
tags String Comma separated list of build tags to consider satisfied during the build
ldflags String Arguments to pass on each go tool link invocation
buildmode String Indicates which kind of object file to build (default default)
working_dir String Working directory (default $GITHUB_WORKSPACE)

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. If you want to open a pull request, please read the contributing guidelines.

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! 🙏

License

MIT. See LICENSE for more details.

About

:octocat: GitHub Action for xgo, a Golang CGO cross compiler

https://github.com/marketplace/actions/golang-cgo-cross-compiler

License:MIT License


Languages

Language:TypeScript 54.7%Language:Dockerfile 23.5%Language:HCL 12.2%Language:Go 7.0%Language:JavaScript 2.6%