.travis.yml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. language: go
  2. go:
  3. - "1.13"
  4. - master
  5. services:
  6. - docker
  7. script:
  8. - go test -v ./cmd/nps/
  9. os:
  10. - linux
  11. - windows
  12. before_deploy:
  13. - wget https://github.com/upx/upx/releases/download/v3.95/upx-3.95-amd64_linux.tar.xz
  14. - tar -xvf upx-3.95-amd64_linux.tar.xz
  15. - cp upx-3.95-amd64_linux/upx ./
  16. - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  17. - tar -czvf linux_amd64_client.tar.gz npc conf/npc.conf
  18. - CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  19. - tar -czvf linux_386_client.tar.gz npc conf/npc.conf
  20. - CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  21. - tar -czvf freebsd_386_client.tar.gz npc conf/npc.conf
  22. - CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  23. - tar -czvf freebsd_amd64_client.tar.gz npc conf/npc.conf
  24. - CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  25. - tar -czvf freebsd_arm_client.tar.gz npc conf/npc.conf
  26. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  27. - tar -czvf linux_arm_v7_client.tar.gz npc conf/npc.conf
  28. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  29. - tar -czvf linux_arm_v6_client.tar.gz npc conf/npc.conf
  30. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  31. - tar -czvf linux_arm_v5_client.tar.gz npc conf/npc.conf
  32. - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  33. - tar -czvf linux_arm64_client.tar.gz npc conf/npc.conf
  34. - CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  35. - tar -czvf linux_mips64_client.tar.gz npc conf/npc.conf
  36. - CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  37. - tar -czvf linux_mips64le_client.tar.gz npc conf/npc.conf
  38. - CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  39. - tar -czvf linux_mipsle_client.tar.gz npc conf/npc.conf
  40. - CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  41. - tar -czvf linux_mips_client.tar.gz npc conf/npc.conf
  42. - CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  43. - tar -czvf win_386_client.tar.gz npc.exe conf/npc.conf
  44. - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  45. - tar -czvf win_amd64_client.tar.gz npc.exe conf/npc.conf
  46. - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/npc/npc.go
  47. - tar -czvf macos_client.tar.gz npc conf/npc.conf
  48. - CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  49. - tar -czvf linux_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  50. - CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  51. - tar -czvf linux_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  52. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=5 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  53. - tar -czvf linux_arm_v5_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  54. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  55. - tar -czvf linux_arm_v6_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  56. - CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  57. - tar -czvf linux_arm_v7_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  58. - CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  59. - tar -czvf linux_arm64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  60. - CGO_ENABLED=0 GOOS=freebsd GOARCH=arm go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  61. - tar -czvf freebsd_arm_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  62. - CGO_ENABLED=0 GOOS=freebsd GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  63. - tar -czvf freebsd_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  64. - CGO_ENABLED=0 GOOS=freebsd GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  65. - tar -czvf freebsd_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  66. - CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  67. - tar -czvf linux_mips_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  68. - CGO_ENABLED=0 GOOS=linux GOARCH=mips64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  69. - tar -czvf linux_mips64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  70. - CGO_ENABLED=0 GOOS=linux GOARCH=mips64le go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  71. - tar -czvf linux_mips64le_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  72. - CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  73. - tar -czvf linux_mipsle_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  74. - CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  75. - tar -czvf macos_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps
  76. - CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  77. - tar -czvf win_amd64_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
  78. - CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags "-s -w -extldflags -static -extldflags -static" ./cmd/nps/nps.go
  79. - tar -czvf win_386_server.tar.gz conf/nps.conf conf/tasks.json conf/clients.json conf/hosts.json conf/server.key conf/server.pem web/views web/static nps.exe
  80. - export VERSION=0.24.3
  81. - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
  82. - sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
  83. - sudo apt-get update
  84. - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
  85. - docker --version
  86. - git clone https://github.com/cnlh/spksrc.git ~/spksrc
  87. - mkdir ~/spksrc/nps && cp -rf ./* ~/spksrc/nps/
  88. - docker run -itd --name spksrc --env VERSION=$VERSION -v ~/spksrc:/spksrc synocommunity/spksrc /bin/bash
  89. - docker exec -it spksrc /bin/bash -c 'cd /spksrc && make setup && cd /spksrc/spk/npc && make'
  90. - cp ~/spksrc/packages/npc_noarch-all_$VERSION-1.spk ./npc_$VERSION.spk
  91. - if [ "$TRAVIS_OS_NAME" = "windows" ]; then go build -buildmode=c-shared -o npc_sdk.dll cmd\npc\sdk.go ; fi
  92. - tar -czvf npc_sdk.tar.gz npc_sdk.dll npc_sdk.h
  93. - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin
  94. - export DOCKER_CLI_EXPERIMENTAL=enabled
  95. - docker run --rm --privileged docker/binfmt:66f9012c56a8316f9244ffd7622d7c21c1f6f28d
  96. - docker buildx create --use --name mybuilder
  97. - docker buildx build --tag ffdfgdfg/nps:$VERSION --output type=image,push=true --file Dockerfile.nps --platform=linux/amd64,linux/arm64,linux/386,linux/arm .
  98. - docker buildx build --tag ffdfgdfg/npc:$VERSION --output type=image,push=true --file Dockerfile.npc --platform=linux/amd64,linux/arm64,linux/386,linux/arm .
  99. deploy:
  100. provider: releases
  101. api_key:
  102. secure: ${TOKEN}
  103. skip_cleanup: true
  104. file:
  105. - freebsd_386_client.tar.gz
  106. - freebsd_386_server.tar.gz
  107. - freebsd_amd64_client.tar.gz
  108. - freebsd_amd64_server.tar.gz
  109. - freebsd_arm_client.tar.gz
  110. - freebsd_arm_server.tar.gz
  111. - linux_386_client.tar.gz
  112. - linux_386_server.tar.gz
  113. - linux_amd64_client.tar.gz
  114. - linux_amd64_server.tar.gz
  115. - linux_arm64_client.tar.gz
  116. - linux_arm64_server.tar.gz
  117. - linux_arm_v5_client.tar.gz
  118. - linux_arm_v6_client.tar.gz
  119. - linux_arm_v7_client.tar.gz
  120. - linux_arm_v5_server.tar.gz
  121. - linux_arm_v6_server.tar.gz
  122. - linux_arm_v7_server.tar.gz
  123. - linux_mips64le_client.tar.gz
  124. - linux_mips64le_server.tar.gz
  125. - linux_mips64_client.tar.gz
  126. - linux_mips64_server.tar.gz
  127. - linux_mipsle_client.tar.gz
  128. - linux_mipsle_server.tar.gz
  129. - linux_mips_client.tar.gz
  130. - linux_mips_server.tar.gz
  131. - macos_client.tar.gz
  132. - macos_server.tar.gz
  133. - win_386_client.tar.gz
  134. - win_386_server.tar.gz
  135. - win_amd64_client.tar.gz
  136. - win_amd64_server.tar.gz
  137. - npc_$VERSION.spk
  138. - nnpc_sdk.tar.gz
  139. on:
  140. tags: true
  141. all_branches: true