aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 6a44ce69cc22484d3f1506b5cada9451dd1b64fd (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
# See also https://docs.github.com/en/actions/learn-github-actions/expressions
# See also https://github.com/marketplace/actions/setup-android-ndk

name: CI

on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        build:
        - android-23
        - android-33
        - linux-gcc
        - linux-clang
        - linux-x86-gcc
        - linux-powerpc64-gcc
        - linux-mingw64-gcc
        - macos
        include:
        - build: android-23
          cc: clang
          host: aarch64-linux-android23
        - build: android-33
          cc: clang
          host: aarch64-linux-android33
        - build: linux-gcc
          cc: gcc
        - build: linux-clang
          cc: clang
        - build: linux-x86-gcc
          cc: gcc
          arch: x86
        - build: linux-powerpc64-gcc
          cc: gcc
          host: powerpc64-linux-gnu
        - build: linux-mingw64-gcc
          cc: gcc
          host: x86_64-w64-mingw32
        - build: macos
          cc: clang
          os: macos-latest
    steps:
      - uses: actions/checkout@v3
      - name: Install Android NDK
        run: |
          case ${{matrix.build}} \
          in android*) \
              wget --quiet https://dl.google.com/android/repository/android-ndk-r25c-linux.zip; \
              unzip -q android-ndk-r25c-linux.zip;;  \
          esac
      - name: Install Ubuntu packages
        run: |
          sudo apt-get -q update
          case "${{matrix.host}}" in                                        \
            x86_64-w64-mingw32)                                             \
              sudo apt-get -q install -y binutils-mingw-w64 gcc-mingw-w64;; \
            powerpc64-linux-gnu)                                            \
              sudo apt-get -q install -y binutils-powerpc64-linux-gnu       \
              gcc-powerpc64-linux-gnu;;                                     \
          esac
      - name: Build
        run: |
          echo "HOST=${{matrix.host}}"
          NDK=$PWD/android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64/bin
          export PATH="$NDK:$PATH"
          ./autogen.sh
          ./configure --host=${{matrix.host}} \
              CC=${{ matrix.host && format('{0}-{1}', matrix.host, matrix.cc) || matrix.cc }} \
              CFLAGS="-Wall -Wextra -Werror -Wno-sign-compare -Wno-unused-function -Wno-unused-parameter ${{matrix.cflags}}"
          make -j$(nproc)
  fbsd:
    runs-on: ubuntu-22.04
    name: A job to build sg3_utils on FreeBSD
    env:
      MYTOKEN : ${{ secrets.MYTOKEN }}
      MYTOKEN2: "value2"
    steps:
    - uses: actions/checkout@v4
    - name: Test in FreeBSD
      id: test
      uses: vmactions/freebsd-vm@v1
      with:
        envs: 'MYTOKEN MYTOKEN2'
        usesh: true
        prepare: |
          pkg install -y curl

        run: |
          freebsd-version
          ./autogen.sh
          ./configure
          make CFLAGS="-Werror"