diff options
author | Vadim Zeitlin <vz-swig@zeitlins.org> | 2021-09-30 18:11:44 +0200 |
---|---|---|
committer | Vadim Zeitlin <vz-swig@zeitlins.org> | 2021-09-30 18:17:24 +0200 |
commit | 55dfa99e4926efaba8bbdb9bb9ea085b3f75114b (patch) | |
tree | 89ac55fe43e0088d918a0e5986be56c9c3862f60 /.github | |
parent | a6300299bf44a5482939c2b5746ab725c9c96a63 (diff) | |
download | swig-55dfa99e4926efaba8bbdb9bb9ea085b3f75114b.tar.gz |
Define CC and CXX environment variables correctly
They are supposed to be set to gcc-$GCC and g++-$GCC respectively, if
the suffix is defined, so do it.
Also use "compiler", rather than "CC", in the matrix for consistency
with .travis.yml and to avoid confusion between this property, which may
be empty, and CC environment variable, which is supposed to be always
defined.
Finally, show the path and the version of the compiler being used: this
was also done under Travis CI and there doesn't seem to be any reason
not to do it here.
Diffstat (limited to '.github')
-rw-r--r-- | .github/workflows/ci.yml | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3e4d16162..7db336f53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: GCC: 10 desc: gcc10 - SWIGLANG: "" - CC: clang + compiler: clang desc: clang - CPP11: 1 SWIGLANG: python @@ -56,7 +56,6 @@ jobs: SWIGLANG: ${{ matrix.SWIGLANG }} SWIG_FEATURES: ${{ matrix.SWIG_FEATURES }} CONFIGOPTS: ${{ matrix.CONFIGOPTS }} - CC: ${{ matrix.CC }} CSTD: ${{ matrix.CSTD }} CPP11: ${{ matrix.CPP11 }} CPP14: ${{ matrix.CPP14 }} @@ -71,7 +70,7 @@ jobs: - name: Install CCache uses: hendrikmuhs/ccache-action@v1 with: - key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.CC || 'gcc' }}${{ matrix.GCC }} + key: ${{ matrix.os || 'ubuntu-20.04' }}-${{ matrix.compiler || 'gcc' }}${{ matrix.GCC }} - name: Configure run: | @@ -80,6 +79,28 @@ jobs: echo PATH="$PATH" >> $GITHUB_ENV source Tools/GHA-linux-install.sh + + if test '${{ matrix.compiler }}' = 'clang'; then + CC="clang" + CXX="clang++" + elif test -n "$GCC"; then + CC="gcc-$GCC" + CXX="g++-$GCC" + else + CC="gcc" + CXX="g++" + fi + + export CC CXX + + echo CC="$CC" >> $GITHUB_ENV + echo CXX="$CXX" >> $GITHUB_ENV + + echo "Compiler used:" + ls -la $(which $CC) $(which $CXX) + $CC --version + $CXX --version + if test -n "$CPP11"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++11 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++11; fi if test -n "$CPP14"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++14 $CXXFLAGS" "CFLAGS=-std=c11 $CFLAGS") && export CSTD=c11 && export CPPSTD=c++14; fi if test -n "$CPP17"; then CONFIGOPTS+=(--enable-cpp11-testing "CXXFLAGS=-std=c++17 $CXXFLAGS" "CFLAGS=-std=c17 $CFLAGS") && export CSTD=c17 && export CPPSTD=c++17; fi |