Fix CI after Ubuntu 20.04 discontinuation #47
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Compile and Test | |
| on: | |
| push: | |
| pull_request: | |
| release: | |
| jobs: | |
| build: | |
| # The type of runner that the job will run on | |
| name: ${{ matrix.config.name }} | |
| runs-on: ${{ matrix.config.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| config: | |
| # Run Tests on Ubuntu | |
| - name: "Ubuntu Debug SQLite" | |
| os: ubuntu-latest | |
| build_type: "Debug" | |
| test_database: "sqlite" | |
| - name: "Ubuntu Release SQLite" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| - name: "Ubuntu Debug PostgreSQL" | |
| os: ubuntu-latest | |
| build_type: "Debug" | |
| test_database: "postgresql" | |
| - name: "Ubuntu Release PostgreSQL" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "postgresql" | |
| - name: "Ubuntu Debug MySQL" | |
| os: ubuntu-latest | |
| build_type: "Debug" | |
| test_database: "mysql" | |
| - name: "Ubuntu Release MySQL" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "mysql" | |
| # Run Tests on Ubuntu with different GCC versions | |
| - name: "Ubuntu Release sqlite GCC 11" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| gcc_install: "11" | |
| - name: "Ubuntu Release sqlite GCC 12" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| gcc_install: "12" | |
| - name: "Ubuntu Release sqlite GCC 13" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| gcc_install: "13" | |
| - name: "Ubuntu Release sqlite GCC 14" | |
| os: ubuntu-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| gcc_install: "14" | |
| # Run Tests on MacOS | |
| - name: "macOS Debug SQLite" | |
| os: macos-latest | |
| build_type: "Debug" | |
| test_database: "sqlite" | |
| cmake_flags: "-DWITH_POSTGRESQL=OFF" | |
| - name: "macOS Release SQLite" | |
| os: macos-latest | |
| build_type: "Release" | |
| test_database: "sqlite" | |
| cmake_flags: "-DWITH_POSTGRESQL=OFF" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Boost | |
| if: ${{startsWith(matrix.config.os, 'ubuntu')}} | |
| run: | | |
| echo --- Installing Boost.Regex | |
| sudo apt-get update | |
| sudo apt-get install libboost-regex-dev | |
| - name: Install Boost | |
| if: ${{startsWith(matrix.config.os, 'macos')}} | |
| run: | | |
| echo --- Installing Boost.Regex | |
| brew install boost | |
| - name: Install gcc version | |
| if: ${{matrix.config.gcc_install}} | |
| run: | | |
| echo --- Install gcc version ${{matrix.config.gcc_install}} | |
| echo --- gcc version before | |
| gcc --version | |
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test | |
| sudo apt-get update | |
| sudo apt-get install gcc-${{matrix.config.gcc_install}} g++-${{matrix.config.gcc_install}} | |
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{matrix.config.gcc_install}} 90 --slave /usr/bin/g++ g++ /usr/bin/g++-${{matrix.config.gcc_install}} | |
| echo --- gcc version after | |
| gcc --version | |
| - name: Configure CMake | |
| run: > | |
| cmake -B ${{github.workspace}}/build | |
| -DCMAKE_BUILD_TYPE=${{matrix.config.build_type}} | |
| -DCMAKE_CXX_FLAGS="${{matrix.config.cxx_flags}}" | |
| -DTEST_DATABASE="${{matrix.config.test_database}}" | |
| -DBUILD_EXAMPLES=ON | |
| ${{matrix.config.cmake_flags}} | |
| - name: Build | |
| run: cmake --build ${{github.workspace}}/build --config ${{matrix.config.build_type}} | |
| - name: Set up PostgreSQL | |
| if: ${{startsWith(matrix.config.test_database, 'postgresql')}} | |
| run: | | |
| sudo /etc/init.d/postgresql start | |
| sudo -u postgres psql -c "CREATE USER $USER" | |
| sudo -u postgres psql -c "CREATE DATABASE $USER OWNER $USER;" | |
| - name: Set up MySQL | |
| if: ${{startsWith(matrix.config.test_database, 'mysql')}} | |
| run: | | |
| sudo /etc/init.d/mysql start | |
| mysql -hlocalhost -uroot -proot -e "CREATE USER $USER" | |
| mysql -hlocalhost -uroot -proot -e "CREATE DATABASE test" | |
| mysql -hlocalhost -uroot -proot -e "GRANT ALL ON test.* TO $USER" | |
| - name: Test | |
| working-directory: ${{github.workspace}}/build | |
| run: ctest -C ${{matrix.config.build_type}} |