Skip to content
This repository has been archived by the owner on Nov 2, 2021. It is now read-only.

Commit

Permalink
Merge pull request #34 from ccojocar/go1_16
Browse files Browse the repository at this point in the history
Add support for Go 1.16
  • Loading branch information
cedrickring authored Feb 26, 2021
2 parents 382e630 + 923aa2d commit 8ae4db5
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM golang:1.15
FROM golang:1.16

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.10

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.11/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.11

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.12/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.12

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.13/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.13

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.14/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.14

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
2 changes: 1 addition & 1 deletion go1.15/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM golang:1.15

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.6.0"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
Expand Down
22 changes: 22 additions & 0 deletions go1.16/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM golang:1.16

LABEL name="Golang Action"
LABEL maintainer="Cedric Kring"
LABEL version="1.7.0"
LABEL repository="https://github.com/cedrickring/golang-action"

LABEL com.github.actions.name="Golang Action"
LABEL com.github.actions.description="Run Golang commands"
LABEL com.github.actions.icon="box"
LABEL com.github.actions.color="blue"

# Install dep and check sha256 checksum matches for version 0.5.4 https://github.com/golang/dep/releases/tag/v0.5.4
RUN set -eux; \
curl -L -s https://github.com/golang/dep/releases/download/v0.5.4/dep-linux-amd64 -o "$GOPATH/bin/dep"; \
echo "40a78c13753f482208d3f4bea51244ca60a914341050c588dad1f00b1acc116c $GOPATH/bin/dep" | sha256sum -c -; \
chmod +x "${GOPATH}/bin/dep";

COPY entrypoint.sh /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]
CMD [""]
60 changes: 60 additions & 0 deletions go1.16/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#!/bin/sh

set -e

if [ -z "${IMPORT}" ]; then
IMPORT="${GITHUB_REPOSITORY}"
fi
WORKDIR="${GOPATH}/src/github.com/${IMPORT}"

# PROJECT_PATH specifies the subdirectory in the working directory that the Go project is
if [ -z "${PROJECT_PATH}" ]; then
PROJECT_PATH="."
fi

# Go can only find dependencies if they're under $GOPATH/src.
# GitHub Actions mounts your repository outside of $GOPATH.
# So symlink the repository into $GOPATH, and then cd to it.
mkdir -p "$(dirname "${WORKDIR}")"
ln -s "${PWD}" "${WORKDIR}"
cd "${WORKDIR}/${PROJECT_PATH}"

# If a command was specified with `args="..."`, then run it. Otherwise,
# look for something useful to run.
if [ $# -eq 0 ] || [ "$*" = "" ]; then
if [ -r Makefile ]; then
make
else
if [ -r go.mod ]; then
export GO111MODULE=on
# Check if using vendored dependencies
if [ -d "vendor" ]; then
export GOFLAGS="-mod=vendor"
else
# Ensure no go.mod changes are made that weren't committed
export GOFLAGS="-mod=readonly"
fi
else
if [ -r Gopkg.toml ]; then
# Check if using vendored dependencies
if [ -d "vendor" ]; then
# Check that dep is in sync with /vendor dependencies and that running dep ensure doesn't result in modifications to Gopkg.lock/Gopkg.toml
"$GOPATH/bin/dep" ensure && "$GOPATH/bin/dep" check
git_workspace_status="$(git status --porcelain)"
if [ -n "${git_workspace_status}" ]; then
echo "Unexpected changes were found in dep /vendored. Please run $(dep ensure) and commit changes:";
echo "${git_workspace_status}";
exit 1;
fi
else
# Run dep ensure to download and sync dependencies
"$GOPATH/bin/dep" ensure
fi
fi
fi
go build ./...
go test ./...
fi
else
sh -c "$*"
fi
3 changes: 3 additions & 0 deletions tests/projects/go_standard/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/cedrickring/golang-action

go 1.16

0 comments on commit 8ae4db5

Please sign in to comment.