Skip to content

Commit 36ba180

Browse files
author
Robert Kaussow
committed
refactoring; add service with local pypi instance for testing
1 parent 11dc2fc commit 36ba180

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+673
-6607
lines changed

.drone.jsonnet

Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
local PipelineTesting = {
2+
kind: "pipeline",
3+
name: "testing",
4+
platform: {
5+
os: "linux",
6+
arch: "amd64",
7+
},
8+
services: [
9+
{
10+
name: "pypiserver",
11+
image: "pypiserver/pypiserver",
12+
pull: "always",
13+
},
14+
],
15+
steps: [
16+
{
17+
name: "vet",
18+
image: "golang:1.11",
19+
pull: "always",
20+
environment: {
21+
GO111MODULE: "on",
22+
},
23+
commands: [
24+
"go vet ./...",
25+
],
26+
},
27+
{
28+
name: "test",
29+
image: "golang:1.11",
30+
pull: "always",
31+
environment: {
32+
GO111MODULE: "on",
33+
PLUGIN_REPOSITORY: "http://pypiserver:8080/",
34+
PLUGIN_DISTRIBUTIONS: "sdist",
35+
PLUGIN_USERNAME: "demo",
36+
PLUGIN_PASSWORD: "demo",
37+
},
38+
commands: [
39+
"go test -cover ./...",
40+
],
41+
},
42+
],
43+
trigger: {
44+
branch: [ "master" ],
45+
},
46+
};
47+
48+
local PipelineBuild(os="linux", arch="amd64") = {
49+
kind: "pipeline",
50+
name: os + "-" + arch,
51+
platform: {
52+
os: os,
53+
arch: arch,
54+
},
55+
steps: [
56+
{
57+
name: "build-push",
58+
image: "golang:1.11",
59+
pull: "always",
60+
environment: {
61+
CGO_ENABLED: "0",
62+
GO111MODULE: "on",
63+
},
64+
commands: [
65+
"go build -v -ldflags \"-X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
66+
],
67+
when: {
68+
event: [ "push", "pull_request" ],
69+
},
70+
},
71+
{
72+
name: "build-tag",
73+
image: "golang:1.11",
74+
pull: "always",
75+
environment: {
76+
CGO_ENABLED: "0",
77+
GO111MODULE: "on",
78+
},
79+
commands: [
80+
"go build -v -ldflags \"-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}\" -a -o release/" + os + "/" + arch + "/drone-pypi",
81+
],
82+
when: {
83+
event: [ "tag" ],
84+
},
85+
},
86+
{
87+
name: "executable",
88+
image: "golang:1.11",
89+
pull: "always",
90+
commands: [
91+
"./release/" + os + "/" + arch + "/drone-pypi --help",
92+
],
93+
},
94+
{
95+
name: "dryrun",
96+
image: "plugins/docker:" + os + "-" + arch,
97+
pull: "always",
98+
settings: {
99+
dry_run: true,
100+
tags: os + "-" + arch,
101+
dockerfile: "docker/Dockerfile." + os + "." + arch,
102+
repo: "plugins/pypi",
103+
username: { "from_secret": "docker_username" },
104+
password: { "from_secret": "docker_password" },
105+
},
106+
when: {
107+
event: [ "pull_request" ],
108+
},
109+
},
110+
{
111+
name: "publish",
112+
image: "plugins/docker:" + os + "-" + arch,
113+
pull: "always",
114+
settings: {
115+
auto_tag: true,
116+
auto_tag_suffix: os + "-" + arch,
117+
dockerfile: "docker/Dockerfile." + os + "." + arch,
118+
repo: "plugins/pypi",
119+
username: { "from_secret": "docker_username" },
120+
password: { "from_secret": "docker_password" },
121+
},
122+
when: {
123+
event: [ "push", "tag" ],
124+
},
125+
},
126+
],
127+
depends_on: [
128+
"testing",
129+
],
130+
trigger: {
131+
branch: [ "master" ],
132+
},
133+
};
134+
135+
local PipelineNotifications = {
136+
kind: "pipeline",
137+
name: "notifications",
138+
platform: {
139+
os: "linux",
140+
arch: "amd64",
141+
},
142+
steps: [
143+
{
144+
name: "manifest",
145+
image: "plugins/manifest:1",
146+
pull: "always",
147+
settings: {
148+
username: { "from_secret": "docker_username" },
149+
password: { "from_secret": "docker_password" },
150+
spec: "docker/manifest.tmpl",
151+
ignore_missing: true,
152+
},
153+
},
154+
{
155+
name: "microbadger",
156+
image: "plugins/webhook:1",
157+
pull: "always",
158+
settings: {
159+
url: { "from_secret": "microbadger_url" },
160+
},
161+
},
162+
],
163+
depends_on: [
164+
"linux-amd64",
165+
"linux-arm64",
166+
"linux-arm",
167+
],
168+
trigger: {
169+
branch: [ "master" ],
170+
event: [ "push", "tag" ],
171+
},
172+
};
173+
174+
[
175+
PipelineTesting,
176+
PipelineBuild("linux", "amd64"),
177+
PipelineBuild("linux", "arm64"),
178+
PipelineBuild("linux", "arm"),
179+
PipelineNotifications,
180+
]

0 commit comments

Comments
 (0)