Skip to content

Commit

Permalink
Merge pull request #4 from koordinator-sh/add-ci
Browse files Browse the repository at this point in the history
chores: add ci scripts
  • Loading branch information
zwzhang0107 committed Jun 20, 2023
2 parents f9c7255 + 5f07e17 commit f9d2fa7
Show file tree
Hide file tree
Showing 15 changed files with 516 additions and 46 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug Report
about: Create a report to help us improve
title: "[BUG]"
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**:
- App version:
- Kubernetes version (use `kubectl version`):
- Install details (e.g. helm install args):
- Node environment (for koordlet/runtime-proxy issue):
- Containerd/Docker version:
- OS version:
- Kernal version:
- Cgroup driver: cgroupfs/systemd
- Others:

56 changes: 56 additions & 0 deletions .github/ISSUE_TEMPLATE/membership.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Organization Membership Request
description: Request membership in a Koordinator Org
labels: ["kind/github-membership"]
title: "REQUEST: New membership for <your-Github-id>"
body:
- id: github
type: input
attributes:
label: GitHub Username
placeholder: e.g. @example_user
validations:
required: true
- id: requirements
type: checkboxes
attributes:
label: Requirements
options:
- label: I have reviewed the [community membership guidelines](https://github.com/koordinator-sh/koordinator/blob/main/docs/community/community-membership.md)
required: true
- label: I have [enabled 2FA on my GitHub account](https://github.com/settings/security)
required: true
- label: I am actively contributing to 1 or more Koordinator subprojects
required: true
- label: I have two sponsors that meet the sponsor requirements listed in the community membership guidelines
required: true
- label: I have spoken to my sponsors ahead of this application, and they have agreed to sponsor my application
required: true
- label: I have verified that my sponsors are a reviewer or an approver in at least one OWNERS file within one of the Koordinator GitHub organizations (excluding the contributor-playground)
required: true
- label: "**OPTIONAL:** I have taken the [Inclusive Open Source Community Orientation course](https://training.linuxfoundation.org/training/inclusive-open-source-community-orientation-lfc102/)"
- id: sponsor_1
type: input
attributes:
label: "Sponsor 1"
description: GitHub handle of your sponsor
placeholder: e.g. @sponsor-1
validations:
required: true
- id: sponsor_2
type: input
attributes:
label: "Sponsor 2"
description: GitHub handle of your sponsor
placeholder: e.g. @sponsor-2
validations:
required: true
- id: contributions
type: textarea
attributes:
label: List of contributions to the Koordinator project
placeholder: |
- PRs reviewed / authored
- Issues responded to
- Subprojects I am involved with
validations:
required: true
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/proposal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Proposal
about: Suggest an idea for this project
title: "[proposal]"
labels: kind/proposal

---

<!-- Please only use this template for submitting proposal -->

**What is your proposal**:


**Why is this needed**:


**Is there a suggested solution, if so, please add it**:
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Question
about: Support request or question relating to Koordinator
title: "[question]"
labels: kind/question

---

<!-- Please only use this template for submitting question -->

**What happened:**

**What you expected to happen:**

**Environment:**

<!-- Please add environment information, if you know what is necessary, just provide some -->

- Koordinator version: - v0.6.2
- Kubernetes version (use kubectl version): v1.22.5
- docker/containerd version: containerd 1.5.0
- OS (e.g: cat /etc/os-release): Ubuntu 20.04.4 LTS
- Kernel (e.g. uname -a): Linux 5.10.112-11.al8.x86_64 #1 SMP Tue May 24 16:05:50 CST 2022 x86_64 x86_64 x86_64 GNU/Linux

**Anything else we need to know:**
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 2
updates:
- package-ecosystem: "gomod"
directory: "/"
schedule:
interval: "daily"
labels:
- "dependencies"
commit-message:
prefix: "feat"
include: "scope"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
labels:
- "dependencies"
commit-message:
prefix: "chore"
include: "scope"
22 changes: 22 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
### Ⅰ. Describe what this PR does

<!--
- Summarize your change (**mandatory**)
- How does this PR work? Need a brief introduction for the changed logic (optional)
- Describe clearly one logical change and avoid lazy messages (optional)
- Describe any limitations of the current code (optional)
-->

### Ⅱ. Does this pull request fix one issue?

<!--If so, add "fixes #xxxx" below in the next line, for example, fixes #15. Otherwise, add "NONE" -->

### Ⅲ. Describe how to verify it

### Ⅳ. Special notes for reviews

### V. Checklist

- [ ] I have written necessary docs and comments
- [ ] I have added necessary unit tests and integration tests
- [ ] All checks passed in `make test`
40 changes: 40 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 90

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30

# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- security

# Label to use when marking an issue as stale
staleLabel: lifecycle/stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: |
This issue has been automatically marked as stale because it has not had recent activity.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity, `lifecycle/stale` is applied
- After 30d of inactivity since `lifecycle/stale` was applied, the issue is closed
You can:
- Mark this issue or PR as fresh with `/remove-lifecycle stale`
- Close this issue or PR with `/close`
Thank you for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: |
This issue has been automatically closed because it has not had recent activity.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity, `lifecycle/stale` is applied
- After 30d of inactivity since `lifecycle/stale` was applied, the issue is closed
You can:
- Reopen this PR with `/reopen`
Thank you for your contributions.
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: true

# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: true
123 changes: 123 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
name: CI

on:
push:
branches:
- main
- release-*
pull_request: { }
workflow_dispatch: { }

jobs:
golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
cache: false
go-version-file: go.mod
- uses: golangci/golangci-lint-action@v3
with:
version: v1.47.3

unit-tests:
strategy:
fail-fast: false
matrix:
include:
- step: mod
name: Check Go modules
command: go mod tidy && git add go.* && git diff --cached --exit-code || (echo 'Please run "go mod tidy" to sync Go modules' && exit 1);
- step: manifests
name: Check manifests
command: make manifests && git add config && git diff --cached --exit-code || (echo 'Please run "make manifests" to generate manifests' && exit 1);
- step: generate
name: Check auto-generated codes
command: make generate && git add pkg apis && git diff --cached --exit-code || (echo 'Please run "make generate" to generate Go codes' && exit 1);
- step: gofmt
name: Verify gofmt
command: make fmt && git add apis pkg cmd && git diff --cached --exit-code || (echo 'Please run "make fmt" to verify gofmt' && exit 1);
- step: govet
name: Verify govet
command: make vet && git add apis pkg cmd && git diff --cached --exit-code || (echo 'Please run "make vet" to verify govet' && exit 1);
- step: build
name: Run Go build
command: make build
- step: test
name: Run Go test
command: make fast-test
name: unit-tests(${{ matrix.name }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
cache: false
go-version-file: go.mod
- uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-ut-${{ matrix.step }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-ut-${{ matrix.step }}-
- name: ${{ matrix.name }}
run: |
${{ matrix.command }}
build-and-push:
needs: [ golangci-lint, unit-tests ]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [ koordlet, koord-manager, koord-scheduler, koord-descheduler ]
env:
GITHUB_REG: ghcr.io
ALIYUN_BJ_REG: registry.cn-beijing.aliyuncs.com
ALIYUN_HZ_REG: registry.cn-hangzhou.aliyuncs.com
steps:
- uses: docker/setup-buildx-action@v2
- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ${{ env.GITHUB_REG }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to AliyunCS_BJ
uses: docker/login-action@v2
with:
registry: ${{ env.ALIYUN_BJ_REG }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PWD }}
- name: Login to AliyunCS_HZ
uses: docker/login-action@v2
with:
registry: ${{ env.ALIYUN_HZ_REG }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PWD }}
- name: Build and push
uses: docker/build-push-action@v4
with:
platforms: linux/amd64
push: true
pull: true
file: docker/${{ matrix.target }}.dockerfile
labels: |
org.opencontainers.image.title=${{ matrix.target }}
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.created=${{ github.event.repository.updated_at}}
org.opencontainers.image.licenses=Apache-2.0
tags: |
${{ env.GITHUB_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:latest
${{ env.GITHUB_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:${{ github.sha }}
${{ env.ALIYUN_BJ_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:latest
${{ env.ALIYUN_BJ_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:${{ github.sha }}
${{ env.ALIYUN_HZ_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:latest
${{ env.ALIYUN_HZ_REG }}/${{ github.repository_owner }}/${{ matrix.target }}:${{ github.sha }}
cache-from: type=gha,scope=build-${{ matrix.target }}
cache-to: type=gha,mode=max,scope=build-${{ matrix.target }}
30 changes: 30 additions & 0 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: License

on:
push:
branches:
- main
- release-*
pull_request: {}
workflow_dispatch: {}

jobs:
license-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Check license
run: |
gem install license_finder
license_finder --decisions_file .license/dependency_decisions.yml
- uses: actions/setup-go@v4
with:
cache: false
go-version-file: go.mod
- name: Check license header
run: |
make lint-license && git add apis pkg cmd || exit 1
git diff --cached --exit-code || (echo 'Please run "make lint-license" to verify license header' && exit 1);
Loading

0 comments on commit f9d2fa7

Please sign in to comment.