From 72dd55611cc991dcd857965ebb76ce377de2f8be Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 11:36:55 -0700
Subject: [PATCH 01/16] github actions: add build description

Add basic builds on Ubuntu and macOS hosts for Github's CI
automation. Each builds with either GNU Autotools or the
plain Makefile, and then builds the documentation.

Based on similar code from libopusenc, borrowing steps
from the ci scripts directory and .travis-ci.yml.
---
 .github/workflows/action.yml | 75 ++++++++++++++++++++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 .github/workflows/action.yml

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
new file mode 100644
index 0000000..049efaf
--- /dev/null
+++ b/.github/workflows/action.yml
@@ -0,0 +1,75 @@
+name: GitHub CI
+
+on:
+  push:
+  pull_request:
+  schedule:
+    - cron: '0 0 1 * *'
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        name:
+          [
+            ubuntu-autotools,
+            ubuntu-makefile,
+            macos-autotools,
+            macos-makefile,
+          ]
+        include:
+
+          - name: ubuntu-autotools
+            os: ubuntu-latest
+            build-system: autotools
+
+          - name: ubuntu-makefile
+            os: ubuntu-latest
+            build-system: makefile
+
+          - name: macos-autotools
+            os: macos-latest
+            build-system: autotools
+
+          - name: macos-makefile
+            os: macos-latest
+            build-system: makefile
+
+    runs-on: ${{ matrix.os }}
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Install Linux dependencies
+        if: startsWith(matrix.os,'ubuntu')
+        run: |
+          sudo apt-get update
+          sudo apt-get install -y libopus-dev libogg-dev libssl-dev
+
+      - name: Install MacOS dependencies
+        if: startsWith(matrix.os,'macos')
+        run: |
+          brew bundle
+
+      - name: Build with Autotools
+        if: startsWith(matrix.build-system,'autotools')
+        run: |
+          ./autogen.sh
+          ./configure
+          make
+          make check
+
+      - name: distcheck with Autotools
+        if: startsWith(matrix.build-system,'autotools')
+        run: |
+          make distcheck
+
+      - name: Build with Makefile
+        if: startsWith(matrix.build-system,'makefile')
+        run: |
+          make -C unix
+          make -C unix check
+
+      - name: Build Documentation
+        run: |
+          make -C doc

From bf0d8785e9b818a83e7d4492418f758c181e8e18 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 11:42:08 -0700
Subject: [PATCH 02/16] github actions: add doxygen dependency.

Needed for the Documentation Build step to work.
---
 .github/workflows/action.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 049efaf..1aab149 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -45,6 +45,7 @@ jobs:
         run: |
           sudo apt-get update
           sudo apt-get install -y libopus-dev libogg-dev libssl-dev
+          sudo apt-get install -y doxygen
 
       - name: Install MacOS dependencies
         if: startsWith(matrix.os,'macos')

From 1e6fc903ea58cce2a899ab4e7bccd22191ec3680 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 19:00:32 -0700
Subject: [PATCH 03/16] github actions: fix macOS capitalization.

I believe this is the current spelling.
---
 .github/workflows/action.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 1aab149..447c5ef 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -47,7 +47,7 @@ jobs:
           sudo apt-get install -y libopus-dev libogg-dev libssl-dev
           sudo apt-get install -y doxygen
 
-      - name: Install MacOS dependencies
+      - name: Install macOS dependencies
         if: startsWith(matrix.os,'macos')
         run: |
           brew bundle

From 0d9e5c01db5d8ef5614832829fd96b1ee2bc3c4b Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 19:01:26 -0700
Subject: [PATCH 04/16] github actions: Add diagnostics to debug macos-makefile

pkg-config isn't finding openssl, despite it supposedly
being installed by homebrew. Add some diagnostics to
try to understand what's happening.
---
 .github/workflows/action.yml | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 447c5ef..1816bec 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -52,6 +52,19 @@ jobs:
         run: |
           brew bundle
 
