1e66f31c5Sopenharmony_ciname: CI-unix
2e66f31c5Sopenharmony_ci
3e66f31c5Sopenharmony_cion:
4e66f31c5Sopenharmony_ci  pull_request:
5e66f31c5Sopenharmony_ci    paths:
6e66f31c5Sopenharmony_ci      - '**'
7e66f31c5Sopenharmony_ci      - '!docs/**'
8e66f31c5Sopenharmony_ci      - '!src/win/**'
9e66f31c5Sopenharmony_ci      - '!.**'
10e66f31c5Sopenharmony_ci      - '.github/workflows/CI-unix.yml'
11e66f31c5Sopenharmony_ci  push:
12e66f31c5Sopenharmony_ci    branches:
13e66f31c5Sopenharmony_ci      - v[0-9].*
14e66f31c5Sopenharmony_ci      - master
15e66f31c5Sopenharmony_ci
16e66f31c5Sopenharmony_cijobs:
17e66f31c5Sopenharmony_ci  build-linux:
18e66f31c5Sopenharmony_ci    runs-on: ubuntu-latest
19e66f31c5Sopenharmony_ci    steps:
20e66f31c5Sopenharmony_ci      - uses: actions/checkout@v3
21e66f31c5Sopenharmony_ci      - name: configure
22e66f31c5Sopenharmony_ci        run: |
23e66f31c5Sopenharmony_ci          ./autogen.sh
24e66f31c5Sopenharmony_ci          mkdir build
25e66f31c5Sopenharmony_ci          (cd build && ../configure)
26e66f31c5Sopenharmony_ci      - name: distcheck
27e66f31c5Sopenharmony_ci        run: |
28e66f31c5Sopenharmony_ci          make -C build distcheck
29e66f31c5Sopenharmony_ci
30e66f31c5Sopenharmony_ci  build-android:
31e66f31c5Sopenharmony_ci    runs-on: ubuntu-latest
32e66f31c5Sopenharmony_ci    container: reactnativecommunity/react-native-android:2020-5-20
33e66f31c5Sopenharmony_ci    steps:
34e66f31c5Sopenharmony_ci      - uses: actions/checkout@v2
35e66f31c5Sopenharmony_ci      - name: Envinfo
36e66f31c5Sopenharmony_ci        run: npx envinfo
37e66f31c5Sopenharmony_ci      - name: Configure android arm64
38e66f31c5Sopenharmony_ci        # see build options you can use in https://developer.android.com/ndk/guides/cmake
39e66f31c5Sopenharmony_ci        run: |
40e66f31c5Sopenharmony_ci          mkdir build
41e66f31c5Sopenharmony_ci          cd build
42e66f31c5Sopenharmony_ci          $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 ..
43e66f31c5Sopenharmony_ci      - name: Build android arm64
44e66f31c5Sopenharmony_ci        run: |
45e66f31c5Sopenharmony_ci          $ANDROID_HOME/cmake/3.10.2.4988404/bin/cmake --build build
46e66f31c5Sopenharmony_ci          ls -lh build
47e66f31c5Sopenharmony_ci
48e66f31c5Sopenharmony_ci  build-macos:
49e66f31c5Sopenharmony_ci    runs-on: macos-11
50e66f31c5Sopenharmony_ci    steps:
51e66f31c5Sopenharmony_ci      - uses: actions/checkout@v2
52e66f31c5Sopenharmony_ci      - name: Envinfo
53e66f31c5Sopenharmony_ci        run: npx envinfo
54e66f31c5Sopenharmony_ci      - name: Setup
55e66f31c5Sopenharmony_ci        run: |
56e66f31c5Sopenharmony_ci          brew install ninja automake libtool
57e66f31c5Sopenharmony_ci      - name: Configure
58e66f31c5Sopenharmony_ci        run: |
59e66f31c5Sopenharmony_ci          mkdir build
60e66f31c5Sopenharmony_ci          cd build
61e66f31c5Sopenharmony_ci          cmake .. -DBUILD_TESTING=ON -G Ninja
62e66f31c5Sopenharmony_ci      - name: Build
63e66f31c5Sopenharmony_ci        run: |
64e66f31c5Sopenharmony_ci          cmake --build build
65e66f31c5Sopenharmony_ci          ls -lh
66e66f31c5Sopenharmony_ci      - name: platform_output
67e66f31c5Sopenharmony_ci        run: |
68e66f31c5Sopenharmony_ci          ./build/uv_run_tests platform_output
69e66f31c5Sopenharmony_ci      - name: platform_output_a
70e66f31c5Sopenharmony_ci        run: |
71e66f31c5Sopenharmony_ci          ./build/uv_run_tests_a platform_output
72e66f31c5Sopenharmony_ci      - name: Test
73e66f31c5Sopenharmony_ci        run: |
74e66f31c5Sopenharmony_ci          cd build && ctest -V
75e66f31c5Sopenharmony_ci      - name: Autotools configure
76e66f31c5Sopenharmony_ci        if: always()
77e66f31c5Sopenharmony_ci        run: |
78e66f31c5Sopenharmony_ci          ./autogen.sh
79e66f31c5Sopenharmony_ci          mkdir build-auto
80e66f31c5Sopenharmony_ci          (cd build-auto && ../configure)
81e66f31c5Sopenharmony_ci          make -C build-auto -j4
82e66f31c5Sopenharmony_ci
83e66f31c5Sopenharmony_ci  build-ios:
84e66f31c5Sopenharmony_ci    runs-on: macos-11
85e66f31c5Sopenharmony_ci    steps:
86e66f31c5Sopenharmony_ci      - uses: actions/checkout@v2
87e66f31c5Sopenharmony_ci      - name: Configure
88e66f31c5Sopenharmony_ci        run: |
89e66f31c5Sopenharmony_ci          mkdir build-ios
90e66f31c5Sopenharmony_ci          cd build-ios
91e66f31c5Sopenharmony_ci          cmake .. -GXcode -DCMAKE_SYSTEM_NAME:STRING=iOS -DCMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED:BOOL=NO -DCMAKE_CONFIGURATION_TYPES:STRING=Release
92e66f31c5Sopenharmony_ci      - name: Build
93e66f31c5Sopenharmony_ci        run: |
94e66f31c5Sopenharmony_ci          cmake --build build-ios
95e66f31c5Sopenharmony_ci          ls -lh build-ios
96e66f31c5Sopenharmony_ci
97e66f31c5Sopenharmony_ci  build-cross-qemu:
98e66f31c5Sopenharmony_ci    runs-on: ubuntu-latest
99e66f31c5Sopenharmony_ci    name: build-cross-qemu-${{ matrix.config.target }}
100e66f31c5Sopenharmony_ci
101e66f31c5Sopenharmony_ci    strategy:
102e66f31c5Sopenharmony_ci      fail-fast: false
103e66f31c5Sopenharmony_ci      matrix:
104e66f31c5Sopenharmony_ci        config:
105e66f31c5Sopenharmony_ci          - {target: arm,     toolchain: gcc-arm-linux-gnueabi,     cc: arm-linux-gnueabi-gcc,      qemu: qemu-arm-static     }
106e66f31c5Sopenharmony_ci          - {target: armhf,   toolchain: gcc-arm-linux-gnueabihf,   cc: arm-linux-gnueabihf-gcc,    qemu: qemu-arm-static     }
107e66f31c5Sopenharmony_ci          - {target: aarch64, toolchain: gcc-aarch64-linux-gnu,     cc: aarch64-linux-gnu-gcc,      qemu: qemu-aarch64-static }
108e66f31c5Sopenharmony_ci          - {target: riscv64, toolchain: gcc-riscv64-linux-gnu,     cc: riscv64-linux-gnu-gcc,      qemu: qemu-riscv64-static }
109e66f31c5Sopenharmony_ci          - {target: ppc,     toolchain: gcc-powerpc-linux-gnu,     cc: powerpc-linux-gnu-gcc,      qemu: qemu-ppc-static     }
110e66f31c5Sopenharmony_ci          - {target: ppc64,   toolchain: gcc-powerpc64-linux-gnu,   cc: powerpc64-linux-gnu-gcc,    qemu: qemu-ppc64-static   }
111e66f31c5Sopenharmony_ci          - {target: ppc64le, toolchain: gcc-powerpc64le-linux-gnu, cc: powerpc64le-linux-gnu-gcc,  qemu: qemu-ppc64le-static }
112e66f31c5Sopenharmony_ci          - {target: s390x,   toolchain: gcc-s390x-linux-gnu,       cc: s390x-linux-gnu-gcc,        qemu: qemu-s390x-static   }
113e66f31c5Sopenharmony_ci          - {target: mips,    toolchain: gcc-mips-linux-gnu,          cc: mips-linux-gnu-gcc,         qemu: qemu-mips-static     }
114e66f31c5Sopenharmony_ci          - {target: mips64,  toolchain: gcc-mips64-linux-gnuabi64,   cc: mips64-linux-gnuabi64-gcc,  qemu: qemu-mips64-static   }
115e66f31c5Sopenharmony_ci          - {target: mipsel,  toolchain: gcc-mipsel-linux-gnu,        cc: mipsel-linux-gnu-gcc,       qemu: qemu-mipsel-static   }
116e66f31c5Sopenharmony_ci          - {target: mips64el,toolchain: gcc-mips64el-linux-gnuabi64, cc: mips64el-linux-gnuabi64-gcc,qemu: qemu-mips64el-static }
117e66f31c5Sopenharmony_ci          - {target: arm (u64 slots),     toolchain: gcc-arm-linux-gnueabi,     cc: arm-linux-gnueabi-gcc,      qemu: qemu-arm-static}
118e66f31c5Sopenharmony_ci          - {target: aarch64 (u64 slots), toolchain: gcc-aarch64-linux-gnu,     cc: aarch64-linux-gnu-gcc,      qemu: qemu-aarch64-static}
119e66f31c5Sopenharmony_ci          - {target: ppc (u64 slots),     toolchain: gcc-powerpc-linux-gnu,     cc: powerpc-linux-gnu-gcc,      qemu: qemu-ppc-static}
120e66f31c5Sopenharmony_ci          - {target: ppc64 (u64 slots),   toolchain: gcc-powerpc64-linux-gnu,   cc: powerpc64-linux-gnu-gcc,    qemu: qemu-ppc64-static}
121e66f31c5Sopenharmony_ci
122e66f31c5Sopenharmony_ci    steps:
123e66f31c5Sopenharmony_ci      - uses: actions/checkout@v2
124e66f31c5Sopenharmony_ci      - name: Install QEMU
125e66f31c5Sopenharmony_ci        # this ensure install latest qemu on ubuntu, apt get version is old
126e66f31c5Sopenharmony_ci        env:
127e66f31c5Sopenharmony_ci          QEMU_SRC: "http://archive.ubuntu.com/ubuntu/pool/universe/q/qemu"
128e66f31c5Sopenharmony_ci          QEMU_VER: "qemu-user-static_7\\.2+dfsg-.*_amd64.deb$"
129e66f31c5Sopenharmony_ci        run: |
130e66f31c5Sopenharmony_ci          DEB=`curl -s $QEMU_SRC/ | grep -o -E 'href="([^"#]+)"' | cut -d'"' -f2 | grep $QEMU_VER | tail -1`
131e66f31c5Sopenharmony_ci          wget $QEMU_SRC/$DEB
132e66f31c5Sopenharmony_ci          sudo dpkg -i $DEB
133e66f31c5Sopenharmony_ci      - name: Install ${{ matrix.config.toolchain }}
134e66f31c5Sopenharmony_ci        run: |
135e66f31c5Sopenharmony_ci          sudo apt update
136e66f31c5Sopenharmony_ci          sudo apt install ${{ matrix.config.toolchain }} -y
137e66f31c5Sopenharmony_ci      - name: Configure with ${{ matrix.config.cc }}
138e66f31c5Sopenharmony_ci        run: |
139e66f31c5Sopenharmony_ci          mkdir build
140e66f31c5Sopenharmony_ci          cd build
141e66f31c5Sopenharmony_ci          cmake .. -DBUILD_TESTING=ON -DQEMU=ON -DCMAKE_C_COMPILER=${{ matrix.config.cc }}
142e66f31c5Sopenharmony_ci      - name: Build
143e66f31c5Sopenharmony_ci        run: |
144e66f31c5Sopenharmony_ci          cmake --build build
145e66f31c5Sopenharmony_ci          ls -lh build
146e66f31c5Sopenharmony_ci      - name: Test
147e66f31c5Sopenharmony_ci        run: |
148e66f31c5Sopenharmony_ci          ${{ matrix.config.qemu }} build/uv_run_tests_a
149