Skip to content

Commit

Permalink
Merge pull request #3 from evalsocket/feature/release
Browse files Browse the repository at this point in the history
Added GitHub action workflow
  • Loading branch information
kumare3 authored Mar 31, 2021
2 parents 2e74e42 + 7713fad commit cb4085b
Show file tree
Hide file tree
Showing 8 changed files with 186 additions and 3 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: Master

on:
push:
branches:
- master

jobs:
# Duplicated from pull request workflow because sharing is not yet supported
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: load-docker-cache
name: Load Docker Cache
uses: actions/cache@v1
with:
path: /tmp/tmp/docker-images
key: /tmp/docker-images-${{ github.event.after }}
restore-keys: |
/tmp/docker-images-${{ github.event.before }}
/tmp/docker-images-${{ github.event.pull_request.base.sha }}
- name: Prime docker cache
run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true)
- name: Build dockerfile
run: |
docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder .
docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder .
- name: Tag and cache docker image
run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar

bump-version:
name: Bump Version
if: github.actor != 'goreleaserbot'
runs-on: ubuntu-latest
needs: build-docker # Only to ensure it can successfully build
outputs:
version: ${{ steps.bump-version.outputs.tag }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump-version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch

push-github:
name: Push to Github Registry
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.FLYTE_BOT_USERNAME }}"
password: "${{ secrets.FLYTE_BOT_PAT }}"
image_name: ${{ github.repository }}
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }}
push_git_tag: true
registry: ghcr.io
build_extra_args: "--compress=true"

tests-lint:
name: Run tests and lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
55 changes: 55 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Pull Request

on:
pull_request

jobs:
build-docker:
name: Build Docker Image
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- id: load-docker-cache
name: Load Docker Cache
uses: actions/cache@v1
with:
path: /tmp/tmp/docker-images
key: /tmp/docker-images-${{ github.event.after }}
restore-keys: |
/tmp/docker-images-${{ github.event.before }}
/tmp/docker-images-${{ github.event.pull_request.base.sha }}
- name: Prime docker cache
run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true)
- name: Build dockerfile
run: |
docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder .
docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder .
- name: Tag and cache docker image
run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar

tests-lint:
name: Run tests and lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
22 changes: 22 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
run:
linters:
disable-all: true
enable:
- deadcode
- errcheck
- gas
- goconst
- goimports
- golint
- gosimple
- govet
- ineffassign
- misspell
- nakedret
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
3 changes: 3 additions & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence.
* @EngHabu @kumare3
3 changes: 3 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project is governed by [Lyft's code of
conduct](https://github.com/lyft/code-of-conduct). All contributors
and participants agree to abide by its terms.
3 changes: 2 additions & 1 deletion cmd/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cmd
import (
"context"
"fmt"
"github.com/flyteorg/flytecopilot/data"
"time"

"github.com/flyteorg/flytecopilot/data"

"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flytestdlib/logger"
"github.com/flyteorg/flytestdlib/storage"
Expand Down
3 changes: 2 additions & 1 deletion cmd/sidecar.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package cmd
import (
"context"
"fmt"
"time"

"github.com/flyteorg/flytecopilot/cmd/containerwatcher"
"github.com/flyteorg/flytecopilot/data"
"time"

"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flytestdlib/logger"
Expand Down
3 changes: 2 additions & 1 deletion data/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/golang/protobuf/jsonpb"
"io"
"io/ioutil"
"os"
"path"
"reflect"
"strconv"

"github.com/golang/protobuf/jsonpb"

"github.com/flyteorg/flyteidl/gen/pb-go/flyteidl/core"
"github.com/flyteorg/flytestdlib/futures"
"github.com/flyteorg/flytestdlib/logger"
Expand Down

0 comments on commit cb4085b

Please sign in to comment.