From fecc4d80863a386be39bc1de728adb9e58649d4c Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Sat, 6 May 2023 22:13:20 +0700 Subject: [PATCH] switch to UCRT MSYS2 build, cosmetic changes (#1037) --- .github/workflows/main.yml | 99 ++++++++++++++++++---------------- .github/workflows/win_msvc.yml | 28 +++++----- 2 files changed, 67 insertions(+), 60 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64d41e90..d3a0fdf8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: build +name: Continuous Integration on: push: @@ -10,15 +10,39 @@ on: paths-ignore: ['**.md'] jobs: - linux64: - runs-on: ubuntu-latest - + build: + name: ${{ matrix.config.name }} + runs-on: ${{ matrix.config.os }} + defaults: + run: + shell: ${{ matrix.config.shell }} strategy: matrix: - compiler: [clang, gcc] + config: + - { + name: Linux GCC, + os: ubuntu-latest, + compiler: gcc, + shell: bash, + } + - { + name: Linux Clang, + os: ubuntu-latest, + compiler: clang, + shell: bash, + } + - { + name: MSYS2 UCRT64, + os: windows-latest, + compiler: gcc, + shell: 'msys2 {0}', + msystem: ucrt64, + msys-env: mingw-w64-ucrt-x86_64, + } steps: - - name: Install dependencies + - name: Install dependencies (Linux) + if: matrix.config.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install \ @@ -30,12 +54,31 @@ jobs: libxmp-dev \ ninja-build + - name: Install dependencies (MSYS2) + if: matrix.config.shell == 'msys2 {0}' + uses: msys2/setup-msys2@v2 + with: + msystem: ${{ matrix.config.msystem }} + update: false + install: >- + ${{ matrix.config.msys-env }}-gcc + ${{ matrix.config.msys-env }}-cmake + ${{ matrix.config.msys-env }}-ninja + ${{ matrix.config.msys-env }}-SDL2 + ${{ matrix.config.msys-env }}-SDL2_net + ${{ matrix.config.msys-env }}-openal + ${{ matrix.config.msys-env }}-libsndfile + ${{ matrix.config.msys-env }}-fluidsynth + ${{ matrix.config.msys-env }}-libxmp + - uses: actions/checkout@v3 - name: Configure env: - CC: ${{ matrix.compiler }} - run: cmake -B build -G "Ninja" -DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON + CC: ${{ matrix.config.compiler }} + run: | + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_WERROR=ON -DENABLE_HARDENING=ON -DENABLE_LTO=ON - name: Build run: cmake --build build @@ -43,9 +86,10 @@ jobs: - name: Install run: | cd build - ninja -v package + cpack cppcheck: + name: Cppcheck runs-on: ubuntu-latest steps: @@ -58,40 +102,3 @@ jobs: shell: bash run: | cppcheck --version ; cppcheck --error-exitcode=1 -j4 -q --force -U_WIN32 -Isrc opl src setup textscreen - - win64_msys2: - runs-on: windows-latest - - defaults: - run: - shell: msys2 {0} - - steps: - - name: Setup MSYS2 - uses: msys2/setup-msys2@v2 - with: - msystem: mingw64 - update: false - install: >- - mingw-w64-x86_64-gcc - mingw-w64-x86_64-cmake - mingw-w64-x86_64-ninja - mingw-w64-x86_64-SDL2 - mingw-w64-x86_64-SDL2_net - mingw-w64-x86_64-openal - mingw-w64-x86_64-libsndfile - mingw-w64-x86_64-fluidsynth - mingw-w64-x86_64-libxmp - - - uses: actions/checkout@v3 - - - name: Configure - run: cmake -B build -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DENABLE_WERROR=ON - - - name: Build - run: cmake --build build - - - name: Package - run: | - cd build - cpack -G ZIP diff --git a/.github/workflows/win_msvc.yml b/.github/workflows/win_msvc.yml index a75373df..f8f40453 100644 --- a/.github/workflows/win_msvc.yml +++ b/.github/workflows/win_msvc.yml @@ -1,4 +1,4 @@ -name: artifacts +name: Artifacts on: push: @@ -15,8 +15,9 @@ env: VCPKG_BINARY_SOURCES: "clear;nuget,GitHub,readwrite" jobs: - msvc: + build: if: ${{ github.repository == 'fabiangreffrath/woof' }} + name: MSVC ${{ matrix.arch }} runs-on: windows-latest strategy: @@ -30,20 +31,19 @@ jobs: shell: bash run: | set -euo pipefail - cd ${{ env.VCPKG_ROOT }} - git pull - ./bootstrap-vcpkg.sh -disableMetrics - nuget=$(./vcpkg.exe fetch nuget | tail -n 1) - owner="${GITHUB_REPOSITORY%/*}" - source_url="https://nuget.pkg.github.com/$owner/index.json" - "$nuget" sources add \ - -source "$source_url" \ + + NUGET=$(vcpkg fetch nuget | tail -n 1) + GH_PACKAGES_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + + "$NUGET" sources add \ + -source "$GH_PACKAGES_URL" \ -storepasswordincleartext \ -name "GitHub" \ - -username "$owner" \ + -username "${{ github.repository_owner }}" \ -password "${{ secrets.GITHUB_TOKEN }}" - "$nuget" setapikey "${{ secrets.GITHUB_TOKEN }}" \ - -source "$source_url" + + "$NUGET" setapikey "${{ secrets.GITHUB_TOKEN }}" \ + -source "$GH_PACKAGES_URL" - name: Setup devcmd uses: ilammy/msvc-dev-cmd@v1 @@ -65,7 +65,7 @@ jobs: - name: Package run: | cd build - cpack -G ZIP + cpack - name: Upload artifacts uses: actions/upload-artifact@v3