+      - name: macOS diagnostics
+        if: startsWith(matrix.os,'macos')
+        run: |
+          which openssl
+          openssl version
+          echo $PKG_CONFIG_PATH
+          pkg-config --cflags --libs openssl
+          brew install openssl@1.1
+          which openssl
+          openssl version
+          echo $PKG_CONFIG_PATH
+          pkg-config --cflags --libs openssl
+
       - name: Build with Autotools
         if: startsWith(matrix.build-system,'autotools')
         run: |

From 4c2a55c077f2ad0af32622f073f977f41f48f32e Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 19:06:23 -0700
Subject: [PATCH 05/16] github actions: more macOS diagnostics

---
 .github/workflows/action.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 1816bec..3878d49 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -58,11 +58,11 @@ jobs:
           which openssl
           openssl version
           echo $PKG_CONFIG_PATH
-          pkg-config --cflags --libs openssl
+          find /usr/local -name openssl.pc
+          find /usr -name openssl.pc
           brew install openssl@1.1
           which openssl
           openssl version
-          echo $PKG_CONFIG_PATH
           pkg-config --cflags --libs openssl
 
       - name: Build with Autotools

From abde1c28ecd5e93ccf54c11357302e2e6c3a5f19 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 19:08:40 -0700
Subject: [PATCH 06/16] github actions: more macOS diagnostics

---
 .github/workflows/action.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 3878d49..5ad25c2 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -59,7 +59,9 @@ jobs:
           openssl version
           echo $PKG_CONFIG_PATH
           find /usr/local -name openssl.pc
-          find /usr -name openssl.pc
+          brew link openssl
+          openssl version
+          pkg-config --cflags --libs openssl
           brew install openssl@1.1
           which openssl
           openssl version

From 1733ae1588862a448e15a605e4981edb4aae0c83 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Thu, 29 Jul 2021 19:19:39 -0700
Subject: [PATCH 07/16] github actions: more macOS diagnostics

---
 .github/workflows/action.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.github/workflows/action.yml b/.github/workflows/action.yml
index 5ad25c2..b506868 100644
--- a/.github/workflows/action.yml
+++ b/.github/workflows/action.yml
@@ -58,6 +58,7 @@ jobs:
           which openssl
           openssl version
           echo $PKG_CONFIG_PATH
+          pkg-config --cflags --libs openssl
           find /usr/local -name openssl.pc
           brew link openssl
           openssl version
@@ -66,6 +67,8 @@ jobs:
           which openssl
           openssl version
           pkg-config --cflags --libs openssl
+        env:
+          PKG_CONFIG_PATH: /usr/local/opt/openssl@1.1/lib/pkgconfig
 
       - name: Build with Autotools
         if: startsWith(matrix.build-system,'autotools')

From 04553771ddbbf4326b68936d0448289a64416f96 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:18:49 -0800
Subject: [PATCH 08/16] github actions: Add cmake build.

Copy cmake config from the ogg project for ci coverage on github.
---
 .github/workflows/cmake.yml | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 .github/workflows/cmake.yml

diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
new file mode 100644
index 0000000..dfb78b2
--- /dev/null
+++ b/.github/workflows/cmake.yml
@@ -0,0 +1,38 @@
+name: CMake build
+
+on:
+  push:
+  pull_request:
+  schedule:
+    - cron: '0 0 1 * *'
+
+jobs:
+  build:
+    strategy:
+      matrix:
+        os:
+          [
+            ubuntu-latest,
+            macos-latest,
+            windows-latest,
+          ]
+
+    runs-on: ${{ matrix.os }}
+
+    env:
+      BUILD: _build
+
+    steps:
+      - uses: actions/checkout@v2
+
+      - name: Prepare build directory
+        run: mkdir ${{ env.BUILD }}
+
+      - name: Configure
+        run: cmake -S . -B ${{ env.BUILD }}
+
+      - name: Build
+        run: cmake --build ${{ env.BUILD }}
+
+      - name: Test
+        run: ctest --test-dir ${{ env.BUILD }} -V -C Debug

From d3b19ccade0315cfeb2d6d0968d81289f18ce7f2 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:19:36 -0800
Subject: [PATCH 09/16] github actions: rename autotools/makefile build

