aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/tools.yml
blob: 76cbd30db7e75d9ad70d304a2ffedf5f84c35e89 (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
name: Build host tools

on:
  pull_request:
    paths:
      - 'tools/**'

jobs:
  build:
    name: Build tools on ${{ matrix.os }}
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: False
      matrix:
        os: 
          - ubuntu-latest
          - macos-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          fetch-depth: 0
          path: openwrt

      - name: Setup MacOS
        if: ${{ matrix.os == 'macos-latest' }}
        run: |
          echo "WORKPATH=/Volumes/OpenWrt/openwrt/" >> "$GITHUB_ENV"
          hdiutil create -size 20g -type SPARSE -fs "Case-sensitive HFS+" -volname OpenWrt OpenWrt.sparseimage
          hdiutil attach OpenWrt.sparseimage
          mv "$GITHUB_WORKSPACE/openwrt" /Volumes/OpenWrt/
          cd "$WORKPATH"

          brew install \
            autoconf \
            automake \
            coreutils \
            diffutils \
            findutils \
            gawk \
            gettext \
            git-extras \
            gmp \
            gnu-getopt \
            gnu-sed \
            gnu-tar \
            grep \
            libidn2 \
            libunistring \
            m4 \
            make \
            mpfr \
            ncurses \
            openssl@1.1 \
            pcre \
            pkg-config \
            quilt \
            readline \
            wget \
            zstd

            echo "/bin" >> "$GITHUB_PATH"
            echo "/sbin/Library/Apple/usr/bin" >> "$GITHUB_PATH"
            echo "/usr/bin" >> "$GITHUB_PATH"
            echo "/usr/local/bin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/coreutils/bin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/findutils/libexec/gnubin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/gettext/bin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/gnu-getopt/bin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
            echo "/usr/local/opt/make/libexec/gnubin" >> "$GITHUB_PATH"
            echo "/usr/sbin" >> "$GITHUB_PATH"
            pwd

      - name: Setup Ubuntu
        if: ${{ matrix.os == 'ubuntu-latest' }}
        env:
          DEBIAN_FRONTEND: noninteractive
        run: |
          sudo apt-get update
          sudo apt-get -y install \
            build-essential \
            ccache \
            clang-12 \
            ecj \
            fastjar \
            file \
            g++ \
            gawk \
            gettext \
            git \
            java-propose-classpath \
            libelf-dev \
            libncurses-dev \
            libssl-dev \
            mkisofs \
            python3 \
            python3-dev \
            python3-distutils \
            python3-setuptools \
            qemu-utils \
            rsync \
            subversion \
            swig \
            unzip \
            wget \
            xsltproc \
            zlib1g-dev
          echo "WORKPATH=$GITHUB_WORKSPACE/openwrt/" >> "$GITHUB_ENV"
          cd "$WORKPATH"
          pwd

      - name: Make prereq
        run: |
          cd "$WORKPATH"
          pwd
          make defconfig

      - name: Build tools
        run: |
          cd "$WORKPATH"
          make tools/install -j$(nproc) BUILD_LOG=1

      - name: Move logs to GITHUB_WORKSPACE
        if: failure()
        run: |
          cp -r "$WORKPATH/logs" "$GITHUB_WORKSPACE"

      - name: Upload logs
        if: failure()
        uses: actions/upload-artifact@v2
        with:
          name: ${{ matrix.os }}-logs
          path: "logs"