Browse Source

CI: Add GitHub Actions (#2929)

Biswapriyo Nath 3 years ago
parent
commit
dfa9c9fb83
2 changed files with 136 additions and 0 deletions
  1. 4 0
      .editorconfig
  2. 132 0
      .github/workflows/main.yml

+ 4 - 0
.editorconfig

@@ -18,3 +18,7 @@ indent_style = space
 [*.md]
 trim_trailing_whitespace = false
 max_line_length = 80
+
+[.github/workflows/*.yml]
+indent_style = space
+indent_size  = 2

+ 132 - 0
.github/workflows/main.yml

@@ -0,0 +1,132 @@
+name: CI
+
+on:
+  push:
+  pull_request:
+
+jobs:
+  msvc:
+    strategy:
+      fail-fast: false
+      matrix:
+        include: [
+          { config: Debug, platform: Win32, bindir: 'win32_vs2019' },
+          { config: Debug, platform: x64, bindir: 'win64_vs2019' },
+          { config: Release, platform: Win32, bindir: 'win32_vs2019' },
+          { config: Release, platform: x64, bindir: 'win64_vs2019' },
+        ]
+    name: msvc-${{ matrix.config }}-${{ matrix.platform }}
+    runs-on: windows-2019
+    steps:
+      - name: Checkout bgfx
+        uses: actions/checkout@v3
+        with:
+          path: bgfx
+      - name: Checkout bx
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bx
+          path: bx
+      - name: Checkout bimg
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bimg
+          path: bimg
+      - name: Prepare
+        uses: microsoft/[email protected]
+      - name: Build
+        shell: cmd
+        run: |
+          cd bgfx
+          ..\bx\tools\bin\windows\genie.exe --with-tools --with-combined-examples --with-shared-lib vs2019
+          msbuild ".build/projects/vs2019/bgfx.sln" /m /v:minimal /p:Configuration=${{ matrix.config }} /p:Platform=${{ matrix.platform }}
+      - name: Check
+        shell: cmd
+        run: |
+          cd bgfx
+          dir /s ".build\${{ matrix.bindir }}\bin"
+          ".build\${{ matrix.bindir }}\bin\geometryc${{ matrix.config }}.exe" --version
+          ".build\${{ matrix.bindir }}\bin\shaderc${{ matrix.config }}.exe" --version
+          ".build\${{ matrix.bindir }}\bin\texturec${{ matrix.config }}.exe" --version
+  mingw:
+    strategy:
+      fail-fast: false
+      matrix:
+        include: [
+          { msystem: MINGW64, project: 'mingw-gcc', bindir: 'win64_mingw-gcc' },
+          { msystem: CLANG64, project: 'mingw-clang', bindir: 'win64_mingw-clang' },
+        ]
+    name: mingw-${{ matrix.msystem }}
+    runs-on: windows-latest
+    steps:
+      - name: Checkout bgfx
+        uses: actions/checkout@v3
+        with:
+          path: bgfx
+      - name: Checkout bx
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bx
+          path: bx
+      - name: Checkout bimg
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bimg
+          path: bimg
+      - name: Prepare
+        uses: msys2/setup-msys2@v2
+        with:
+          msystem: ${{ matrix.msystem }}
+          update: true
+          install: make
+          pacboy: cc:p
+      - name: Build
+        shell: msys2 {0}
+        run: |
+          cd bgfx
+          make ${{ matrix.project }}-release64 -j$(nproc) AR=ar CC=cc CXX=c++ MINGW=$MINGW_PREFIX
+      - name: Check
+        shell: cmd
+        run: |
+          cd bgfx
+          dir /s ".build\${{ matrix.bindir }}\bin"
+          ".build\${{ matrix.bindir }}\bin\geometrycRelease.exe" --version
+          ".build\${{ matrix.bindir }}\bin\shadercRelease.exe" --version
+          ".build\${{ matrix.bindir }}\bin\texturecRelease.exe" --version
+  linux:
+    strategy:
+      fail-fast: false
+      matrix:
+        include: [
+          { config: debug, binsuffix: Debug },
+          { config: release, binsuffix: Release },
+        ]
+    name: linux-${{ matrix.config }}64
+    runs-on: ubuntu-latest
+    steps:
+      - name: Checkout bgfx
+        uses: actions/checkout@v3
+        with:
+          path: bgfx
+      - name: Checkout bx
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bx
+          path: bx
+      - name: Checkout bimg
+        uses: actions/checkout@v3
+        with:
+          repository: bkaradzic/bimg
+          path: bimg
+      - name: Build
+        run: |
+          sudo apt install libgl-dev
+          cd bgfx
+          make -j$(nproc) linux-${{ matrix.config }}64
+      - name: Check
+        run: |
+          cd bgfx
+          ls -lash ".build/linux64_gcc/bin"
+          ".build/linux64_gcc/bin/geometryc${{ matrix.binsuffix}}" --version
+          ".build/linux64_gcc/bin/shaderc${{ matrix.binsuffix}}" --version
+          ".build/linux64_gcc/bin/texturec${{ matrix.binsuffix}}" --version