Skip to content

Latest commit

 

History

History
59 lines (48 loc) · 1.92 KB

README.md

File metadata and controls

59 lines (48 loc) · 1.92 KB

Actions Status

Golang Action

This Action allows you to run Go commands with your code. It will automatically setup your workspace (~/go/src/github.com/<your-name>/<repo>) before the command is run.

How to use

  1. Add an Action
  2. Enter "cedrickring/golang-action@1.3.0" (cedrickring/golang-action/go1.10@1.3.0 for Golang 1.10, 1.11, 1.12, defaults to the latest golang version)
  3. If your repo builds with make or go build && go test, that's all you need. Otherwise, add a command in the args section like:
    go build -o my_executable main.go
    or run your make targets with
    make test

If your repository's import name is different from the path on GitHub, provide the import name by adding an environment variable IMPORT=import/name. This may be useful if you have forked an open source Go project.

If you prefer editing your main.workflow files by hand, use an action block like this:

action "ci" {
  uses="cedrickring/golang-action@1.3.0"

  # optional build command:
  args="./build.sh"

  # optional import name:
  env={
    IMPORT="root/repo"
  }
}

If your project's go is not located at the root of the repo you can also specifiy environment variable PROJECT_PATH:

action "test_vendored" {
  uses="cedrickring/golang-action@1.3.0"
  # optional relative project path, default is root of repo e.g. "./":
  env={
    PROJECT_PATH = "./tests/projects/go_modules_vendored"
  }
}

To use a specific golang version (1.10, 1.11, 1.12):

action "ci" {
  uses="cedrickring/golang-action/go1.12@1.3.0"
  ...
}