xref: /isa-l/.github/workflows/ci.yml (revision bd1ce56c43721d7b63de9b5fcb77c5e5202f04e6)
1name: Continous integration
2
3on:
4  pull_request:
5  push:
6    branches:
7      - master
8    tags:
9      - "*"
10
11permissions:
12  contents: read
13
14jobs:
15  check_format:
16    env:
17      CLANGFORMAT: clang-format-18
18    runs-on: ubuntu-latest
19    steps:
20      - uses: actions/checkout@v2.3.4
21        with:
22          fetch-depth: 2
23      - name: Install clang-format-18
24        run: |
25          wget https://apt.llvm.org/llvm.sh
26          chmod +x llvm.sh
27          sudo ./llvm.sh 18
28          sudo apt install -y clang-format-18
29      - name: Run format check
30        run: bash tools/check_format.sh
31
32  run_tests_unix:
33    needs: check_format
34    strategy:
35      matrix:
36        os:
37          - ubuntu-latest
38          - macos-13  # x86_64
39          - macos-14  # arm64
40        assembler:
41          - nasm
42    runs-on: ${{ matrix.os }}
43    steps:
44      - uses: actions/checkout@v2.3.4
45      - name: Install build dependencies (Linux)
46        run: sudo apt install ${{ matrix.assembler }}
47        if: runner.os == 'Linux'
48      - name: Install build dependencies (Macos)
49        run: brew install ${{ matrix.assembler }} automake autoconf coreutils libtool
50        if: runner.os == 'macOS'
51      - name: Build
52        run: |
53          ./autogen.sh
54          ./configure
55          bash -c 'make -j $(nproc)'
56      - name: Run tests
57        run: bash tools/test_checks.sh
58      - name: Run extended tests
59        run: bash tools/test_extended.sh
60
61  run_tests_mingw_linux_64:
62    needs: check_format
63    runs-on: ubuntu-latest
64    steps:
65      - uses: actions/checkout@v2.3.4
66      - name: Install build dependencies (Linux)
67        run: sudo apt install nasm mingw-w64
68      - name: Build
69        shell: bash
70        run: |
71          make -j $(nproc) -f Makefile.unx programs/igzip tests arch=mingw host_cpu=x86_64
72      # wine does not seem available, hence cannot run tests.
73
74  run_tests_mingw_linux_32:
75    needs: check_format
76    runs-on: ubuntu-latest
77    steps:
78      - uses: actions/checkout@v2.3.4
79      - name: Install build dependencies (Linux)
80        run: sudo apt install nasm mingw-w64
81      - name: Build
82        shell: bash
83        run: |
84          make -j $(nproc) -f Makefile.unx programs/igzip tests arch=mingw host_cpu=base_aliases CC=i686-w64-mingw32-gcc
85
86  run_tests_mingw_windows_64:
87    needs: check_format
88    runs-on: windows-latest
89    steps:
90      - uses: actions/checkout@v2.3.4
91      - name: Install nasm
92        uses: ilammy/setup-nasm@v1.2.0
93      - name: Build
94        shell: bash
95        run: |
96          make -j $(nproc) -f Makefile.unx programs/igzip tests SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
97      - name: Run tests
98        shell: bash
99        run: |
100          # autoconf is missing, hence simulates test_checks.sh
101          make -j $(nproc) -f Makefile.unx check D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
102      - name: Run extended tests
103        shell: bash
104        run: |
105          # simulates test_extended.sh
106          make -j $(nproc) -f Makefile.unx perf D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
107          make -j $(nproc) -f Makefile.unx test D=TEST_SEED=0 SIM= arch=mingw host_cpu=x86_64 AR=x86_64-w64-mingw32-gcc-ar
108
109  # seems like i686-w64-mingw32-gcc is not available on windows runner.
110
111  run_tests_windows:
112    needs: check_format
113    runs-on: windows-latest
114    steps:
115      - uses: actions/checkout@v2.3.4
116      - name: Set MSVC developer prompt
117        uses: ilammy/msvc-dev-cmd@v1.6.0
118      - name: Install nasm
119        uses: ilammy/setup-nasm@v1.2.0
120      - name: Build
121        run: |
122          nmake -f Makefile.nmake || exit /b 1
123          nmake checks -f Makefile.nmake || exit /b 1
124          nmake perfs -f Makefile.nmake || exit /b 1
125      - name: Run perf apps
126        run: nmake perf -f Makefile.nmake || exit /b 1
127      - name: Run checks
128        run: nmake check -f Makefile.nmake || exit /b 1
129