summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: cc2d1c90f93873e4ee070599b362d2c55aae3531 (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
name: "Build"

on:
  push:
    branches: ["*"]
  pull_request:
    branches: ["*"]

env:
  BUILD_DEPS: automake bison flex g++ git libboost-all-dev libevent-dev libssl-dev libtool make pkg-config

jobs:
  # TODO windows and macos
  compiler:
    strategy:
      matrix:
        os: [ubuntu-18.04, ubuntu-20.04]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3

      - name: Install dependencies
        run: |
          sudo apt-get update -yq
          sudo apt-get install -y --no-install-recommends $BUILD_DEPS

      - name: Run bootstrap
        run: ./bootstrap.sh

      - name: Run configure
        run: ./configure --disable-debug --disable-tests --disable-libs

      - name: Run make
        run: make -j$(nproc)

      - name: Run install
        run: make install

      - name: Run thrift version
        run: /usr/local/bin/thrift -version

      # only upload while building ubuntu-20.04
      - name: Archive built thrift compiler
        if: matrix.os == 'ubuntu-20.04'
        uses: actions/upload-artifact@v3
        with:
          name: thrift-compiler
          path: compiler/cpp/thrift
          retention-days: 3

  lib-java-kotlin:
    needs: compiler
    runs-on: ubuntu-20.04
    env:
      GRADLE_VERSION: 6.9.2
    steps:
      - uses: actions/checkout@v3

      - uses: actions/setup-java@v3
        with:
          distribution: temurin
          java-version: 11
          cache: "gradle"

      - name: Install dependencies
        run: |
          sudo apt-get update -yq
          sudo apt-get install -y --no-install-recommends $BUILD_DEPS
          sudo apt-get install -y wget unzip ant maven

      - name: Setup gradle
        run: |
          wget https://services.gradle.org/distributions/gradle-$GRADLE_VERSION-bin.zip -q -O /tmp/gradle-$GRADLE_VERSION-bin.zip
          (echo "8b356fd8702d5ffa2e066ed0be45a023a779bba4dd1a68fd11bc2a6bdc981e8f  /tmp/gradle-$GRADLE_VERSION-bin.zip" | sha256sum -c -)
          unzip -d /tmp /tmp/gradle-$GRADLE_VERSION-bin.zip
          sudo mv /tmp/gradle-$GRADLE_VERSION /usr/local/gradle
          sudo ln -s /usr/local/gradle/bin/gradle /usr/local/bin
          gradle --version

      - name: Run spotlessCheck for Java
        run: |
          cd lib/java
          gradle spotlessCheck

      - name: Run ktfmtCheck for Kotlin
        run: |
          cd lib/kotlin
          gradle ktfmtCheck

      - name: Run bootstrap
        run: ./bootstrap.sh

      - name: Run configure
        run: |
          ./configure \
            --disable-debug \
            --disable-tests \
            --disable-dependency-tracking \
            --without-cpp \
            --without-c_glib \
            --with-java \
            --with-kotlin \
            --without-python \
            --without-py3 \
            --without-ruby \
            --without-haxe \
            --without-netstd \
            --without-perl \
            --without-php \
            --without-php_extension \
            --without-dart \
            --without-erlang \
            --without-go \
            --without-d \
            --without-nodejs \
            --without-nodets \
            --without-lua \
            --without-rs \
            --without-swift

      - uses: actions/download-artifact@v3
        with:
          name: thrift-compiler
          path: compiler/cpp

      - name: Run thrift-compiler
        run: |
          chmod a+x compiler/cpp/thrift
          compiler/cpp/thrift -version

      - name: Run make for java
        run: make -C lib/java

      - name: Run make check for java
        run: make -C lib/java check

      - name: Run make for kotlin
        run: make -C lib/kotlin

      - name: Run make check for kotlin
        run: make -C lib/kotlin check