Skip to content

Commit

Permalink
Merge pull request #6 from duanmengkk/add_github_ci
Browse files Browse the repository at this point in the history
add github ci for netdoctor
  • Loading branch information
duanmengkk authored Feb 18, 2024
2 parents 789f7ba + f650aad commit d203e62
Show file tree
Hide file tree
Showing 8 changed files with 291 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Bug Report
about: Report a bug encountered while using Kosmos.
labels: kind/bug

---

<!-- Please use this template while reporting a bug and provide as much info as possible. Not doing so may result in your bug not being addressed in a timely manner. Thanks!
-->


**What happened**:

**What you expected to happen**:

**How to reproduce it (as minimally and precisely as possible)**:

**Anything else we need to know?**:

**Environment**:
- Netdoctor version:
- Others:
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/enhancement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: Enhancement Request
about: Suggest an enhancement to the project
labels: kind/feature

---
<!-- Please only use this template for submitting enhancement requests -->

**What would you like to be added**:

**Why is this needed**:
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/flaking-test.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Flaking Test
about: Report flaky tests or jobs in CI
labels: kind/flake

---

#### Which jobs are flaking:

#### Which test(s) are flaking:

#### Reason for failure:

#### Anything else we need to know:

31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/good-first.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Good First Issue
about: Publish a good first issue
labels: good first issue

---

<!-- Please use this template while publishing a good first issue. Thanks!
-->

**Task description**:

**Solution**:

**Who can join or take the task**:

The good first issue is intended for `first-time contributors` to get started on his/her contributor journey.

After a contributor has successfully completed 1-2 good first issue's,
they should be ready to move on to `help wanted` items, saving the remaining `good first issue` for other new contributors.

**How to join or take the task**:

Just reply on the issue with the message `/assign` in a separate line.

Then, the issue will be assigned to you.

**How to ask for help**:

If you need help or have questions, please feel free to ask on this issue.
The issue author or other members of the community will guide you through the contribution process.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Question
about: Question relating to Kosmos.
labels: kind/question

---

<!-- Please use this template while asking a new question. Thanks!
Please make sure you have read the FAQ and searched the issue list.
- Issues: https://github.com/kosmos-io/kosmos/issues
-->
**Please provide an in-depth description of the question you have**:

**What do you think about this question?**:

**Environment**:
- Kosmos version:
- Kubernetes version:
- Others:
42 changes: 42 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<!-- Thanks for sending a pull request! Here are some tips for you:
1. If this is your first time, Please carefully read the comments in our pull request template.
2. Please label this pull request according to what type of issue you are addressing, especially if this is a release targeted pull request.
3. Ensure you have added or ran the appropriate tests for your PR.
4. If you want *faster* PR reviews, Please contact us proactively.
-->

#### What type of PR is this?

<!--
Add one of the following kinds:
/kind bug
/kind cleanup
/kind docs
/kind feature
/kind failing-test
-->

#### What does this PR do?
<!--
Provide a brief description of what this PR does
-->

#### Which issue(s) does this PR fix?
<!--
Reference any relevant issue(s) by using the syntax `Fixes #<issue_number>`, If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
-->
Fixes #
#### Special notes for your reviewer:
<!--
If there's anything specific you'd like your reviewer to pay attention to, mention it here
-->

#### Does this PR introduce a user-facing change?
<!--
If no, just write "NONE" in the release-note block below.
If yes, a release note is required.
-->
```release-note
```
104 changes: 104 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: CI
on:
push:
pull_request:
jobs:
golangci:
name: lint
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: golint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.1
verify:
name: verify
runs-on: ubuntu-22.04
env:
GOPATH: ${{ github.workspace }}
WORKSPACE: ${{ github.workspace }}/src/github.com/kosmos-io/netdoctor
defaults:
run:
working-directory: ${{ env.WORKSPACE }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
path: ${{ env.WORKSPACE }}
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- run: hack/verify-vendor.sh
- run: hack/verify-codegen.sh
- run: hack/verify-crds.sh
build:
name: build
needs: verify
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
# https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Compile
run: make all
test:
name: Unit test
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- run: make test
e2e:
name: E2e test
needs: build
runs-on: ubuntu-22.04
steps:
# Free up disk space on Ubuntu
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed, if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: false
docker-images: false
swap-storage: false
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Prepare e2e env
run: ./hack/prepare-e2e.sh
- name: Run e2e test
run: ./hack/rune2e.sh
- name: Upload logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: kosmos-e2e-logs-${{ github.run_id }}
path: ${{ github.workspace }}/e2e-test/logs-*
47 changes: 47 additions & 0 deletions .github/workflows/release_binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
## Workflow's name
#name: release kosmosctl for linux&darwin
#
## Workflow's trigger
on:
push:
tags:
- "v*.*.*"

# Workflow's jobs
jobs:
# job's id
release:
# job's name
name: release netctl for linux&darwin

# allow to upload release binary
permissions: write-all

# the type of machine to run the job on
runs-on: ubuntu-20.04

# create steps
steps:
# step1: check out repository
- name: Check out git repository
uses: actions/checkout@v3

# step2: install go env
- name: Install Go
uses: actions/setup-go@v3

# step3: make binaries
- name: Make binaries
run: make netctl

# step4: create release
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
_output/release/netctl-linux-amd64
_output/release/netctl-linux-arm64
_output/release/netctl-darwin-amd64
_output/release/netctl-darwin-arm64

0 comments on commit d203e62

Please sign in to comment.