It makes sense to keep these two build types together since they
share dependencies, but rename them so it's clear they're a build
parallel to the cmake action.
---
 .github/workflows/{action.yml => autotools.yml} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename .github/workflows/{action.yml => autotools.yml} (100%)

diff --git a/.github/workflows/action.yml b/.github/workflows/autotools.yml
similarity index 100%
rename from .github/workflows/action.yml
rename to .github/workflows/autotools.yml

From 74d6b87f0be86b834d29edce14f39a3d20cbd95c Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:37:41 -0800
Subject: [PATCH 10/16] github-actions: Merge cmake build into the others.

Revert the `action.yml` rename and merge the cmake build steps
in with the others so it can share the dependency installs.
---
 .../workflows/{autotools.yml => actions.yml}  | 21 ++++++++++
 .github/workflows/cmake.yml                   | 38 -------------------
 2 files changed, 21 insertions(+), 38 deletions(-)
 rename .github/workflows/{autotools.yml => actions.yml} (80%)
 delete mode 100644 .github/workflows/cmake.yml

diff --git a/.github/workflows/autotools.yml b/.github/workflows/actions.yml
similarity index 80%
rename from .github/workflows/autotools.yml
rename to .github/workflows/actions.yml
index b506868..c1ad262 100644
--- a/.github/workflows/autotools.yml
+++ b/.github/workflows/actions.yml
@@ -13,8 +13,10 @@ jobs:
         name:
           [
             ubuntu-autotools,
+            ubuntu-cmake,
             ubuntu-makefile,
             macos-autotools,
+            macos-cmake,
             macos-makefile,
           ]
         include:
@@ -23,6 +25,10 @@ jobs:
             os: ubuntu-latest
             build-system: autotools
 
+          - name: ubuntu-cmake
+            os: ubuntu-latest
+            build-system: cmake
+
           - name: ubuntu-makefile
             os: ubuntu-latest
             build-system: makefile
@@ -31,12 +37,19 @@ jobs:
             os: macos-latest
             build-system: autotools
 
+          - name: macos-cmake
+            os: macos-latest
+            build-system: cmake
+
           - name: macos-makefile
             os: macos-latest
             build-system: makefile
 
     runs-on: ${{ matrix.os }}
 
+    env:
+      BUILD: _build
+
     steps:
       - uses: actions/checkout@v2
 
@@ -90,5 +103,13 @@ jobs:
           make -C unix check
 
       - name: Build Documentation
+        if: !startsWith(matrix.build-system,'cmake')
         run: |
           make -C doc
+
+      - name: Build with CMake
+        if: startsWith(matrix.build-system,'cmake')
+        run: |
+          cmake -S . -B ${{ env.BUILD }}
+          cmake --build ${{ env.BUILD }}
+          ctest --test-dir ${{ env.BUILD }} -V -C Debug
diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml
deleted file mode 100644
index dfb78b2..0000000
--- a/.github/workflows/cmake.yml
+++ /dev/null
@@ -1,38 +0,0 @@
-name: CMake build
-
-on:
-  push:
-  pull_request:
-  schedule:
-    - cron: '0 0 1 * *'
-
-jobs:
-  build:
-    strategy:
-      matrix:
-        os:
-          [
-            ubuntu-latest,
-            macos-latest,
-            windows-latest,
-          ]
-
-    runs-on: ${{ matrix.os }}
-
-    env:
-      BUILD: _build
-
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Prepare build directory
-        run: mkdir ${{ env.BUILD }}
-
-      - name: Configure
-        run: cmake -S . -B ${{ env.BUILD }}
-
-      - name: Build
-        run: cmake --build ${{ env.BUILD }}
-
-      - name: Test
-        run: ctest --test-dir ${{ env.BUILD }} -V -C Debug

From acea8feb9a3e3955ccd167179832e9467d4c786c Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:48:31 -0800
Subject: [PATCH 11/16] github-actions: install graphviz for dot

The doxygen invocation complains about this tool not being available.
---
 .github/workflows/actions.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index c1ad262..e8ca832 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -58,7 +58,7 @@ jobs:
         run: |
           sudo apt-get update
           sudo apt-get install -y libopus-dev libogg-dev libssl-dev
