OSDN Git Service

Merge branch 'macos-develop' into macos-3-0-0
[hengbandforosx/hengbandosx.git] / .github / workflows / build-with-autotools.yml
1 name: Build with Autotools
2
3 on:
4   workflow_call:
5     inputs:
6       cxx:
7         type: string
8         required: true
9       cxx-flags:
10         type: string
11         required: true
12       configure-opts:
13         type: string
14         required: false
15       distcheck:
16         type: boolean
17         required: false
18       use-ccache:
19         type: boolean
20         required: false
21
22 jobs:
23   build:
24     runs-on: ubuntu-22.04
25     steps:
26       - uses: actions/checkout@v3
27         with:
28           submodules: true
29
30       - id: calculate-cache-key
31         name: Calculate cache key for ccache
32         run: |
33           key=$(echo "${{ inputs.cxx }} ${{ inputs.cxx-flags }} ${{ inputs.configure-opts }}" | sha256sum | cut -d' ' -f1)
34           echo "key=$key" >> $GITHUB_OUTPUT
35
36       - if: ${{ inputs.use-ccache }}
37         uses: hendrikmuhs/ccache-action@v1.2
38         with:
39           key: ${{ steps.calculate-cache-key.outputs.key }}
40           max-size: "200M"
41
42       - name: Configuring ccache to use precompiled headers
43         if: ${{ inputs.use-ccache }}
44         run: |
45           ln -s /usr/bin/ccache /usr/local/bin/${{ inputs.cxx }}
46           /usr/bin/ccache --set-config=sloppiness=pch_defines,time_macros,include_file_mtime,include_file_ctime
47           /usr/bin/ccache --set-config=pch_external_checksum=true
48           /usr/bin/ccache -p
49
50       - name: Install required packages
51         run: |
52           sudo apt-get update
53           sudo apt-get install \
54             libncursesw5-dev \
55             libcurl4-openssl-dev \
56             nkf \
57
58       - name: Generate configure
59         run: ./bootstrap
60
61       - name: Configure
62         run: ./configure ${{ inputs.configure-opts }}
63         env:
64           CXX: ${{ inputs.cxx }}
65           CXXFLAGS: ${{ inputs.cxx-flags }}
66
67       - name: Build with distcheck
68         if: ${{ inputs.distcheck }}
69         run: make DISTCHECK_CONFIGURE_FLAGS="CXX=\"${{ inputs.cxx }}\" CXXFLAGS=\"${{ inputs.cxx-flags }}\" ${{ inputs.configure-opts }}" -j$(nproc) distcheck >/dev/null
70
71       - name: Build
72         if: ${{ !inputs.distcheck }}
73         run: make -j$(nproc) >/dev/null