diff --git a/.editorconfig b/.editorconfig index a1395a709b..094be9037b 100644 --- a/.editorconfig +++ b/.editorconfig @@ -18,3 +18,7 @@ indent_style = space [*.md] trim_trailing_whitespace = false max_line_length = 80 + +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml new file mode 100644 index 0000000000..77712f7512 --- /dev/null +++ b/.github/workflows/ccpp.yml @@ -0,0 +1,99 @@ +name: C/C++ CI + +on: [push] + +jobs: + build: + strategy: + matrix: + platform: [darwin, linux] + include: + - platform: darwin + arch: x64 + build: osx64_clang + config: osx-release64 + image: macos-latest + - platform: linux + arch: x64 + build: linux64_gcc + config: linux-release64 + image: ubuntu-latest + # - platform: windows + # arch: x64 + # build: win64_vs2017 + # config: vs2017-release64 + # image: windows-latest + runs-on: ${{ matrix.image }} + steps: + - name: Checkout bgfx. + uses: actions/checkout@v1 + with: + fetch-depth: 1 + path: ./bgfx + - name: Checkout bx. + uses: actions/checkout@v1 + with: + fetch-depth: 1 + path: ./bx + ref: refs/heads/master + repository: bkaradzic/bx + - name: Checkout bImg. + uses: actions/checkout@v1 + with: + fetch-depth: 1 + path: ./bimg + ref: refs/heads/master + repository: bkaradzic/bimg + # TODO: cache this dependency. + - name: Install build dependencies (Linux). + if: matrix.platform == 'linux' + # See: https://bkaradzic.github.io/bgfx/build.html#linux + run: sudo apt-get install libgl1-mesa-dev x11proto-core-dev libx11-dev + - name: Generate project files. + run: make + - name: Compile. + run: make ${{matrix.config}} + - name: Fix rpath in OSX. + if: matrix.platform == 'darwin' + run: install_name_tool -id "@rpath/libbgfx-shared-libRelease.dylib" ./.build/${{ matrix.build }}/bin/libbgfx-shared-libRelease.dylib + - name: Copy relevant binaries to build artifact. + run: | + mkdir -p ../output/ + cp -r ./.build/${{ matrix.build }}/bin/libbgfx-shared-libRelease* ../output/ + cp -r ./.build/${{ matrix.build }}/bin/shadercRelease* ../output/ + cp -r ./.build/${{ matrix.build }}/bin/texturecRelease* ../output/ + - name: Upload binaries as artifact. + uses: actions/upload-artifact@v1 + with: + name: binaries-${{ matrix.platform }}-${{ matrix.arch }} + path: ../output + - name: Upload failed build directory. + if: failure() + uses: actions/upload-artifact@v1 + with: + name: debug-${{ matrix.platform }}-${{ matrix.arch }} + path: . + release: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + path: ./bgfx + - uses: actions/checkout@v1 + with: + fetch-depth: 1 + path: ./bx + ref: refs/heads/master + repository: bkaradzic/bx + - name: Copy include headers to build output. + run: | + mkdir -p ./output/include/bgfx ./output/include/bx + cp -r ./bgfx/include/bgfx/* ./output/include/bgfx + cp -r ./bx/include/bx/platform.h ./output/include/bx + working-directory: ${{ github.workspace }}/.. + - uses: actions/upload-artifact@v1 + with: + name: output + path: ../output