未验证 提交 f579c531 编写于 作者: LinuxSuRen's avatar LinuxSuRen 提交者: GitHub

Attach the artifacts by GitHub Action (#333)

* Attach the artifacts by GitHub Action

* Add action for pull request

* Change the name of pull reuqest build

* Do not need to read config for center-start cmd

* Fix the artifact file name under windows os

* Add coverage monitor

* Add coverage monitor

* Remove coverage monitor

* Fix the wrong sonar scan cmd
上级 9987e409
......@@ -22,9 +22,26 @@ jobs:
- name: Build
run: |
export PATH=$PATH:$GOPATH/bin:/home/runner/go/bin
make tools
make build-all
export PATH=$PATH:${PWD}/bin:$GOPATH/bin:/home/runner/go/bin
make clean go-bindata-download-linux tools init build-all test
- name: Upload darwin artifact
uses: actions/upload-artifact@v1.0.0
with:
name: darwin
path: bin/darwin/jcli
- name: Upload linux artifact
uses: actions/upload-artifact@v1.0.0
with:
name: linux
path: bin/linux/jcli
- name: Upload windows artifact
uses: actions/upload-artifact@v1.0.0
with:
name: windows
path: bin/windows/jcli.exe
- name: Push Image
env:
......
name: Pull Request Build
on:
pull_request:
branches:
- master
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.13
uses: actions/setup-go@v1
with:
go-version: 1.13
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
- name: Build
run: |
export PATH=$PATH:${PWD}/bin:$GOPATH/bin:/home/runner/go/bin
make clean go-bindata-download-linux tools init build-all test
- name: Upload darwin artifact
uses: actions/upload-artifact@v1.0.0
with:
name: darwin
path: bin/darwin/jcli
- name: Upload linux artifact
uses: actions/upload-artifact@v1.0.0
with:
name: linux
path: bin/linux/jcli
- name: Upload windows artifact
uses: actions/upload-artifact@v1.0.0
with:
name: windows
path: bin/windows/jcli.exe
......@@ -23,7 +23,7 @@ script:
- curl -LsS https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-4.0.0.1744-linux.zip > sonar-scanner-cli-4.0.0.1744-linux.zip
- unzip sonar-scanner-cli-4.0.0.1744-linux.zip
- export branch=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo pr-$TRAVIS_PULL_REQUEST; fi)
- sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner -D sonar.branch.name=$branch -Dsonar.projectKey=jenkins-zh_jenkins-cli -Dsonar.organization=jenkins-zh -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=674e187e300edc0ad56a05705bd0b21cbe18bd52
- sonar-scanner-4.0.0.1744-linux/bin/sonar-scanner -Dsonar.branch.name=$branch -Dsonar.projectKey=jenkins-zh_jenkins-cli -Dsonar.organization=jenkins-zh -Dsonar.sources=. -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=674e187e300edc0ad56a05705bd0b21cbe18bd52
# it's bad, but no better solution for now
# - sleep 30
# - if [ 'OK' != $(curl -s "https://sonarcloud.io/api/qualitygates/project_status?branch=$branch&projectKey=jenkins-zh_jenkins-cli" | python -c "import sys, json; print(json.load(sys.stdin)['projectStatus']['status'])") ]; then exit -1; fi
......@@ -91,6 +91,7 @@ More information could found at https://jenkins-zh.cn`,
func needReadConfig(cmd *cobra.Command) bool {
ignoreConfigLoad := []string{
"config.generate",
"center.start",
"version",
}
configPath := getCmdPath(cmd)
......
......@@ -74,6 +74,8 @@ github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10=
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4=
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
......@@ -154,6 +156,8 @@ golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1 h1:R4dVlxdmKenVdMRS/tTspEpST
golang.org/x/sys v0.0.0-20190530182044-ad28b68e88f1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU=
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42 h1:vEOn+mP2zCOVzKckCZy6YsCtDblrpj/w7B9nxGNELpg=
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册