From 98e92212832771eb2cdab0d3d95a644910c29749 Mon Sep 17 00:00:00 2001 From: Albin Johansson Date: Sat, 8 Jun 2024 02:35:54 +0200 Subject: [PATCH] Update ci.yml --- .github/workflows/ci.yml | 253 +++++++++++---------------------------- 1 file changed, 70 insertions(+), 183 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79b936647..3dd1b80b7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - CPP_VERSION: [ 17, 20, 23 ] + CPP_VERSION: [ 20 ] env: VCPKG_ROOT: ${{github.workspace}}/vcpkg VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/vcpkg/bincache @@ -22,11 +22,18 @@ jobs: run: | brew install cmake brew install ninja - brew install glfw - brew install sdl2 - brew install sdl2_image - brew install sdl2_mixer - brew install sdl2_ttf + + - name: Restore assets + id: restore-assets + uses: actions/cache@v3 + with: + path: "assets" + key: centurion-macos-download-assets-${{hashFiles('scripts/download_assets.py')}} + + - name: Download assets + working-directory: ./scripts + if: steps.restore-assets.outputs.cache-hit != 'true' + run: python download_assets.py - name: Restore Vcpkg artifacts id: restore-vcpkg-artifacts @@ -54,20 +61,23 @@ jobs: cmake .. -GNinja \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} \ - -DBUILD_TESTS=ON \ - -DBUILD_EXAMPLES=ON \ - -DTREAT_WARNINGS_AS_ERRORS=ON + -DCEN_USE_SYSTEM_SDL=OFF \ + -DCEN_USE_SDL_IMAGE=ON \ + -DCEN_USE_SDL_MIXER=ON \ + -DCEN_USE_SDL_TTF=ON \ + -DCEN_BUILD_UNIT_TESTS=ON \ + -DCEN_BUILD_DEMO_TESTS=ON \ + -DCEN_WARNINGS_AS_ERRORS=OFF - name: Compile run: ninja -C build - - name: Run unit tests - working-directory: ./build/test/unit-tests - run: ./centurion-tests + - name: Install + run: ninja install -C build - - name: Run mock tests - working-directory: ./build/test/mocked-tests - run: ./centurion-mocks + - name: Run unit tests + working-directory: ./build/test/unit + run: ./centurion-unit-tests ubuntu: runs-on: ubuntu-latest @@ -75,14 +85,7 @@ jobs: strategy: fail-fast: false matrix: - SDL_VERSION: [ 2.0.20, 2.0.22, 2.24.0, 2.26.0 ] - TTF_VERSION: [ 2.20.2 ] - IMG_VERSION: [ 2.6.3 ] - MIX_VERSION: [ 2.6.3 ] CPP_VERSION: [ 20 ] - include: - - { SDL_VERSION: 2.26.0, TTF_VERSION: 2.20.2, IMG_VERSION: 2.6.3, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.26.0, TTF_VERSION: 2.20.2, IMG_VERSION: 2.6.3, MIX_VERSION: 2.6.3, CPP_VERSION: 23 } env: VCPKG_ROOT: ${{github.workspace}}/vcpkg VCPKG_DEFAULT_BINARY_CACHE: ${{github.workspace}}/vcpkg/bincache @@ -129,6 +132,18 @@ jobs: fonts-dejavu-core \ libharfbuzz-dev + - name: Restore assets + id: restore-assets + uses: actions/cache@v3 + with: + path: "assets" + key: centurion-ubuntu-download-assets-${{hashFiles('scripts/download_assets.py')}} + + - name: Download assets + working-directory: ./scripts + if: steps.restore-assets.outputs.cache-hit != 'true' + run: python download_assets.py + - name: Restore Vcpkg id: restore-vcpkg-artifacts uses: actions/cache@v3 @@ -149,95 +164,6 @@ jobs: sudo ./vcpkg/vcpkg integrate install mkdir ${{env.VCPKG_DEFAULT_BINARY_CACHE}} - - name: Restore SDL2 - id: restore-sdl2 - uses: actions/cache@v3 - with: - path: SDL2-${{matrix.SDL_VERSION}} - key: SDL2-${{matrix.SDL_VERSION}} - - - name: Build SDL2 - if: steps.restore-sdl2.outputs.cache-hit != 'true' - run: | - wget https://www.libsdl.org/release/SDL2-${{matrix.SDL_VERSION}}.tar.gz - tar -xf SDL2-${{matrix.SDL_VERSION}}.tar.gz - rm -rf SDL2-${{matrix.SDL_VERSION}}.tar.gz - cd SDL2-${{matrix.SDL_VERSION}} - ./configure - make -j $(nproc) - - - name: Install SDL2 - run: | - cd SDL2-${{matrix.SDL_VERSION}} - sudo make install - - - name: Restore SDL2_image - id: restore-sdl2-image - uses: actions/cache@v3 - with: - path: SDL_image-release-${{ matrix.IMG_VERSION }} - key: SDL_image-${{ matrix.IMG_VERSION }} - - - name: Build SDL2_image - if: steps.restore-sdl2-image.outputs.cache-hit != 'true' - run: | - wget https://github.com/libsdl-org/SDL_image/archive/refs/tags/release-${{ matrix.IMG_VERSION }}.tar.gz - tar -xf release-${{ matrix.IMG_VERSION }}.tar.gz - rm -rf release-${{ matrix.IMG_VERSION }}.tar.gz - cd SDL_image-release-${{ matrix.IMG_VERSION }} - ./configure - make -j $(nproc) - - - name: Install SDL2_image - run: | - cd SDL_image-release-${{ matrix.IMG_VERSION }} - sudo make install - - - name: Restore SDL2_mixer - id: restore-sdl2-mixer - uses: actions/cache@v3 - with: - path: SDL_mixer-release-${{ matrix.MIX_VERSION }} - key: SDL2_mixer-${{ matrix.MIX_VERSION }} - - - name: Build SDL2_mixer - if: steps.restore-sdl2-mixer.outputs.cache-hit != 'true' - run: | - wget https://github.com/libsdl-org/SDL_mixer/archive/refs/tags/release-${{ matrix.MIX_VERSION }}.tar.gz - tar -xf release-${{ matrix.MIX_VERSION }}.tar.gz - rm -rf release-${{ matrix.MIX_VERSION }}.tar.gz - cd SDL_mixer-release-${{ matrix.MIX_VERSION }} - ./configure - make -j $(nproc) - - - name: Install SDL2_mixer - run: | - cd SDL_mixer-release-${{ matrix.MIX_VERSION }} - sudo make install - - - name: Restore SDL2_ttf - id: restore-sdl2-ttf - uses: actions/cache@v3 - with: - path: SDL_ttf-release-${{ matrix.TTF_VERSION }} - key: SDL2_ttf-${{ matrix.TTF_VERSION }} - - - name: Build SDL2_ttf - if: steps.restore-sdl2-ttf.outputs.cache-hit != 'true' - run: | - wget https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-${{ matrix.TTF_VERSION }}.tar.gz - tar -xf release-${{ matrix.TTF_VERSION }}.tar.gz - rm -rf release-${{ matrix.TTF_VERSION }}.tar.gz - cd SDL_ttf-release-${{ matrix.TTF_VERSION }} - ./autogen.sh - ./configure --disable-harfbuzz-builtin --disable-freetype-builtin --without-x - make -j $(nproc) - - - name: Install SDL2_ttf - run: | - cd SDL_ttf-release-${{ matrix.TTF_VERSION }} - sudo make install - - name: Emulate video device run: | /sbin/start-stop-daemon --start \ @@ -249,47 +175,32 @@ jobs: - name: Generate build files run: | - mkdir build && cd build + mkdir build + cd build cmake .. -GNinja \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} \ - -DBUILD_TESTS=ON \ - -DBUILD_EXAMPLES=ON \ - -DINCLUDE_AUDIO_TESTS=OFF \ - -DTREAT_WARNINGS_AS_ERRORS=ON + -DCEN_USE_SYSTEM_SDL=OFF \ + -DCEN_USE_SDL_IMAGE=ON \ + -DCEN_USE_SDL_MIXER=ON \ + -DCEN_USE_SDL_TTF=ON \ + -DCEN_BUILD_UNIT_TESTS=ON \ + -DCEN_BUILD_DEMO_TESTS=ON \ + -DCEN_WARNINGS_AS_ERRORS=OFF - name: Compile run: ninja -C build - - name: Run mocked tests - working-directory: ./build/test/mocked-tests - run: ./centurion-mocks + - name: Install + run: ninja install -C build - name: Run unit tests - working-directory: ./build/test/unit-tests - run: ./centurion-tests + working-directory: ./build/test/unit + run: ./centurion-unit-tests windows: runs-on: windows-latest if: contains(github.event.head_commit.message, '[skip-ci]') == false - strategy: - fail-fast: false - matrix: - SDL_VERSION: [ 2.24.0, 2.26.0 ] - TTF_VERSION: [ 2.0.18, 2.20.1 ] - IMG_VERSION: [ 2.0.5, 2.6.2 ] - MIX_VERSION: [ 2.6.3 ] - CPP_VERSION: [ 20 ] - include: - - { SDL_VERSION: 2.0.10, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.12, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.14, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.16, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.18, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.20, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.0.22, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 17 } - - { SDL_VERSION: 2.24.0, TTF_VERSION: 2.0.18, IMG_VERSION: 2.0.5, MIX_VERSION: 2.6.3, CPP_VERSION: 20 } - - { SDL_VERSION: 2.26.0, TTF_VERSION: 2.20.1, IMG_VERSION: 2.6.2, MIX_VERSION: 2.6.3, CPP_VERSION: 23 } env: VCPKG_ROOT: ${{github.workspace}}/vcpkg steps: @@ -303,10 +214,17 @@ jobs: with: version: 1.11.1 - - name: Print dependency versions - run: | - cmake --version - ninja --version + - name: Restore assets + id: restore-assets + uses: actions/cache@v3 + with: + path: "assets" + key: centurion-windows-download-assets-${{hashFiles('scripts/download_assets.py')}} + + - name: Download assets + working-directory: ./scripts + if: steps.restore-assets.outputs.cache-hit != 'true' + run: python download_assets.py - name: Restore Vcpkg id: restore-vcpkg-artifacts @@ -327,54 +245,23 @@ jobs: .\vcpkg\bootstrap-vcpkg.bat -disableMetrics .\vcpkg\vcpkg integrate install - - name: Download SDL2 - uses: albin-johansson/download-sdl2@latest - with: - version: ${{matrix.SDL_VERSION}} - sources_destination: . - binaries_destination: bin - - - name: Download SDL2_image - uses: albin-johansson/download-sdl2-image@latest - with: - version: ${{matrix.IMG_VERSION}} - sources_destination: . - binaries_destination: bin - - - name: Download SDL2_ttf - uses: albin-johansson/download-sdl2-ttf@latest - with: - version: ${{matrix.TTF_VERSION}} - sources_destination: . - binaries_destination: bin - - - name: Download SDL2_mixer - uses: albin-johansson/download-sdl2-mixer@latest - with: - version: ${{matrix.MIX_VERSION}} - sources_destination: . - binaries_destination: bin - - name: Generate build files - env: - SDL2DIR: ${{github.workspace}}/SDL2-${{matrix.SDL_VERSION}} - SDL2IMAGEDIR: ${{github.workspace}}/SDL2_image-${{matrix.IMG_VERSION}} - SDL2MIXERDIR: ${{github.workspace}}/SDL2_mixer-${{matrix.MIX_VERSION}} - SDL2TTFDIR: ${{github.workspace}}/SDL2_ttf-${{matrix.TTF_VERSION}} run: | mkdir build cd build cmake .. -GNinja ` -DCMAKE_BUILD_TYPE=Debug ` -DCMAKE_CXX_STANDARD=${{matrix.CPP_VERSION}} ` - -DBUILD_TESTS=ON ` - -DBUILD_EXAMPLES=ON ` - -DTREAT_WARNINGS_AS_ERRORS=ON + -DCEN_USE_SYSTEM_SDL=OFF ` + -DCEN_USE_SDL_IMAGE=ON ` + -DCEN_USE_SDL_MIXER=ON ` + -DCEN_USE_SDL_TTF=ON ` + -DCEN_BUILD_UNIT_TESTS=ON ` + -DCEN_BUILD_DEMO_TESTS=ON ` + -DCEN_WARNINGS_AS_ERRORS=OFF - name: Compile run: ninja -C build - - name: Run mocked tests - shell: cmd - working-directory: ./build/test/mocked-tests - run: centurion-mocks \ No newline at end of file + - name: Install + run: ninja install -C build