summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 925316fe2585b530aab03f5c23b38df67202273f (plain) (blame)
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
stages:
    - test
    - build
    - upload
    - release

variables:
  PACKAGE_ENDPOINT: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/"

test:alpine:
    image: alpine
    stage: test
    script:
        - apk update
        - apk add make gcc git musl-dev openssl-dev linux-headers zlib-dev lua5.3-dev lua5.3-lzlib
        - make -j$(nproc) check
    tags:
        - docker-alpine
        - x86_64

test:debian:
    image: debian
    stage: test
    script:
        - apt-get update
        - apt-get install -y make gcc git libssl-dev zlib1g-dev lua5.3-dev lua5.2 lua-zlib-dev sudo
        - unlink /bin/sh
        - ln -s /bin/bash /bin/sh
        - make -j$(nproc) check
    tags:
        - docker-alpine
        - x86_64

build-static:
    stage: build
    image: alpinelinux/build-base
    script:
        - abuild-apk add make gcc git musl-dev openssl-dev linux-headers zlib-dev lua5.3-dev lua5.3-lzlib zlib-static openssl-libs-static
        - make -j$(nproc) static
        - cp src/apk.static src/apk.static-$ARCH
    parallel:
      matrix:
        - ARCH:
            - x86_64
            - x86
            - armv7
            - armhf
            - aarch64
            - s390x
            - ppc64le
            - riscv64
    artifacts:
      paths:
        - src/apk.static-*
    tags:
      - docker-alpine
      - $ARCH

make-release:
    stage: release
    image: registry.gitlab.com/gitlab-org/release-cli:latest
    script:
        - |-
          apk add curl
          for artifact in src/apk.static-*; do
            ! [ -f "$artifact" ] && { echo "No artifacts found"; exit 1; }
            ARCH=${artifact#*-}
            echo "Uploading binary for $ARCH"
            curl --fail -H "JOB-TOKEN: $CI_JOB_TOKEN" -T "$artifact" -o /dev/null ${PACKAGE_ENDPOINT}/$CI_COMMIT_TAG/$ARCH/apk.static
          done
        - echo "Making a release"
    release:
      name: $CI_COMMIT_TAG
      description: "Release $CI_COMMIT_TAG"
      tag_name: $CI_COMMIT_TAG
      ref: $CI_COMMIT_TAG
      assets:
        links:
          - name: apk.static (x86_64)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/x86_64/apk.static
          - name: apk.static (x86)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/x86/apk.static
          - name: apk.static (armv7)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/armv7/apk.static
          - name: apk.static (armhf)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/armhf/apk.static
          - name: apk.static (aarch64)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/aarch64/apk.static
          - name: apk.static (s390x)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/s390x/apk.static
          - name: apk.static (ppc64le)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/ppc64le/apk.static
          - name: apk.static (riscv64)
            url: $PACKAGE_ENDPOINT/$CI_COMMIT_TAG/riscv64/apk.static
    rules:
        - if: $CI_COMMIT_TAG
    tags:
      - docker-alpine
      - x86_64