Skip to content

Commit

Permalink
Changed: Modelx v2.0 (#3)
Browse files Browse the repository at this point in the history
* update modelx v2.0

Signed-off-by: dongjiang <[email protected]>

* dongjiang, fix makefile bug

Signed-off-by: dongjiang <[email protected]>

* fix golangci lint

Signed-off-by: dongjiang <[email protected]>

* fix readme

Signed-off-by: dongjiang <[email protected]>

---------

Signed-off-by: dongjiang <[email protected]>
  • Loading branch information
dongjiang1989 authored Dec 12, 2024
1 parent 0ab1e92 commit 24f504e
Show file tree
Hide file tree
Showing 4,039 changed files with 1,240,225 additions and 37,909 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
37 changes: 37 additions & 0 deletions .github/workflows/assets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Assets
on:
workflow_dispatch:
push:
branches:
- 'release-*'
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- id: git-branch
run: |
echo "git-branch=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')" >> "$GITHUB_OUTPUT"
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
# Build binary
- name: Build
run: make build-assets
env:
PUSH: ${{ github.event_name != 'pull_request' }}
- name: Release
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: bin/*
25 changes: 25 additions & 0 deletions .github/workflows/automerge-dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Dependabot auto-merge
on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
run: |
gh pr merge --auto --merge "$PR_URL"
gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
48 changes: 0 additions & 48 deletions .github/workflows/build.yml

This file was deleted.

27 changes: 27 additions & 0 deletions .github/workflows/changed-files.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: changed-files

on:
workflow_call:
outputs:
non-markdown-files:
description: "changed files list"
value: ${{ jobs.changed-files.outputs.non-markdown-files }}

jobs:
changed-files:
# Map the job outputs to step outputs
outputs:
non-markdown-files : ${{ steps.changed-files.outputs.non-markdown-files}}
runs-on: ubuntu-latest
steps:
- name: checkout repo
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: get changed files
id: changed-files
run: |
echo non-markdown-files=$(git diff --name-only --diff-filter=ACMRT ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | grep -iv .md$ | xargs) >> $GITHUB_OUTPUT
- run: |
echo "${{ steps.changed-files.outputs.non-markdown-files}}"
79 changes: 79 additions & 0 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: checks
on:
pull_request:
push:
branches:
- 'release-*'
- 'master'
- 'main'
tags:
- 'v*'
# To cancel running workflow when new commits pushed in a pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
check-docs:
runs-on: ubuntu-latest
name: Check Documentation formatting and links
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- run: make swag
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

check-golang:
runs-on: ubuntu-latest
name: Golang linter
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- name: go.mod
run: go mod tidy && git diff --exit-code
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.57.0
args: --timeout 10m0s --go ${{ env.golang-version }}

check-format:
runs-on: ubuntu-latest
name: Check format
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- run: make format

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
name: Build binary
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- run: make build-binary
81 changes: 81 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: publish
on:
workflow_dispatch:
push:
branches:
- 'release-*'
- 'master'
- 'main'
tags:
- 'v*'
- '!pkg*'
env:
REGISTRY: ghcr.io

jobs:
publish:
name: Publish container images
permissions:
id-token: write # needed to sign images with cosign.
packages: write # needed to push images to ghcr.io.
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
-
name: modelxd
image: kubeservice-stack/modelxd
file: ./hack/build/Dockerfile
platforms: linux/amd64,linux/arm64,linux/386,linux/ppc64le,linux/s390x
-
name: modelxdl
image: kubeservice-stack/modelxdl
file: ./hack/build/Dockerfile.dl
platforms: linux/amd64,linux/arm64,linux/386,linux/ppc64le,linux/s390x
steps:
- name: Checkout
uses: actions/checkout@v4
- id: git-branch
run: |
echo "git-branch=$(echo ${GITHUB_REF##*/} | tr '[A-Z]' '[a-z]')" >> "$GITHUB_OUTPUT"
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- name: Install cosign
uses: sigstore/cosign-installer@main
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Check the cosign version
run: cosign version
- name: Install crane
uses: imjasonh/[email protected]
- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Cosign login
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | cosign login -u ${{ github.repository_owner }} --password-stdin ghcr.io
- name: Build images and push
uses: docker/build-push-action@v3
with:
file: ${{ matrix.file }}
platforms: ${{ matrix.platforms }}
push: true
build-args: |
BUILDKIT_CONTEXT_KEEP_GIT_DIR=1
tags: |
${{ env.REGISTRY }}/${{ matrix.image }}:${{steps.git-branch.outputs.git-branch}}
- name: Test ${{ matrix.name }}
run: |
docker pull ${{ env.REGISTRY }}/${{ matrix.image}}:${{steps.git-branch.outputs.git-branch}}
docker image inspect ${{ env.REGISTRY }}/${{ matrix.image}}:${{steps.git-branch.outputs.git-branch}}
45 changes: 45 additions & 0 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: unit
on:
pull_request:
push:
branches:
- 'release-*'
- 'master'
- 'main'
tags:
- 'v*'
# To cancel running workflow when new commits pushed in a pull request
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
changed-files:
uses: ./.github/workflows/changed-files.yaml
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
needs: changed-files
if: ${{ needs.changed-files.outputs.non-markdown-files }}
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: '${{ env.golang-version }}'
check-latest: true
- run: make test-unit
extended-tests:
runs-on: ubuntu-latest
name: Extended tests
needs: changed-files
if: ${{ needs.changed-files.outputs.non-markdown-files }}
steps:
- uses: actions/checkout@v4
- name: Import environment variables from file
run: cat ".github/env" >> $GITHUB_ENV
- uses: actions/setup-go@v5
with:
go-version: ${{ env.golang-version }}
check-latest: true
- run: make test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ __debug_bin
*.tgz
/bin
/data
coverage.out
39 changes: 39 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
run:
deadline: 10m

linters:
enable:
- depguard
- testifylint
- unconvert
disable:
- unused
- revive
- staticcheck

issues:
exclude-rules:
# Disable errcheck linter for test files.
- path: _test.go
linters:
- errcheck

linters-settings:
errcheck:
exclude-functions:
# Any error in HTTP handlers is handled by the server itself.
- (net/http.ResponseWriter).Write
# Never check for logger errors.
- (github.com/go-kit/log.Logger).Log
gci:
sections:
- standard
- default
- prefix(github.com/kubeservice-stack/echo)
- prefix(github.com/kubeservice-stack/common)
depguard:
rules:
forbid-pkg-errors:
deny:
- pkg: "github.com/pkg/errors"
dsc: Should be replaced with standard lib errors or fmt.Errorf
Loading

0 comments on commit 24f504e

Please sign in to comment.