File: release.yml

package info (click to toggle)
kcov 43%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,684 kB
  • sloc: cpp: 12,619; ansic: 2,379; python: 2,000; sh: 333; makefile: 140; javascript: 65; xml: 7; asm: 4
file content (114 lines) | stat: -rw-r--r-- 3,262 bytes parent folder | download | duplicates (3)
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
name: Release

permissions:
  contents: read

on:
  push:
    tags:
      - "*"

jobs:
  build:
    name: Build executable
    runs-on: ubuntu-latest
    strategy:
      matrix:
        arch: [amd64]

    steps:
      - uses: actions/checkout@v4

      - name: Prepare
        run: chmod u+x .github/workflows/generic-build.sh .github/workflows/ci-run-tests.sh

      - name: Build for matrix.arch == amd64
        run: |
          sudo .github/workflows/generic-build.sh ${{ matrix.arch }}
          sudo .github/workflows/ci-run-tests.sh ${{ matrix.arch }}

      - uses: actions/upload-artifact@v4
        with:
          name: kcov-${{ matrix.arch }}.tar.gz
          path: kcov-${{ matrix.arch }}.tar.gz


  build-and-push-docker-image:
      name: Build and push to Docker Hub
      needs: [build]
      runs-on: ubuntu-latest
      strategy:
        fail-fast: false
        matrix:
          include:
            - {
                BUILD_OS: "alpine",
                IMAGE_TAG_SUFFIX: "-alpine",
                PLATFORM: "linux/386,linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/riscv64"
              }
            - {
                BUILD_OS: "debian",
                IMAGE_TAG_SUFFIX: "",
                PLATFORM: "linux/386,linux/amd64,linux/arm/v5,linux/arm/v7,linux/arm64/v8"
              }
      environment:
        name: "Docker Hub"
        url: https://hub.docker.com/r/kcov/kcov
      steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
          fetch-tags: true

      - name: Docker Hub login
        uses: docker/login-action@v3
        with:
          username: ${{ secrets.DOCKER_USERNAME }}
          password: ${{ secrets.DOCKER_PASSWORD }}

      # https://github.com/docker/setup-qemu-action
      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
      # https://github.com/docker/setup-buildx-action
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3

      - name: Build and push the docker image (v${{ env.RELEASE_TAG }}/${{ matrix.BUILD_OS }})
        run: .github/workflows/docker-build.sh ${{ matrix.BUILD_OS }}
        env:
          ACTION: push
          IMAGE_TAG: kcov/kcov:${{ env.RELEASE_TAG }}${{ matrix.IMAGE_TAG_SUFFIX }}
          # All (built on the base image):
          # - linux/386
          # - linux/amd64
          # - linux/arm/v6 -> Only Alpine
          # - linux/arm/v5 -> Only Debian
          # - linux/arm/v7
          # - linux/arm64/v8
          # - linux/ppc64le
          # - linux/mips64le
          # - linux/riscv64 -> Only Alpine
          # - linux/s390x
          # Does not build:
          # - linux/s390x
          # - linux/mips64le
          # No users on this platform:
          # - linux/ppc64le
          PLATFORM: ${{ matrix.PLATFORM }}

  create_release:
    name: Create release
    needs: [build-and-push-docker-image]
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/download-artifact@v4

      - name: Create release
        uses: ncipollo/release-action@v1
        with:
          allowUpdates: true
          artifacts: kcov-*/kcov-*.tar.gz
          artifactContentType: application/gzip
          token: ${{ secrets.GITHUB_TOKEN }}