xref: /libuv/.github/workflows/CI-unix.yml (revision e129cd7f)
1name: CI-unix
2
3on:
4  pull_request:
5    paths:
6      - '**'
7      - '!docs/**'
8      - '!src/win/**'
9      - '!.**'
10      - '.github/workflows/CI-unix.yml'
11  push:
12    branches:
13      - v[0-9].*
14      - master
15
16jobs:
17  build-linux:
18    runs-on: ubuntu-latest
19    steps:
20      - uses: actions/checkout@v4
21      - name: configure
22        run: |
23          ./autogen.sh
24          mkdir build
25          (cd build && ../configure)
26      - name: distcheck
27        run: |
28          make -C build distcheck
29
30  build-android:
31    runs-on: ubuntu-latest
32    container: reactnativecommunity/react-native-android:2020-5-20
33    # Work around an issue where the node from actions/checkout is too new
34    # to run inside the long-in-the-tooth react-nactive-android container
35    # image.
36    env:
37      ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
38      ANDROID_AVD_HOME: /root/.android/avd
39    steps:
40      - uses: actions/checkout@v3
41      - name: Envinfo
42        run: npx envinfo
43      - name: Configure android arm64
44        # see build options you can use in https://developer.android.com/ndk/guides/cmake
45        run: |
46          mkdir build
47          cd build
48          $ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_HOME/ndk/20.0.5594570/build/cmake/android.toolchain.cmake -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="arm64-v8a" -DANDROID_PLATFORM=android-24 ..
49      - name: Build android arm64
50        run: |
51          $ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake --build build
52          ls -lh build
53      - name: Install Android ABI arm64-v8a
54        run: |
55          # TODO: This can be in a pre-built docker image
56          sdkmanager "build-tools;24.0.3" "platforms;android-24" "system-images;android-24;google_apis;arm64-v8a"
57
58      - name: Start emulator
59        run: |
60          echo no | avdmanager create avd -n test -k "system-images;android-24;google_apis;arm64-v8a"
61
62          adb start-server
63
64          emulator @test -memory 2048 -no-audio -no-window -gpu off -no-snapshot -no-boot-anim -netdelay none -netspeed full -no-snapshot-save -no-snapshot-load -writable-system  &
65
66          adb wait-for-device
67
68          adb shell "su 0 setenforce 0" # to allow some syscalls like link, chmod, etc.
69
70          # Push the build and test fixtures to the device
71          adb push build /data/local/tmp
72          adb shell mkdir /data/local/tmp/build/test
73          adb push test/fixtures /data/local/tmp/build/test
74
75      - name: Test
76        run: |
77          adb shell "cd /data/local/tmp/build ; env UV_TEST_TIMEOUT_MULTIPLIER=5 ./uv_run_tests_a"
78
79  build-macos:
80    runs-on: ${{ matrix.os }}
81    strategy:
82      fail-fast: false
83      matrix:
84        os: [macos-13, macos-14]
85    steps:
86      - uses: actions/checkout@v4
87      - name: Envinfo
88        run: npx envinfo
89      - name: Disable Firewall
90        run: |
91          /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
92          sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 0
93          /usr/libexec/ApplicationFirewall/socketfilterfw --getglobalstate
94      - name: Setup
95        run: |
96          brew install ninja automake libtool
97      - name: Configure
98        run: |
99          mkdir build
100          cd build
101          cmake .. -DBUILD_TESTING=ON -G Ninja
102      - name: Build
103        run: |
104          cmake --build build
105          ls -lh
106      - name: platform_output
107        run: |
108          ./build/uv_run_tests platform_output
109      - name: platform_output_a
110        run: |
111          ./build/uv_run_tests_a platform_output
112      - name: Test
113        run: |
114          cd build && ctest -V
115      - name: Autotools configure
116        if: always()
117        run: |
118          ./autogen.sh
119          mkdir build-auto
120          (cd build-auto && ../configure)
121          make -C build-auto -j4
122
123  build-ios:
124    runs-on: ${{ matrix.os }}
125    strategy:
126      fail-fast: false
127      matrix:
128        os: [macos-13, macos-14]
129    steps:
130      - uses: actions/checkout@v4
131      - name: Configure
132        run: |
133          mkdir build-ios
134          cd build-ios
135          cmake .. -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DCMAKE_CONFIGURATION_TYPES:STRING=Release
136      - name: Build
137        run: |
138          cmake --build build-ios
139          ls -lh build-ios
140
141  build-cross-qemu:
142    runs-on: ubuntu-latest
143    name: build-cross-qemu-${{ matrix.config.target }}
144
145    strategy:
146      fail-fast: false
147      matrix:
148        config:
149          - {target: arm,     toolchain: gcc-arm-linux-gnueabi,     cc: arm-linux-gnueabi-gcc,      qemu: qemu-arm-static     }
150          - {target: armhf,   toolchain: gcc-arm-linux-gnueabihf,   cc: arm-linux-gnueabihf-gcc,    qemu: qemu-arm-static     }
151          - {target: aarch64, toolchain: gcc-aarch64-linux-gnu,     cc: aarch64-linux-gnu-gcc,      qemu: qemu-aarch64-static }
152          - {target: riscv64, toolchain: gcc-riscv64-linux-gnu,     cc: riscv64-linux-gnu-gcc,      qemu: qemu-riscv64-static }
153          - {target: ppc,     toolchain: gcc-powerpc-linux-gnu,     cc: powerpc-linux-gnu-gcc,      qemu: qemu-ppc-static     }
154          - {target: ppc64,   toolchain: gcc-powerpc64-linux-gnu,   cc: powerpc64-linux-gnu-gcc,    qemu: qemu-ppc64-static   }
155          - {target: ppc64le, toolchain: gcc-powerpc64le-linux-gnu, cc: powerpc64le-linux-gnu-gcc,  qemu: qemu-ppc64le-static }
156          - {target: s390x,   toolchain: gcc-s390x-linux-gnu,       cc: s390x-linux-gnu-gcc,        qemu: qemu-s390x-static   }
157          - {target: mips,    toolchain: gcc-mips-linux-gnu,          cc: mips-linux-gnu-gcc,         qemu: qemu-mips-static     }
158          - {target: mips64,  toolchain: gcc-mips64-linux-gnuabi64,   cc: mips64-linux-gnuabi64-gcc,  qemu: qemu-mips64-static   }
159          - {target: mipsel,  toolchain: gcc-mipsel-linux-gnu,        cc: mipsel-linux-gnu-gcc,       qemu: qemu-mipsel-static   }
160          - {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-static }
161          - {target: arm (u64 slots),     toolchain: gcc-arm-linux-gnueabi,     cc: arm-linux-gnueabi-gcc,      qemu: qemu-arm-static}
162          - {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu,     cc: aarch64-linux-gnu-gcc,      qemu: qemu-aarch64-static}
163          - {target: ppc (u64 slots),     toolchain: gcc-powerpc-linux-gnu,     cc: powerpc-linux-gnu-gcc,      qemu: qemu-ppc-static}
164          - {target: ppc64 (u64 slots),   toolchain: gcc-powerpc64-linux-gnu,   cc: powerpc64-linux-gnu-gcc,    qemu: qemu-ppc64-static}
165
166    steps:
167      - uses: actions/checkout@v4
168      - name: Install QEMU
169        # this ensure install latest qemu on ubuntu, apt get version is old
170        env:
171          QEMU_SRC: "http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu"
172          QEMU_VER: "qemu-user-static_7\\.2+dfsg-.*_amd64.deb$"
173        run: |
174          DEB=`curl -s $QEMU_SRC/ | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | grep $QEMU_VER | tail -1`
175          wget $QEMU_SRC/$DEB
176          sudo dpkg -i $DEB
177      - name: Install ${{ matrix.config.toolchain }}
178        run: |
179          sudo apt update
180          sudo apt install ${{ matrix.config.toolchain }} -y
181      - name: Configure with ${{ matrix.config.cc }}
182        run: |
183          mkdir build
184          cd build
185          cmake .. -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
186      - name: Build
187        run: |
188          cmake --build build
189          ls -lh build
190      - name: Test
191        run: |
192          ${{ matrix.config.qemu }} build/uv_run_tests_a
193