Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor add wego add tests #230

Merged
merged 36 commits into from
Jun 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
426e2e5
refactor add wego add tests
iahmad9 Jun 1, 2021
746d05c
merge main branch
iahmad9 Jun 1, 2021
b7a77ca
fix typo
iahmad9 Jun 1, 2021
0f9c7bc
fix linting issues
iahmad9 Jun 1, 2021
a71bbc1
sanitize context name
iahmad9 Jun 1, 2021
1baa013
print GitRepositories status on failure
iahmad9 Jun 1, 2021
d15c34a
increase pod ready timeout
iahmad9 Jun 1, 2021
a4d4d10
add os name to context name
iahmad9 Jun 1, 2021
477111f
kustomize controller reponam limit of 73 chars
iahmad9 Jun 1, 2021
4c96e34
print controller logs on failure
iahmad9 Jun 1, 2021
8579080
ignore return value
iahmad9 Jun 1, 2021
ed7ce50
run all tests
iahmad9 Jun 1, 2021
96bbc28
change os prostfix to lowercase
iahmad9 Jun 1, 2021
138ab27
run deploy job
iahmad9 Jun 1, 2021
c6a707a
run deploy job
iahmad9 Jun 1, 2021
527d335
wait for repo to be created
iahmad9 Jun 1, 2021
9df4f14
ignore the case
iahmad9 Jun 1, 2021
f26e86c
ignore the case
iahmad9 Jun 1, 2021
fd22996
ignore the case
iahmad9 Jun 1, 2021
2f42674
remove fake flux before running tests
iahmad9 Jun 1, 2021
137d352
only lowercase cluster names
iahmad9 Jun 1, 2021
4079289
typo
iahmad9 Jun 1, 2021
448b491
recretae kind cluster
iahmad9 Jun 1, 2021
1785dad
recretae kind cluster
iahmad9 Jun 1, 2021
596bdf1
re-write deploy
iahmad9 Jun 1, 2021
72212de
upload artefacts
iahmad9 Jun 1, 2021
4be4a1b
publish results to testspace
iahmad9 Jun 1, 2021
147aa32
publish results to testspace
iahmad9 Jun 2, 2021
8ed41f2
build macos bins
iahmad9 Jun 2, 2021
e3fabd1
Merge branch 'main' into refactor-add-tests
iahmad9 Jun 2, 2021
51a5247
publish binaries job
iahmad9 Jun 2, 2021
98d0bdc
test refactor
iahmad9 Jun 2, 2021
e28cf11
remove F
iahmad9 Jun 2, 2021
d35b483
install golang and checkout code
iahmad9 Jun 2, 2021
194fec1
remove unused code and install golang
iahmad9 Jun 2, 2021
976324b
check repo visibility
iahmad9 Jun 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 109 additions & 15 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,34 @@ on:

name: Deploy
jobs:
build-test-deploy:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Install UI Deps
run: npm ci
- name: Build UI Assets
run: make cmd/ui/dist/index.html
- name: build
run: make all BINARY_NAME=wego-${{matrix.os}}
- name: Store wego binaries
uses: actions/upload-artifact@v2
with:
name: wego-binaries
path: bin
retention-days: 1

coverage:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
Expand All @@ -27,48 +49,120 @@ jobs:
with:
cluster_name: "${{ format('katc-{0}', github.run_id) }}"
version: "v0.10.0"
if: matrix.os == 'ubuntu-latest'
- name: Fake Install flux
run: mkdir -p pkg/flux/bin && touch pkg/flux/bin/flux
- name: unit tests with coverage
run: |
go get -u github.com/jstemmer/go-junit-report
mkdir test-results
go test -cover -covermode=atomic -coverprofile=.coverprofile-unittests -v ./... -tags unittest | go-junit-report > test-results/unit-test-results.xml
- name: build
run: make all BINARY_NAME=wego-${{matrix.os}}
mkdir artefacts
go test -cover -covermode=atomic -coverprofile=artefacts/.coverprofile-unittests -v ./... -tags unittest | go-junit-report > artefacts/unit-test-results.xml
- name: Store unit test coverage results
uses: actions/upload-artifact@v2
with:
name: unit-tests-artefacts
path: artefacts
retention-days: 1

