diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ff1889a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,86 @@ +name: build +on: + push: + branches-ignore: + - '**pages**' + pull_request: + branches-ignore: + - '**pages**' + +env: + CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm-cache + +jobs: + build: + name: ${{ matrix.os }}-${{ matrix.build_type }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest] + build_type: [RelWithDebInfo] + generator: [Ninja] + include: + - os: windows-2022 + build_type: RelWithDebInfo + generator: "Visual Studio 17 2022" + arch: amd64 + toolset: -T v143 + - os: windows-2022 + build_type: RelWithDebInfo + generator: "Visual Studio 17 2022" + arch: amd64_arm64 + toolset: -T v143 + - os: windows-2019 + build_type: RelWithDebInfo + generator: "Visual Studio 16 2019" + arch: amd64_x86 + toolset: -T v141_xp + + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Initialise MSVC environment + if: "contains(matrix.os, 'windows')" + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: ${{ matrix.arch }} + + - uses: lukka/get-cmake@latest + + - run: mkdir ${{ env.CPM_SOURCE_CACHE }} + + - name: Cache multiple paths + uses: actions/cache@v3 + with: + path: | + ${{ env.CPM_SOURCE_CACHE }} + ${{ github.workspace }}/build/_deps + ${{ github.workspace }}/build/**/cmake_pch.* + key: ${{ matrix.os }}-${{ hashFiles('CMakeLists.txt','.github/workflows/build.yml') }} + + - name: Build + run: | + cmake -S . -B build -G "${{ matrix.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.toolset }} + cmake --build build + + - name: Tar output on Unix systems + if: "contains(matrix.os, 'windows') == false" + run: | + cd ${{ github.workspace }}/build + tar cf haiyajan.tar haiyajan* + + - name: Get Short SHA + id: vars + run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" + + - name: Upload output + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.os }}${{ matrix.arch}}-${{ matrix.build_type }}-${{ steps.vars.outputs.sha_short }} + path: | + ${{ github.workspace }}/build/haiyajan.tar + ${{ github.workspace }}/build/**/haiyajan.exe + ${{ github.workspace }}/build/**/haiyajan.pdb diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml deleted file mode 100644 index 3022fee..0000000 --- a/.github/workflows/c-cpp.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: C CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - build: - name: Make on ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-latest] - #os: [ubuntu-latest, windows-latest, macOS-latest] - - steps: - - uses: actions/checkout@v2 - - name: Install GNU make - run: sudo apt-get install make - - name: Make and install sdl2 - run: | - wget https://www.libsdl.org/release/SDL2-2.0.12.tar.gz - tar xf SDL2-2.0.12.tar.gz - cd SDL2-2.0.12 - mkdir build - cd build - cmake .. - make - sudo make install - - name: Install x264 - run: sudo apt-get install libx264-dev - - name: Install wavpack - run: sudo apt-get install libwavpack-dev - - name: make - run: make DEBUG=1 - - name: Codecov - uses: codecov/codecov-action@v1.0.13 - - name: Upload a Build Artifact - uses: actions/upload-artifact@v2.2.0 - with: - path: haiyajan - if-no-files-found: error - retention-days: 14