-
Notifications
You must be signed in to change notification settings - Fork 33
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| name: CI | ||
| on: [push, pull_request] | ||
| jobs: | ||
| build: | ||
| name: build | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
|
|
||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Build | ||
| run: make -f docker.Makefile | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| bin/ |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| ARG GO_VERSION=1.13.7 | ||
| ARG GOLANGCI_LINT_VERSION=v1.23.6 | ||
| ARG ALPINE_VERSION=3.11.3 | ||
|
|
||
|
|
||
|
|
||
| FROM golang:${GO_VERSION} AS builder | ||
|
|
||
| RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION} | ||
|
|
||
| ARG MAKE_TARGET=all | ||
| ENV CGO_ENABLED=0 | ||
| WORKDIR /src | ||
|
|
||
| COPY . . | ||
|
|
||
| RUN make ${MAKE_TARGET} | ||
|
|
||
|
|
||
|
|
||
| FROM scratch AS cli | ||
| COPY --from=builder /src/bin/github-actions github-actions | ||
|
|
||
|
|
||
|
|
||
|
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: any reason for the multiple blank lines?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to make it easier to spot the breaks between the separate images. I'm going to add some comments in with the e2e step which should make life a bit simpler |
||
| FROM alpine:${ALPINE_VERSION} | ||
|
|
||
| COPY --from=builder /src/bin/github-actions /github-actions | ||
|
|
||
| ENTRYPOINT ["/github-actions"] | ||
mikeparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| all: build lint test | ||
|
|
||
| build: | ||
| @$(call mkdir,bin) | ||
zappy-shu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| go build -o bin/github-actions ./cmd | ||
|
|
||
| lint: | ||
| golangci-lint run --config golangci.yml ./... | ||
|
|
||
| test: | ||
| go test ./... | ||
mikeparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,2 +1,16 @@ | ||
| # github-actions | ||
| Core code for all Docker's github actions | ||
| The core code base for Docker's GitHub Actions (https://github.com/features/actions). This code is used to build the docker/github-actions image that provides the functionality used by the published Docker GitHub Actions | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: missing a dot at the end of the sentence
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably a lot of that. The readme is just a placeholder with some notes on running the builds. Once I've done the spike it will need to be re-written with all the various options and the like so I'm not putting much effort into it just this minute. If we are going to open source this then will probably want to pull the build instructions out into a BUILDING.md and add a CONTRIBUTION.md |
||
|
|
||
|
|
||
| ## Building github-actions | ||
| The code is written in Go v1.13 with `go mod`. It can be built locally using the `Makefile` or in docker using the `docker.Makefile`. | ||
|
|
||
| `make -f docker.Makefile` will build the code, check the linting using golangci-lint, run the go tests, and build the image with a tag of docker/github-actions:latest | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don’t have
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Get it :) Seriously though, it's just to make it less typing to build and run the images. For just building and running the linter and unit tests you can just do a Note this setup is basically lifted from other docker repos like app and cli. If you have any suggestions on how to improve it I'd be happy to chat. Note that with the e2e tests I'm going to try and make sure the make scripts work in powershell as well as bash |
||
|
|
||
| `make -f docker.Makefile TAG=foo` will build the code, check the linting using golangci-lint, run the go tests, and build the image with a tag of docker/github-actions:foo | ||
|
|
||
| `make -f docker.Makefile image` will build the github-actions image without a tag and without running test or lint checking | ||
|
|
||
| `make -f docker.Makefile cli` will build the cli and copy it to `./bin/github-actions` | ||
|
|
||
| `make -f docker.Makefile test` will run the go tests | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "fmt" | ||
| "os" | ||
|
|
||
| commandLine "github.com/urfave/cli/v2" | ||
mikeparker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| func main() { | ||
| app := &commandLine.App{ | ||
| Name: "docker github actions", | ||
| Usage: "Used in GitHub Actions to run Docker workflows", | ||
| } | ||
|
|
||
| err := app.Run(os.Args) | ||
| if err != nil { | ||
zappy-shu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| fmt.Println(err) | ||
| os.Exit(1) | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| TAG ?= latest | ||
| STATIC_FLAGS = BUILDKIT_PROGRESS=plain | ||
| DOCKER_BUILD = $(STATIC_FLAGS) docker build | ||
|
|
||
| all: | ||
| $(DOCKER_BUILD) -t docker/github-actions:$(TAG) . | ||
|
|
||
| image: | ||
| $(DOCKER_BUILD) -t docker/github-actions:$(TAG) --build-arg MAKE_TARGET=build . | ||
|
|
||
| cli: | ||
| @$(call mkdir,bin) | ||
| $(DOCKER_BUILD) -t github-actions-cli --target=cli --output type=local,dest=./bin/ --build-arg MAKE_TARGET=build . | ||
|
|
||
| lint: | ||
| $(DOCKER_BUILD) -t github-actions-lint --build-arg MAKE_TARGET=lint . | ||
|
|
||
| test: | ||
| $(DOCKER_BUILD) -t github-actions-test --build-arg MAKE_TARGET=test . |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module github.com/docker/github-actions | ||
|
|
||
| go 1.13 | ||
|
|
||
| require github.com/urfave/cli/v2 v2.1.1 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= | ||
| github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= | ||
| github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
| github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= | ||
| github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= | ||
| github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= | ||
| github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= | ||
| github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= | ||
| github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= | ||
| gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
| gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| run: | ||
| deadline: 2m | ||
|
|
||
| linters: | ||
| disable-all: true | ||
| enable: | ||
| - gofmt | ||
| - goimports | ||
| - golint | ||
| - gosimple | ||
| - ineffassign | ||
| - misspell | ||
| - govet |
Uh oh!
There was an error while loading. Please reload this page.