acceptance-tests:
runs-on: ubuntu-latest
needs: [build, coverage]
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Kubernetes
uses: helm/[email protected]
with:
cluster_name: "${{ format('katc-{0}', github.run_id) }}"
version: "v0.10.0"
- name: Kind-check
run: |
kubectl get pods -A
- name: Download wego binaries
uses: actions/download-artifact@v2
with:
name: wego-binaries
path: bin
- name: Change bin permissions
run: |
cp bin/wego-ubuntu-latest bin/wego
chmod +x bin/wego
ls -la bin
- name: Download dependecies
run: |
make dependencies
- name: Set up ssh agent
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.WKP_EXAMPLE_ORG_SSH_KEY }}
- name: Configure git settings
run: |
export WEGO_BIN_PATH=$(pwd)/bin/wego-${{matrix.os}}
git config --global init.defaultBranch main
git config --global user.email "[email protected]"
git config --global user.name "Testy McTestFace"
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Install Ginkgo binary
run: go get -u github.com/onsi/ginkgo/ginkgo
- name: User Acceptance Tests (Ubuntu)
run: go get github.com/onsi/ginkgo/ginkgo@v1.16.1
- name: Run acceptance tests
env:
GITHUB_ORG: wkp-example-org
GITHUB_TOKEN: "${{ secrets.WKP_EXAMPLE_ORG_KEY }}"
GITHUB_KEY: "${{ secrets.WKP_EXAMPLE_ORG_SSH_KEY }}"
run: |
export WEGO_BIN_PATH=$(pwd)/bin/wego-${{matrix.os}}
ginkgo --reportFile=$(pwd)/test-results/acceptance-test-results.xml -v -tags=acceptance ./test/acceptance/test/...
if: matrix.os == 'ubuntu-latest'
export PATH=${PATH}:`go env GOPATH`/bin
export WEGO_BIN_PATH=$(pwd)/bin/wego
go get -u github.com/onsi/ginkgo/ginkgo
ginkgo --randomizeSuites --reportFile=$(pwd)/test-results/acceptance-test-results.xml -v -tags=acceptance ./test/acceptance/test/...
- name: Store acceptance-tests results
uses: actions/upload-artifact@v2
with:
name: acceptance-tests-artefacts
path: test-results
retention-days: 1

publish-test-results:
runs-on: ubuntu-latest
needs: [acceptance-tests]
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Checkout code
uses: actions/checkout@v2
- name: Install testspace client
uses: testspace-com/setup-testspace@v1
with:
domain: weaveworks.testspace.com
- name: Download artefacts
uses: actions/download-artifact@v2
with:
path: results
- name: Display structure of downloaded files
run: ls -laR
working-directory: results
- name: Publish test results to Testspace
run: |
go get github.com/t-yuki/gocover-cobertura
gocover-cobertura < .coverprofile-unittests > coverage.xml
testspace "[unit-tests]test-results/unit-test-results.xml" "[acceptance-tests]test-results/acceptance-test-results.xml" "coverage.xml"
if: always() && matrix.os == 'ubuntu-latest'
gocover-cobertura < results/unit-tests-artefacts/.coverprofile-unittests > coverage.xml
testspace "[unit-tests]results/unit-tests-artefacts/unit-test-results.xml" "[acceptance-tests]results/acceptance-tests-artefacts/acceptance-test-results.xml" "coverage.xml"
if: always()

