-
Notifications
You must be signed in to change notification settings - Fork 660
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Run tests in CI Signed-off-by: Jeev B <[email protected]> * Register basics.basics.deck Signed-off-by: Jeev B <[email protected]> * fix missing deps Signed-off-by: Jeev B <[email protected]> * Add missing boilerplate module Signed-off-by: Jeev B <[email protected]> * update boilerplate Signed-off-by: Jeev B <[email protected]> --------- Signed-off-by: Jeev B <[email protected]>
- Loading branch information
Showing
11 changed files
with
191 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ jobs: | |
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
python-version: '3.11' | ||
- uses: unionai/[email protected] | ||
- name: Setup sandbox | ||
run: | | ||
|
@@ -178,7 +178,7 @@ jobs: | |
- name: Install Python dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flytekit | ||
pip install flytekit flytekitplugins-deck-standard | ||
pip freeze | ||
- name: Checkout flytesnacks | ||
uses: actions/checkout@v3 | ||
|
@@ -189,7 +189,9 @@ jobs: | |
# ref: ${{ env.FLYTESNACKS_VERSION }} | ||
- name: Register specific tests | ||
run: | | ||
for f in basics/basics/basic_workflow.py \ | ||
for f in \ | ||
basics/basics/basic_workflow.py \ | ||
basics/basics/deck.py \ | ||
basics/basics/hello_world.py \ | ||
basics/basics/lp.py \ | ||
basics/basics/named_outputs.py \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,5 @@ | ||
admin: | ||
# For GRPC endpoints you might want to use dns:///flyte.myexample.com | ||
endpoint: dns:///localhost:30080 | ||
insecure: true | ||
authType: Pkce | ||
logger: | ||
show-source: true | ||
level: 0 | ||
storage: | ||
connection: | ||
access-key: minio | ||
auth-type: accesskey | ||
disable-ssl: true | ||
endpoint: http://localhost:30002 | ||
region: us-east-1 | ||
secret-key: miniostorage | ||
type: minio | ||
container: "my-s3-bucket" | ||
enable-multicontainer: true | ||
insecure: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. | ||
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: | ||
# | ||
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst | ||
|
||
|
||
.PHONY: download_tooling | ||
download_tooling: #download dependencies (including test deps) for the package | ||
@boilerplate/flyte/golang_test_targets/download_tooling.sh | ||
|
||
.PHONY: generate | ||
generate: download_tooling #generate go code | ||
@boilerplate/flyte/golang_test_targets/go-gen.sh | ||
|
||
.PHONY: lint | ||
lint: download_tooling #lints the package for common code smells | ||
GL_DEBUG=linters_output,env golangci-lint run --deadline=5m --exclude deprecated -v | ||
|
||
# If code is failing goimports linter, this will fix. | ||
# skips 'vendor' | ||
.PHONY: goimports | ||
goimports: | ||
@boilerplate/flyte/golang_test_targets/goimports | ||
|
||
.PHONY: mod_download | ||
mod_download: #download dependencies (including test deps) for the package | ||
go mod download | ||
|
||
.PHONY: install | ||
install: download_tooling mod_download | ||
|
||
.PHONY: show | ||
show: | ||
go list -m all | ||
|
||
.PHONY: test_unit | ||
test_unit: | ||
go test -cover ./... -race | ||
|
||
.PHONY: test_benchmark | ||
test_benchmark: | ||
go test -bench . ./... | ||
|
||
.PHONY: test_unit_cover | ||
test_unit_cover: | ||
go test ./... -coverprofile /tmp/cover.out -covermode=count | ||
go tool cover -func /tmp/cover.out | ||
|
||
.PHONY: test_unit_visual | ||
test_unit_visual: | ||
go test ./... -coverprofile /tmp/cover.out -covermode=count | ||
go tool cover -html=/tmp/cover.out | ||
|
||
.PHONY: test_unit_codecov | ||
test_unit_codecov: | ||
go test ./... -race -coverprofile=coverage.txt -covermode=atomic | ||
curl -s https://codecov.io/bash > codecov_bash.sh && bash codecov_bash.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
Golang Test Targets | ||
~~~~~~~~~~~~~~~~~~~ | ||
|
||
Provides an ``install`` make target that uses ``go mod`` to install golang dependencies. | ||
|
||
Provides a ``lint`` make target that uses golangci to lint your code. | ||
|
||
Provides a ``test_unit`` target for unit tests. | ||
|
||
Provides a ``test_unit_cover`` target for analysing coverage of unit tests, which will output the coverage of each function and total statement coverage. | ||
|
||
Provides a ``test_unit_visual`` target for visualizing coverage of unit tests through an interactive html code heat map. | ||
|
||
Provides a ``test_benchmark`` target for benchmark tests. | ||
|
||
**To Enable:** | ||
|
||
Add ``flyteorg/golang_test_targets`` to your ``boilerplate/update.cfg`` file. | ||
|
||
Make sure you're using ``go mod`` for dependency management. | ||
|
||
Provide a ``.golangci`` configuration (the lint target requires it). | ||
|
||
Add ``include boilerplate/flyte/golang_test_targets/Makefile`` in your main ``Makefile`` _after_ your REPOSITORY environment variable | ||
|
||
:: | ||
|
||
REPOSITORY=<myreponame> | ||
include boilerplate/flyte/golang_test_targets/Makefile | ||
|
||
(this ensures the extra make targets get included in your main Makefile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Everything in this file needs to be installed outside of current module | ||
# The reason we cannot turn off module entirely and install is that we need the replace statement in go.mod | ||
# because we are installing a mockery fork. Turning it off would result installing the original not the fork. | ||
# We also want to version all the other tools. We also want to be able to run go mod tidy without removing the version | ||
# pins. To facilitate this, we're maintaining two sets of go.mod/sum files - the second one only for tooling. This is | ||
# the same approach that go 1.14 will take as well. | ||
# See: | ||
# https://github.com/flyteorg/flyte/issues/129 | ||
# https://github.com/golang/go/issues/30515 for some background context | ||
# https://github.com/go-modules-by-example/index/blob/5ec250b4b78114a55001bd7c9cb88f6e07270ea5/010_tools/README.md | ||
|
||
set -e | ||
|
||
# List of tools to go get | ||
# In the format of "<cli>:<package>" or ":<package>" if no cli | ||
tools=( | ||
"github.com/EngHabu/mockery/cmd/mockery" | ||
"github.com/flyteorg/flytestdlib/cli/pflags@latest" | ||
"github.com/golangci/golangci-lint/cmd/golangci-lint" | ||
"github.com/alvaroloes/enumer" | ||
"github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc" | ||
) | ||
|
||
tmp_dir=$(mktemp -d -t gotooling-XXX) | ||
echo "Using temp directory ${tmp_dir}" | ||
cp -R boilerplate/flyte/golang_support_tools/* $tmp_dir | ||
pushd "$tmp_dir" | ||
|
||
for tool in "${tools[@]}" | ||
do | ||
echo "Installing ${tool}" | ||
GO111MODULE=on go install $tool | ||
done | ||
|
||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -ex | ||
|
||
echo "Running go generate" | ||
go generate ./... | ||
|
||
# This section is used by GitHub workflow to ensure that the generation step was run | ||
if [ -n "$DELTA_CHECK" ]; then | ||
DIRTY=$(git status --porcelain) | ||
if [ -n "$DIRTY" ]; then | ||
echo "FAILED: Go code updated without commiting generated code." | ||
echo "Ensure make generate has run and all changes are committed." | ||
DIFF=$(git diff) | ||
echo "diff detected: $DIFF" | ||
DIFF=$(git diff --name-only) | ||
echo "files different: $DIFF" | ||
exit 1 | ||
else | ||
echo "SUCCESS: Generated code is up to date." | ||
fi | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
|
||
# WARNING: THIS FILE IS MANAGED IN THE 'BOILERPLATE' REPO AND COPIED TO OTHER REPOSITORIES. | ||
# ONLY EDIT THIS FILE FROM WITHIN THE 'FLYTEORG/BOILERPLATE' REPOSITORY: | ||
# | ||
# TO OPT OUT OF UPDATES, SEE https://github.com/flyteorg/boilerplate/blob/master/Readme.rst | ||
|
||
goimports -w $(find . -type f -name '*.go' -not -path "./vendor/*" -not -path "./pkg/client/*" -not -path "./boilerplate/*") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
flyte/end2end | ||
flyte/code_of_conduct | ||
flyte/golang_test_targets |