File: ci.yml

package info (click to toggle)
aptly 1.6.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 49,928 kB
  • sloc: python: 10,398; sh: 252; makefile: 184
file content (330 lines) | stat: -rw-r--r-- 11,111 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
name: CI

on:
  pull_request:
  push:
    tags:
      - 'v*'
    branches:
      - 'master'

defaults:
  run:
    # see: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#using-a-specific-shell
    shell: bash --noprofile --norc -eo pipefail {0}

env:
  DEBIAN_FRONTEND: noninteractive

jobs:
  test:
    name: "Test (Ubuntu 22.04)"
    runs-on: ubuntu-22.04
    continue-on-error: false
    timeout-minutes: 30

    env:
      NO_FTP_ACCESS: yes
      BOTO_CONFIG: /dev/null
      GO111MODULE: "on"
      GOPROXY: "https://proxy.golang.org"

    steps:
      - name: "Install Test Packages"
        run: |
          sudo apt-get update
          sudo apt-get install -y --no-install-recommends graphviz gnupg2 gpgv2 git gcc make devscripts python3 python3-requests-unixsocket python3-termcolor python3-swiftclient python3-boto python3-azure-storage python3-etcd3 python3-plyvel flake8 faketime

      - name: "Checkout Repository"
        uses: actions/checkout@v4
        with:
          # fetch the whole repo for `git describe` to work
          fetch-depth: 0

      - name: "Run flake8"
        run: |
          make flake8

      - name: "Read Go Version"
        run: |
          gover=$(sed -n 's/^go \(.*\)/\1/p' go.mod)
          echo "Go Version: $gover"
          echo "GOVER=$gover" >> $GITHUB_OUTPUT
        id: goversion

      - name: "Setup Go"
        uses: actions/setup-go@v3
        with:
          go-version: ${{ steps.goversion.outputs.GOVER }}

      - name: "Install Azurite"
        id: azuright
        uses: potatoqualitee/azuright@v1.1
        with:
          directory: ${{ runner.temp }}

      - name: "Run Unit Tests"
        env:
          RUN_LONG_TESTS: 'yes'
          AZURE_STORAGE_ENDPOINT: "http://127.0.0.1:10000/devstoreaccount1"
          AZURE_STORAGE_ACCOUNT: "devstoreaccount1"
          AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        run: |
          sudo mkdir -p /srv ; sudo chown runner /srv
          COVERAGE_DIR=${{ runner.temp }} make test

      - name: "Run Benchmark"
        run: |
          COVERAGE_DIR=${{ runner.temp }} make bench

      - name: "Run System Tests"
        env:
          RUN_LONG_TESTS: 'yes'
          AZURE_STORAGE_ENDPOINT: "http://127.0.0.1:10000/devstoreaccount1"
          AZURE_STORAGE_ACCOUNT: "devstoreaccount1"
          AZURE_STORAGE_ACCESS_KEY: "Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw=="
          AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
          AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
        run: |
          sudo mkdir -p /srv ; sudo chown runner /srv
          COVERAGE_DIR=${{ runner.temp }} make system-test

      - name: "Merge Code Coverage"
        run: |
          go install github.com/wadey/gocovmerge@v0.0.0-20160331181800-b5bfa59ec0ad
          ~/go/bin/gocovmerge unit.out ${{ runner.temp }}/*.out > coverage.txt

      - name: "Upload Code Coverage"
        uses: codecov/codecov-action@v2
        with:
          token: ${{ secrets.CODECOV_TOKEN }}
          files: coverage.txt

  ci-debian-build:
    name: "Build"
    needs: test
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        name: ["Debian 13/testing", "Debian 12/bookworm", "Debian 11/bullseye", "Debian 10/buster", "Ubuntu 24.04", "Ubuntu 22.04", "Ubuntu 20.04"]
        arch: ["amd64", "i386" , "arm64" , "armhf"]
        include:
          - name: "Debian 13/testing"
            suite: trixie
            image: debian:trixie-slim
          - name: "Debian 12/bookworm"
            suite: bookworm
            image: debian:bookworm-slim
          - name: "Debian 11/bullseye"
            suite: bullseye
            image: debian:bullseye-slim
          - name: "Debian 10/buster"
            suite: buster
            image: debian:buster-slim
          - name: "Ubuntu 24.04"
            suite: noble
            image: ubuntu:24.04
          - name: "Ubuntu 22.04"
            suite: jammy
            image: ubuntu:22.04
          - name: "Ubuntu 20.04"
            suite: focal
            image: ubuntu:20.04
    container:
      image: ${{ matrix.image }}
      env:
        APT_LISTCHANGES_FRONTEND: none
        DEBIAN_FRONTEND: noninteractive
    steps:
      - name: "Install Build Packages"
        run: |
          apt-get update
          apt-get install -y --no-install-recommends make ca-certificates git curl build-essential devscripts dh-golang jq bash-completion lintian \
                          binutils-i686-linux-gnu binutils-aarch64-linux-gnu binutils-arm-linux-gnueabihf \
                          libc6-dev-i386-cross libc6-dev-armhf-cross libc6-dev-arm64-cross \
                          gcc-i686-linux-gnu gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu
          git config --global --add safe.directory "$GITHUB_WORKSPACE"

      - name: "Checkout Repository"
        uses: actions/checkout@v4
        with:
          # fetch the whole repo for `git describe` to work
          fetch-depth: 0

      - name: "Read Go Version"
        run: |
          gover=$(sed -n 's/^go \(.*\)/\1/p' go.mod)
          echo "Go Version: $gover"
          echo "GOVER=$gover" >> $GITHUB_OUTPUT
        id: goversion

      - name: "Setup Go"
        uses: actions/setup-go@v3
        with:
          go-version: ${{ steps.goversion.outputs.GOVER }}

      - name: "Ensure CI build"
        if: github.ref == 'refs/heads/master'
        run: |
          echo "FORCE_CI=true" >> $GITHUB_OUTPUT
        id: force_ci

      - name: "Build Debian packages"
        env:
          FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
        run: |
          make dpkg DEBARCH=${{ matrix.arch }}

      - name: "Check aptly credentials"
        env:
          APTLY_USER: ${{ secrets.APTLY_USER }}
          APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
        run: |
          found=no
          if [ -n "$APTLY_USER" ] && [ -n "$APTLY_PASSWORD" ]; then
            found=yes
          fi
          echo "Aptly credentials available: $found"
          echo "FOUND=$found" >> $GITHUB_OUTPUT
        id: aptlycreds

      - name: "Publish CI release to aptly"
        if: github.ref == 'refs/heads/master' && steps.aptlycreds.outputs.FOUND == 'yes'
        env:
          APTLY_USER: ${{ secrets.APTLY_USER }}
          APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
        run: |
          .github/workflows/scripts/upload-artifacts.sh ci ${{ matrix.suite }}

      - name: "Publish release to aptly"
        if: startsWith(github.event.ref, 'refs/tags') && steps.aptlycreds.outputs.FOUND == 'yes'
        env:
          APTLY_USER: ${{ secrets.APTLY_USER }}
          APTLY_PASSWORD: ${{ secrets.APTLY_PASSWORD }}
        run: |
          .github/workflows/scripts/upload-artifacts.sh release ${{ matrix.suite }}

      - name: "Get aptly version"
        env:
          FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
        run: |
           aptlyver=$(make -s version)
           echo "Aptly Version: $aptlyver"
           echo "VERSION=$aptlyver" >> $GITHUB_OUTPUT
        id: releaseversion

      - name: "Upload CI Artifacts"
        if: github.ref != 'refs/heads/master' && !startsWith(github.event.ref, 'refs/tags')
        uses: actions/upload-artifact@v4
        with:
          name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.suite }}_${{ matrix.arch }}
          path: build/
          retention-days: 7

  ci-binary-build:
    name: "Build"
    needs: test
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [linux, freebsd, darwin]
        goarch: ["386", "amd64", "arm", "arm64"]
        exclude:
          - goos: darwin
            goarch: 386
          - goos: darwin
            goarch: arm
    steps:
      - name: "Checkout Repository"
        uses: actions/checkout@v4
        with:
          # fetch the whole repo for `git describe` to work
          fetch-depth: 0

      - name: "Read Go Version"
        run: |
          echo "GOVER=$(sed -n 's/^go \(.*\)/\1/p' go.mod)" >> $GITHUB_OUTPUT
        id: goversion

      - name: "Setup Go"
        uses: actions/setup-go@v3
        with:
          go-version: ${{ steps.goversion.outputs.GOVER }}

      - name: "Ensure CI build"
        if: github.ref == 'refs/heads/master'
        run: |
          echo "FORCE_CI=true" >> $GITHUB_OUTPUT
        id: force_ci

      - name: "Get aptly version"
        env:
          FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
        run: |
           aptlyver=$(make -s version)
           echo "Aptly Version: $aptlyver"
           echo "VERSION=$aptlyver" >> $GITHUB_OUTPUT
        id: releaseversion

      - name: "Build aptly ${{ matrix.goos }}/${{ matrix.goarch }}"
        env:
          GOBIN: /usr/local/bin
          FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
        run: |
          make binaries GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}

      - name: "Upload Artifacts"
        uses: actions/upload-artifact@v4
        if: startsWith(github.event.ref, 'refs/tags')
        with:
          name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}
          path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
          compression-level: 0 # no compression

      - name: "Upload CI Artifacts"
        uses: actions/upload-artifact@v4
        if: "!startsWith(github.event.ref, 'refs/tags')"
        with:
          name: aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}
          path: build/aptly_${{ steps.releaseversion.outputs.VERSION }}_${{ matrix.goos }}_${{ matrix.goarch }}.zip
          compression-level: 0 # no compression
          retention-days: 7

  gh-release:
    name: "Github Release"
    runs-on: ubuntu-latest
    continue-on-error: false
    needs: ci-binary-build
    if: startsWith(github.event.ref, 'refs/tags')
    steps:
      - name: "Checkout Repository"
        uses: actions/checkout@v4

      - name: "Get aptly version"
        env:
          FORCE_CI: ${{ steps.force_ci.outputs.FORCE_CI }}
        run: |
           aptlyver=$(make -s version)
           echo "Aptly Version: $aptlyver"
           echo "VERSION=$aptlyver" >> $GITHUB_OUTPUT
        id: releaseversion

      - name: "Download Artifacts"
        uses: actions/download-artifact@v4
        with:
          path: out/

      - name: "Create Release Notes"
        run: |
          echo -e "## Changes\n\n" > out/release-notes.md
          dpkg-parsechangelog -S Changes | tail -n +4 >> out/release-notes.md

      - name: "Release"
        uses: softprops/action-gh-release@v2
        with:
          name: "Aptly Release ${{ steps.releaseversion.outputs.VERSION }}"
          files: "out/**/aptly_*.zip"
          body_path: "out/release-notes.md"