summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: 027c0965068987beb1cb9da7405611bde547011c (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
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
name: Build and test
on: [push, pull_request]

jobs:
  ubuntu:
    name: Ubuntu
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Install dependencies
        run: |
          curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
          echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
          sudo apt-get update
          sudo apt-get install -y redis-server valgrind libevent-dev

      - name: Build using cmake
        env:
          EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
          CFLAGS: -Werror
          CXXFLAGS: -Werror
        run: mkdir build-ubuntu && cd build-ubuntu && cmake ..

      - name: Build using makefile
        run: USE_SSL=1 TEST_ASYNC=1 make

      - name: Run tests
        env:
          SKIPS_AS_FAILS: 1
          TEST_SSL: 1
        run: $GITHUB_WORKSPACE/test.sh

      #      - name: Run tests under valgrind
      #        env:
      #          SKIPS_AS_FAILS: 1
      #          TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
      #        run: $GITHUB_WORKSPACE/test.sh

  centos7:
    name: CentOS 7
    runs-on: ubuntu-latest
    container: centos:7
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Install dependencies
        run: |
          yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
          yum -y --enablerepo=remi install redis
          yum -y install gcc gcc-c++ make openssl openssl-devel cmake3 valgrind libevent-devel

      - name: Build using cmake
        env:
          EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
          CFLAGS: -Werror
          CXXFLAGS: -Werror
        run: mkdir build-centos7 && cd build-centos7 && cmake3 ..

      - name: Build using Makefile
        run: USE_SSL=1 TEST_ASYNC=1 make

      - name: Run tests
        env:
          SKIPS_AS_FAILS: 1
          TEST_SSL: 1
        run: $GITHUB_WORKSPACE/test.sh

      - name: Run tests under valgrind
        env:
          SKIPS_AS_FAILS: 1
          TEST_SSL: 1
          TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
        run: $GITHUB_WORKSPACE/test.sh

  centos8:
    name: RockyLinux 8
    runs-on: ubuntu-latest
    container: rockylinux:8
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Install dependencies
        run: |
          dnf -y upgrade --refresh
          dnf -y install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
          dnf -y module install redis:remi-6.0
          dnf -y group install "Development Tools"
          dnf -y install openssl-devel cmake valgrind libevent-devel

      - name: Build using cmake
        env:
          EXTRA_CMAKE_OPTS: -DENABLE_EXAMPLES:BOOL=ON -DENABLE_SSL:BOOL=ON -DENABLE_SSL_TESTS:BOOL=ON -DENABLE_ASYNC_TESTS:BOOL=ON
          CFLAGS: -Werror
          CXXFLAGS: -Werror
        run: mkdir build-centos8 && cd build-centos8 && cmake ..

      - name: Build using Makefile
        run: USE_SSL=1 TEST_ASYNC=1 make

      - name: Run tests
        env:
          SKIPS_AS_FAILS: 1
          TEST_SSL: 1
        run: $GITHUB_WORKSPACE/test.sh

      - name: Run tests under valgrind
        env:
          SKIPS_AS_FAILS: 1
          TEST_SSL: 1
          TEST_PREFIX: valgrind --error-exitcode=99 --track-origins=yes --leak-check=full
        run: $GITHUB_WORKSPACE/test.sh

  freebsd:
    runs-on: macos-12
    name:  FreeBSD
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Build in FreeBSD
        uses: vmactions/freebsd-vm@v0
        with:
          prepare: pkg install -y gmake cmake
          run: |
            mkdir build && cd build && cmake .. && make && cd ..
            gmake

  macos:
    name: macOS
    runs-on: macos-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Install dependencies
        run: |
          brew install openssl redis@6.2
          brew link redis@6.2 --force

      - name: Build hiredis
        run: USE_SSL=1 make

      - name: Run tests
        env:
          TEST_SSL: 1
        run: $GITHUB_WORKSPACE/test.sh

  windows:
    name: Windows
    runs-on: windows-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          repository: ${{ env.GITHUB_REPOSITORY }}
          ref: ${{ env.GITHUB_HEAD_REF }}

      - name: Install dependencies
        run: |
          choco install -y ninja memurai-developer

      - uses: ilammy/msvc-dev-cmd@v1
      - name: Build hiredis
        run: |
          mkdir build && cd build
          cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DENABLE_EXAMPLES=ON
          ninja -v

      - name: Run tests
        run: |
          ./build/hiredis-test.exe

      - name: Install Cygwin Action
        uses: cygwin/cygwin-install-action@v2
        with:
          packages: make git gcc-core

      - name: Build in cygwin
        env:
          HIREDIS_PATH: ${{ github.workspace }}
        run: |
          make clean && make