-          sudo apt-get install -y doxygen
+          sudo apt-get install -y doxygen graphviz
 
       - name: Install macOS dependencies
         if: startsWith(matrix.os,'macos')

From 49b40842ba7615c3a095ec0f4212afb5abe0a5c5 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:50:11 -0800
Subject: [PATCH 12/16] Brewfile: install the latest CMake

Earlier we had trouble with CMake 3.20, and reverting to 3.16
worked around the problem. However this version is no longer
available in homebrew, so the `brew bundle` step is failing
in github ci. Try installing the latest version instead.

Currently that's CMake 3.22.1.
---
 Brewfile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Brewfile b/Brewfile
index 344718b..c8a7fd9 100644
--- a/Brewfile
+++ b/Brewfile
@@ -5,5 +5,5 @@ brew 'autoconf'
 brew 'automake'
 brew 'libtool'
 brew 'pkg-config'
-brew 'cmake@3.16'
+brew 'cmake'
 brew 'doxygen'

From ddf5464ea066328b81c32278744f536f54fca897 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 11:54:21 -0800
Subject: [PATCH 13/16] github-actions: Clean up syntax.

the `if` key doesn't require expression quoting, except when it
does.
---
 .github/workflows/actions.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index e8ca832..6233c43 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -103,7 +103,7 @@ jobs:
           make -C unix check
 
       - name: Build Documentation
-        if: !startsWith(matrix.build-system,'cmake')
+        if: ${{ ! startsWith(matrix.build-system,'cmake') }}
         run: |
           make -C doc
 

From 32634a0909728864bd67552f10a7a6bc94835e66 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 12:39:11 -0800
Subject: [PATCH 14/16] github-actions: Fetch complete git history.

Make sure tags are available so OpusFilePackageVersion.cmake can
find and set a package version string. By default github actions
only fetches the target commit with --no-tags.
---
 .github/workflows/actions.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index 6233c43..d5d20fa 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -52,6 +52,8 @@ jobs:
 
     steps:
       - uses: actions/checkout@v2
+        with:
+          fetch-depth: 0
 
       - name: Install Linux dependencies
         if: startsWith(matrix.os,'ubuntu')

From e907069221a42d794e3664123a8ba6058ea62856 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 12:48:59 -0800
Subject: [PATCH 15/16] github actions: trim macos diagnostics.

Something is failing, see if things have un-bitrotted since we
last ran.
---
 .github/workflows/actions.yml | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index d5d20fa..67aa1b9 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -74,16 +74,6 @@ jobs:
           openssl version
           echo $PKG_CONFIG_PATH
           pkg-config --cflags --libs openssl
-          find /usr/local -name openssl.pc
-          brew link openssl
-          openssl version
-          pkg-config --cflags --libs openssl
-          brew install openssl@1.1
-          which openssl
-          openssl version
-          pkg-config --cflags --libs openssl
-        env:
-          PKG_CONFIG_PATH: /usr/local/opt/openssl@1.1/lib/pkgconfig
 
       - name: Build with Autotools
         if: startsWith(matrix.build-system,'autotools')

From f3a417875dd32b873155a2ea0a8553b9ea116fc1 Mon Sep 17 00:00:00 2001
From: Ralph Giles <giles@thaumas.net>
Date: Sat, 15 Jan 2022 12:55:55 -0800
Subject: [PATCH 16/16] github-actions: remove macos diagnostics entirely

`openssl version` is returning 1.1.1m so hopefully the default
will just work now.
---
 .github/workflows/actions.yml | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
index 67aa1b9..7758fae 100644
--- a/.github/workflows/actions.yml
+++ b/.github/workflows/actions.yml
@@ -67,14 +67,6 @@ jobs:
         run: |
           brew bundle
 
-      - name: macOS diagnostics
-        if: startsWith(matrix.os,'macos')
-        run: |
-          which openssl
-          openssl version
-          echo $PKG_CONFIG_PATH
-          pkg-config --cflags --libs openssl
-
       - name: Build with Autotools
         if: startsWith(matrix.build-system,'autotools')
         run: |