Skip to content

Commit

Permalink
Merge pull request #4 from amorscher/separate_build_steps
Browse files Browse the repository at this point in the history
feat: separate build steps for build, lint and test
  • Loading branch information
amorscher authored Aug 16, 2021
2 parents 13620e1 + 8cd8e6a commit d77e962
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 17 deletions.
60 changes: 45 additions & 15 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
branches:
- main

env:
go-version: '1.16.5'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# The "build" workflow
Expand All @@ -28,26 +31,53 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.16.5' # The Go version to download (if necessary) and use.

# Install all the dependencies
- name: Install dependencies
run: |
go version
go get -u golang.org/x/lint/golint
go-version: ${{ env.go-version }} # The Go version to download (if necessary) and use.

# Run build of the application
- name: Run build
run: go build .

lint:
name: lint
runs-on: ubuntu-latest
needs: build
steps:

- uses: actions/checkout@v2
# Setup Go
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }} # The Go version to download (if necessary) and use.

# Install all the dependencies
- name: Install dependencies
run: |
go version
go get -u golang.org/x/lint/golint
# Run vet & lint on the code
- name: Run vet & lint
run: |
go vet .
golint .
# Run vet & lint on the code
- name: Run vet & lint
run: |
go vet .
golint -set_exit_status .
# Run testing on the code
- name: Run testing
run: go test -v ./...
test:
name: test
runs-on: ubuntu-latest
needs: build
steps:

- uses: actions/checkout@v2

# Setup Go
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.go-version }} # The Go version to download (if necessary) and use.

# Run testing on the code
- name: Run testing
run: go test -v ./...


4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ func main() {

if mode == "--prepare" {
fmt.Println("Writing copy description", len(images))
current_time := time.Now()
err = file.PrepareCopy(target, images, "copy_desc_"+current_time.Format("2006-01-02-15:04:05")+".json")
currentTime := time.Now()
err = file.PrepareCopy(target, images, "copy_desc_"+currentTime.Format("2006-01-02-15:04:05")+".json")
if err != nil {
panic(err)
}
Expand Down

0 comments on commit d77e962

Please sign in to comment.