summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: de94c7784dcf4aafaeb77aa84fd10d289ccd037a (plain)
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
name: ci

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

on:
  workflow_dispatch:
  push:
    branches:
      - 'master'
      - '[0-9]+.[0-9]+'
    tags:
      - 'v*'
  pull_request:

env:
  BUNDLES_OUTPUT: ./bundles

jobs:
  validate-dco:
    uses: ./.github/workflows/.dco.yml

  build:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    strategy:
      fail-fast: false
      matrix:
        target:
          - binary
          - dynbinary
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Build
        uses: docker/bake-action@v1
        with:
          targets: ${{ matrix.target }}
      -
        name: Upload artifacts
        uses: actions/upload-artifact@v3
        with:
          name: ${{ matrix.target }}
          path: ${{ env.BUNDLES_OUTPUT }}
          if-no-files-found: error
          retention-days: 7

  cross:
    runs-on: ubuntu-20.04
    needs:
      - validate-dco
    strategy:
      fail-fast: false
      matrix:
        platform:
          - linux/amd64
          - linux/arm/v5
          - linux/arm/v6
          - linux/arm/v7
          - linux/arm64
          - linux/ppc64le
          - linux/s390x
          - windows/amd64
          - windows/arm64
    steps:
      -
        name: Checkout
        uses: actions/checkout@v3
        with:
          fetch-depth: 0
      -
        name: Prepare
        run: |
          platform=${{ matrix.platform }}
          echo "PLATFORM_PAIR=${platform//\//-}" >> $GITHUB_ENV
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v1
      -
        name: Build
        uses: docker/bake-action@v1
        with:
          targets: cross
        env:
          DOCKER_CROSSPLATFORMS: ${{ matrix.platform }}
      -
        name: Upload artifacts
        uses: actions/upload-artifact@v2
        with:
          name: cross-${{ env.PLATFORM_PAIR }}
          path: ${{ env.BUNDLES_OUTPUT }}
          if-no-files-found: error
          retention-days: 7