From: Steve Lhomme <slhomme@matroska.org>
Date: Sun, 25 Sep 2022 05:41:50 +0000 (+0200)
Subject: CI: add a basic compilation test
X-Git-Tag: release-1.7.0~6
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8752b590220cd5d3eae64a74039f684994c49baa;p=libmatroska

CI: add a basic compilation test

It needs to build libebml first.
---

diff --git a/.github/workflows/linux-gcc10.yaml b/.github/workflows/linux-gcc10.yaml
new file mode 100644
index 0000000..105f544
--- /dev/null
+++ b/.github/workflows/linux-gcc10.yaml
@@ -0,0 +1,47 @@
+name: "Linux gcc10 Build"
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # branches: [ master ]
+
+jobs:
+  build_libmatroska:
+    name: libmatroska for Linux gcc10
+    runs-on: ubuntu-latest
+    steps:
+      - uses: lukka/get-cmake@latest
+
+      - name: Get pushed code
+        uses: actions/checkout@v3
+      
+      - name: Checkout libebml
+        uses: actions/checkout@v3
+        with: 
+          repository: Matroska-Org/libebml
+          path: libebml
+          # minimum version we support ref: 'release-1.4.3'
+
+      - name: Configure libebml
+        run: cmake -S libebml -B libebml/_build
+        env:
+          CC:  gcc-10
+          CXX: g++-10
+
+      - name: Build libebml
+        run: cmake --build libebml/_build --parallel
+
+      - name: Install libebml
+        run: cmake --install libebml/_build --prefix ${GITHUB_WORKSPACE}/_built
+
+      - name: Configure CMake
+        run: cmake -S . -B _build -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML"
+        env:
+          CC:  gcc-10
+          CXX: g++-10
+
+      - name: Build with CMake
+        run: cmake --build _build --parallel
+
+      - name: Test installation
+        run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml
new file mode 100644
index 0000000..bacc280
--- /dev/null
+++ b/.github/workflows/linux.yaml
@@ -0,0 +1,41 @@
+name: "Linux Build"
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # branches: [ master ]
+
+jobs:
+  build_libmatroska:
+    name: libmatroska for Linux
+    runs-on: ubuntu-latest
+    steps:
+      - uses: lukka/get-cmake@latest
+
+      - name: Get pushed code
+        uses: actions/checkout@v3
+      
+      - name: Checkout libebml
+        uses: actions/checkout@v3
+        with: 
+          repository: Matroska-Org/libebml
+          path: libebml
+          # minimum version we support ref: 'release-1.4.3'
+
+      - name: Configure libebml
+        run: cmake -S libebml -B libebml/_build
+
+      - name: Build libebml
+        run: cmake --build libebml/_build --parallel
+
+      - name: Install libebml
+        run: cmake --install libebml/_build --prefix ${GITHUB_WORKSPACE}/_built
+
+      - name: Configure CMake 
+        run: cmake -S . -B _build -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML"
+
+      - name: Build with CMake
+        run: cmake --build _build --parallel
+
+      - name: Test installation
+        run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
diff --git a/.github/workflows/macos.yaml b/.github/workflows/macos.yaml
new file mode 100644
index 0000000..934a720
--- /dev/null
+++ b/.github/workflows/macos.yaml
@@ -0,0 +1,41 @@
+name: "macOS Build"
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # branches: [ master ]
+
+jobs:
+  build_libmatroska:
+    name: libmatroska for macOS
+    runs-on: macos-latest
+    steps:
+      - uses: lukka/get-cmake@latest
+
+      - name: Get pushed code
+        uses: actions/checkout@v3
+      
+      - name: Checkout libebml
+        uses: actions/checkout@v3
+        with: 
+          repository: Matroska-Org/libebml
+          path: libebml
+          # minimum version we support ref: 'release-1.4.3'
+
+      - name: Configure libebml
+        run: cmake -S libebml -B libebml/_build
+
+      - name: Build libebml
+        run: cmake --build libebml/_build --parallel
+
+      - name: Install libebml
+        run: cmake --install libebml/_build --prefix ${GITHUB_WORKSPACE}/_built
+
+      - name: Configure CMake 
+        run: cmake -S . -B _build -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML"
+
+      - name: Build with CMake
+        run: cmake --build _build --parallel
+
+      - name: Test installation
+        run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
diff --git a/.github/workflows/windows.yaml b/.github/workflows/windows.yaml
new file mode 100644
index 0000000..1dfed33
--- /dev/null
+++ b/.github/workflows/windows.yaml
@@ -0,0 +1,45 @@
+name: "Windows Build"
+on:
+  push:
+    branches: [ master ]
+  pull_request:
+    # branches: [ master ]
+
+jobs:
+  build_libmatroska:
+    name: ${{ matrix.config }} libmatroska for Windows
+    runs-on: windows-latest
+    strategy:
+      fail-fast: false
+      matrix:
+        config: [Debug, Release]
+    steps:
+      - uses: lukka/get-cmake@latest
+
+      - name: Get pushed code
+        uses: actions/checkout@v3
+      
+      - name: Checkout libebml
+        uses: actions/checkout@v3
+        with: 
+          repository: Matroska-Org/libebml
+          path: libebml
+          # minimum version we support ref: 'release-1.4.3'
+
+      - name: Configure libebml
+        run: cmake -S libebml -B libebml/_build
+
+      - name: Build libebml
+        run: cmake --build libebml/_build --config ${{ matrix.config }} --parallel
+
+      - name: Install libebml
+        run: cmake --install libebml/_build --config ${{ matrix.config }} --prefix ${GITHUB_WORKSPACE}/_built
+
+      - name: Configure CMake 
+        run: cmake -S . -B _build -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML"
+
+      - name: Build with CMake
+        run: cmake --build _build --config ${{ matrix.config }} --parallel
+
+      - name: Test installation
+        run: cmake --install _build --config ${{ matrix.config }} --prefix ${GITHUB_WORKSPACE}/_built
diff --git a/README.md b/README.md
index 01ac891..e4f04e3 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,8 @@
+[![Linux](https://github.com/Matroska-Org/libmatroska/actions/workflows/linux.yaml/badge.svg)](https://github.com/Matroska-Org/libmatroska/actions/workflows/linux.yaml)
+[![Windows](https://github.com/Matroska-Org/libmatroska/actions/workflows/windows.yaml/badge.svg)](https://github.com/Matroska-Org/libmatroska/actions/workflows/windows.yaml)
+[![macOS](https://github.com/Matroska-Org/libmatroska/actions/workflows/macos.yaml/badge.svg)](https://github.com/Matroska-Org/libmatroska/actions/workflows/macos.yaml)
+[![GCC10](https://github.com/Matroska-Org/libmatroska/actions/workflows/linux-gcc10.yaml/badge.svg)](https://github.com/Matroska-Org/libmatroska/actions/workflows/linux-gcc10.yaml)
+
 # libmatroska
 a C++ library to parse and create Matroska files