1version: v1.0
2name: Traefik
3agent:
4  machine:
5    type: e1-standard-4
6    os_image: ubuntu1804
7
8fail_fast:
9  stop:
10    when: "branch != 'master'"
11
12auto_cancel:
13  queued:
14    when: "branch != 'master'"
15  running:
16    when: "branch != 'master'"
17
18global_job_config:
19  prologue:
20    commands:
21      - curl -sSfL https://raw.githubusercontent.com/ldez/semgo/master/godownloader.sh | sudo sh -s -- -b "/usr/local/bin"
22      - sudo semgo go1.17
23      - export "GOPATH=$(go env GOPATH)"
24      - export "SEMAPHORE_GIT_DIR=${GOPATH}/src/github.com/traefik/${SEMAPHORE_PROJECT_NAME}"
25      - export "PATH=${GOPATH}/bin:${PATH}"
26      - mkdir -vp "${SEMAPHORE_GIT_DIR}" "${GOPATH}/bin"
27      - export GOPROXY=https://proxy.golang.org,direct
28      - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "${GOPATH}/bin" v1.43.0
29      - curl -sSfL https://gist.githubusercontent.com/traefiker/6d7ac019c11d011e4f131bb2cca8900e/raw/goreleaser.sh | bash -s -- -b "${GOPATH}/bin"
30      - checkout
31      - cache restore traefik-$(checksum go.sum)
32
33blocks:
34  - name: Test Integration
35    dependencies: []
36    run:
37      when: "branch =~ '.*' OR pull_request =~'.*'"
38    task:
39      jobs:
40        - name: Test Integration
41          commands:
42            - make pull-images
43            - mkdir -p webui/static && touch webui/static/index.html # Avoid generating webui
44            - PRE_TARGET="" make binary
45            - make test-integration
46            - df -h
47      epilogue:
48        always:
49          commands:
50            - cache store traefik-$(checksum go.sum) $HOME/go/pkg/mod
51
52  - name: Release
53    dependencies: []
54    run:
55      when: "tag =~ '.*'"
56    task:
57      agent:
58        machine:
59          type: e1-standard-8
60          os_image: ubuntu1804
61      secrets:
62        - name: traefik
63      env_vars:
64        - name: GH_VERSION
65          value: 1.12.1
66        - name: CODENAME
67          value: "rocamadour"
68        - name: PRE_TARGET
69          value: ""
70      prologue:
71        commands:
72          - export VERSION=${SEMAPHORE_GIT_TAG_NAME}
73          - curl -sSL -o /tmp/gh_${GH_VERSION}_linux_amd64.tar.gz https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz
74          - tar -zxvf /tmp/gh_${GH_VERSION}_linux_amd64.tar.gz -C /tmp
75          - sudo mv /tmp/gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh
76      jobs:
77        - name: Release
78          commands:
79            - make release-packages
80            - gh release create ${SEMAPHORE_GIT_TAG_NAME} ./dist/traefik*.* --repo traefik/traefik --title ${SEMAPHORE_GIT_TAG_NAME} --notes ${SEMAPHORE_GIT_TAG_NAME}
81            - ./script/deploy.sh
82