publish-binaries:
runs-on: ${{matrix.os}}
needs: [acceptance-tests]
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
steps:
- name: Download wego binaries
uses: actions/download-artifact@v2
with:
name: wego-binaries
path: bin
- name: publish to s3
uses: aws-actions/configure-aws-credentials@v1
with:
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,17 @@ jobs:
version: 'v1.19.6'
- name: setup eks cluster
run: |
export CLUSTER_NAME=wego-nightly-cluster-${{matrix.os}}
OS_NAME=$(echo "${{matrix.os}}" | tr '[:upper:]' '[:lower:]')
export CLUSTER_NAME=wego-nightly-cluster-$OS_NAME
export CLUSTER_VERSION=1.19
export CLUSTER_REGION=us-east-1
export CLUSTER_EXISTS=$(eksctl get clusters --region $CLUSTER_REGION | grep $CLUSTER_NAME)
export CLUSTER_EXISTS=$(eksctl get clusters --region $CLUSTER_REGION | grep -i $CLUSTER_NAME)
if [ -z $CLUSTER_EXISTS ]
then
eksctl create cluster --name=$CLUSTER_NAME --version=$CLUSTER_VERSION--region=$CLUSTER_REGION
eksctl create cluster --name=$CLUSTER_NAME --version=$CLUSTER_VERSION --region=$CLUSTER_REGION
fi
eksctl utils write-kubeconfig --region=$CLUSTER_REGION --cluster=$CLUSTER_NAME --kubeconfig=$HOME/.kube/config
kubectl config rename-context $(kubectl config current-context) test-eks-$OS_NAME
ls -la $HOME/.kube
kubectl get nodes -A
kubectl get all --all-namespaces -o wide
Expand Down Expand Up @@ -115,7 +117,7 @@ jobs:
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Install Ginkgo binary
run: go get -u github.com/onsi/ginkgo/ginkgo
- name: User Acceptance Tests (Ubuntu)
- name: User Acceptance Tests (${{matrix.os}})
env:
GITHUB_ORG: wkp-example-org
GITHUB_TOKEN: "${{ secrets.WKP_EXAMPLE_ORG_KEY }}"
Expand Down Expand Up @@ -160,16 +162,17 @@ jobs:
version: 'v1.19.6'
- name: setup gke cluster
run: |
CLUSTER_NAME=wego-nightly-cluster-${{matrix.os}}
export CLUSTER_NAME=$(echo "$CLUSTER_NAME" | tr '[:upper:]' '[:lower:]')
OS_NAME=$(echo "${{matrix.os}}" | tr '[:upper:]' '[:lower:]')
export CLUSTER_NAME=wego-nightly-cluster-$OS_NAME
export CLUSTER_VERSION=1.19
export CLUSTER_REGION=us-central1-a
export CLUSTER_EXISTS=$(gcloud container clusters list | grep $CLUSTER_NAME)
export CLUSTER_EXISTS=$(gcloud container clusters list | grep -i $CLUSTER_NAME)
if [ -z $CLUSTER_EXISTS ]
then
gcloud container clusters create $CLUSTER_NAME --cluster-version=$CLUSTER_VERSION --zone $CLUSTER_REGION
fi
gcloud container clusters get-credentials $CLUSTER_NAME --zone $CLUSTER_REGION
kubectl config rename-context $(kubectl config current-context) test-gke-$OS_NAME
ls -la $HOME/.kube
kubectl get nodes -A
kubectl get all --all-namespaces -o wide
Expand Down Expand Up @@ -197,7 +200,7 @@ jobs:
git config --global url.ssh://[email protected]/.insteadOf https://github.com/
- name: Install Ginkgo binary
run: go get -u github.com/onsi/ginkgo/ginkgo
- name: User Acceptance Tests (Ubuntu)
- name: User Acceptance Tests (${{matrix.os}})
env:
GITHUB_ORG: wkp-example-org
GITHUB_TOKEN: "${{ secrets.WKP_EXAMPLE_ORG_KEY }}"
Expand Down
Loading