-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from denis-tingaikin/add-initial-testing
Add initial interdomain ci
- Loading branch information
Showing
16 changed files
with
1,226 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
--- | ||
version: 1.0 | ||
root: "./.results" | ||
timeout: 600 | ||
shuffle-enabled: true | ||
statistics: | ||
enabled: true | ||
interval: 30 | ||
|
||
providers: | ||
- name: "kind-1" | ||
kind: "shell" | ||
instances: 1 | ||
node-count: 3 | ||
retry: 1 | ||
enabled: true | ||
timeout: 300 | ||
env: | ||
- KIND_CLUSTER_NAME=cloudtest-kind-$(rands10) | ||
scripts: | ||
start: | | ||
kind create cluster --name ${KIND_CLUSTER_NAME} --config cluster-config.yaml --wait 120s | ||
config: | | ||
sh -c "kind get kubeconfig --name ${KIND_CLUSTER_NAME} > \"${KIND_CLUSTER_NAME}-kubeconfig\" && echo \"${KIND_CLUSTER_NAME}-kubeconfig\"" | ||
stop: | | ||
kind delete cluster --name ${KIND_CLUSTER_NAME} | ||
- name: "kind-2" | ||
kind: "shell" | ||
instances: 1 | ||
node-count: 3 | ||
retry: 1 | ||
enabled: true | ||
timeout: 300 | ||
env: | ||
- KIND_CLUSTER_NAME=cloudtest-kind-$(rands10) | ||
scripts: | ||
start: | | ||
kind create cluster --name ${KIND_CLUSTER_NAME} --config cluster-config.yaml --wait 120s | ||
config: | | ||
sh -c "kind get kubeconfig --name ${KIND_CLUSTER_NAME} > \"${KIND_CLUSTER_NAME}-kubeconfig\" && echo \"${KIND_CLUSTER_NAME}-kubeconfig\"" | ||
stop: | | ||
kind delete cluster --name ${KIND_CLUSTER_NAME} | ||
reporting: | ||
junit-report: "./.results/junit.xml" | ||
executions: | ||
- name: "Sample go tests" | ||
env: | ||
- MY_ENV_VAR="test" | ||
root: . | ||
source: | ||
tags: | ||
- interdomain | ||
timeout: 60 | ||
cluster-count: 2 | ||
cluster-selector: | ||
- kind-1 | ||
- kind-2 | ||
cluster-env: | ||
- KUBECONFIG_CLUSTER_1 | ||
- KUBECONFIG_CLUSTER_2 |
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,38 @@ | ||
--- | ||
name: automerge | ||
on: | ||
workflow_run: | ||
types: | ||
- completed | ||
workflows: | ||
- 'ci' | ||
jobs: | ||
automerge-on-success: | ||
name: Automerge | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' }} | ||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v2 | ||
- name: Fetch main | ||
run: | | ||
git remote -v | ||
git fetch --depth=1 origin main | ||
- name: Only allow go.mod and go.sum changes | ||
run: | | ||
find . -type f ! -name 'go.mod' ! -name 'go.sum' ! -name '*.yaml' ! -name '*.yml' -exec git diff --exit-code origin/main -- {} + | ||
- name: Merge PR | ||
uses: ridedott/merge-me-action@v2 | ||
with: | ||
GITHUB_LOGIN: nsmbot | ||
ENABLED_FOR_MANUAL_CHANGES: true | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
automerge-otherwise: | ||
name: Automerge | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion != 'success' && github.actor == 'nsmbot' }} | ||
steps: | ||
- name: Set status 'failure' | ||
run: | | ||
echo Set status 'failure' for 'automerge' workflow to prevent run "update dependent repositories" or any other dependent workflows' | ||
exit -1 |
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,89 @@ | ||
--- | ||
name: ci | ||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
yamllint: | ||
name: yamllint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
- name: Setup Python | ||
uses: actions/setup-python@v1 | ||
- name: Install yamllint | ||
run: pip install --user yamllint | ||
- name: Run yamllint | ||
run: ~/.local/bin/yamllint -c .yamllint.yml --strict . | ||
shellcheck: | ||
name: shellcheck | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: shellcheck | ||
uses: fkautz/shell-linter@v1.0.1 | ||
golangci-lint: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code into the Go module directory | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
with: | ||
version: v1.35 | ||
excludeFmtErrorf: | ||
name: exclude fmt.Errorf | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Exclude fmt.Errorf | ||
run: | | ||
if grep -r --include=*.go --exclude=*.pb.go fmt.Errorf . ; then | ||
echo "Please use errors.Errorf (or errors.New or errors.Wrap or errors.Wrapf) as appropriate rather than fmt.Errorf" | ||
exit 1 | ||
fi | ||
checkgomod: | ||
name: check go.mod and go.sum | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.16 | ||
- run: go mod tidy | ||
- name: Check for changes in go.mod or go.sum | ||
run: | | ||
git diff --name-only --exit-code go.mod || ( echo "Run go tidy" && false ) | ||
git diff --name-only --exit-code go.sum || ( echo "Run go tidy" && false ) | ||
cloudtest: | ||
runs-on: ubuntu-latest | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.16 | ||
github-token: ${{ github.token }} | ||
- name: setup env | ||
run: | | ||
echo "::set-env name=GOPATH::$(dirname $GITHUB_WORKSPACE)" | ||
echo "::add-path::$(dirname $GITHUB_WORKSPACE)/bin" | ||
- name: Get cloudtest | ||
run: go get github.com/networkservicemesh/cloudtest@master | ||
- name: Get kind | ||
run: go get sigs.k8s.io/kind@v0.11.0 | ||
- name: Run interdomain testing | ||
run: | | ||
cloudtest | ||
- name: Upload artifacts | ||
if: ${{ success() || failure() || cancelled() }} | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: Containers logs | ||
path: ${{ github.workspace }}/src/github.com/${{ github.repository }}/logs |
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,23 @@ | ||
--- | ||
name: Pull Request on update/* Branch Push | ||
on: | ||
push: | ||
branches: | ||
- update/** | ||
jobs: | ||
auto-pull-request: | ||
name: Pull Request on update/* Branch Push | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Construct PR message | ||
run: | | ||
PULL_REQUEST_BODY=$(git log -1) | ||
echo ${PULL_REQUEST_BODY} | ||
echo PULL_REQUEST_BODY=${PULL_REQUEST_BODY} >> $GITHUB_ENV | ||
- name: pull-request-action | ||
uses: vsoch/pull-request-action@1.0.12 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
BRANCH_PREFIX: "update/" | ||
PULL_REQUEST_BRANCH: "main" |
82 changes: 82 additions & 0 deletions
82
.github/workflows/update-dependent-repositories-gomod.yaml
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,82 @@ | ||
--- | ||
name: Update dependent repositories | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_run: | ||
types: | ||
- completed | ||
workflows: | ||
- 'automerge' | ||
jobs: | ||
update-dependent-repositories: | ||
continue-on-error: true | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
repository: | ||
- integration-k8s-packet | ||
- integration-k8s-gke | ||
name: Update ${{ matrix.repository }} | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'success' && github.actor == 'nsmbot' || github.ref == 'refs/heads/main' }} | ||
steps: | ||
- name: Print environment with masked secrets | ||
run: printenv | ||
- name: Checkout ${{ github.repository }} | ||
uses: actions/checkout@v2 | ||
with: | ||
path: ${{ github.repository }} | ||
repository: ${{ github.repository }} | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
- name: Find merged PR | ||
uses: jwalton/gh-find-current-pr@v1 | ||
id: findPr | ||
with: | ||
github-token: ${{ github.token }} | ||
- name: Create commit message | ||
working-directory: ${{ github.repository }} | ||
run: | | ||
echo "Update go.mod and go.sum to latest version from ${{ github.repository }}@main ${{ github.repository }}#${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message | ||
echo "" >> /tmp/commit-message | ||
echo "${{ github.repository }} PR link: https://github.com/${{ github.repository }}/pull/${{ steps.findPr.outputs.pr }}" >> /tmp/commit-message | ||
echo "" >> /tmp/commit-message | ||
echo "${{ github.repository }} commit message:" >> /tmp/commit-message | ||
git log -1 >> /tmp/commit-message | ||
echo "Commit Message:" | ||
cat /tmp/commit-message | ||
- uses: actions/setup-go@v1 | ||
with: | ||
go-version: 1.15 | ||
- name: Get current integration-tests version | ||
id: get-integration-tests-version | ||
working-directory: ${{ github.repository }} | ||
run: | | ||
echo "::set-output name=value::$(go list -m -f '{{ .Version }}' github.com/networkservicemesh/integration-tests)" | ||
- name: Checkout networkservicemesh/${{ matrix.repository }} | ||
uses: actions/checkout@v2 | ||
with: | ||
path: networkservicemesh/${{ matrix.repository }} | ||
repository: networkservicemesh/${{ matrix.repository }} | ||
token: ${{ secrets.NSM_BOT_GITHUB_TOKEN }} | ||
- name: Update networkservicemesh/${{ matrix.repository }} locally | ||
working-directory: networkservicemesh/${{ matrix.repository }} | ||
run: | | ||
GOPRIVATE=github.com/networkservicemesh go get github.com/networkservicemesh/integration-tests@${{ steps.get-integration-tests-version.outputs.value }} | ||
go mod tidy | ||
git diff | ||
- name: Push update to the ${{ matrix.repository }} | ||
working-directory: networkservicemesh/${{ matrix.repository }} | ||
run: | | ||
echo Starting to update repositotry ${{ matrix.repository }} | ||
git config --global user.email "nsmbot@networkservicmesh.io" | ||
git config --global user.name "NSMBot" | ||
git add go.mod go.sum | ||
if ! [ -n "$(git diff --cached --exit-code)" ]; then | ||
echo ${{ matrix.repository }} is up to date | ||
exit 0; | ||
fi | ||
git commit -s -F /tmp/commit-message | ||
git checkout -b update/${{ github.repository }} | ||
git push -f origin update/${{ github.repository }} |
Oops, something went wrong.