Repository: cosinekitty/astronomy (language: python)

Issue:
Support building Astronomy Engine on Mac
This code base already supports using Linux or Windows as development platforms for maintaining and improving Astronomy Engine. (Note that the pre-generated code should work on any platform; I am talking about making changes to Astronomy Engine, not using it as-is.) Currently I do not own a Mac, so I have no way of testing there. It would be great if a developer with a Mac wanted to volunteer to get the build process working on that platform too.


Discussion / hints:
Apparently this issue is filed for me :)

The first thing I needed was doxygen which just installed it from brew with `brew install doxygen`
 
The first issue is the `./run` script relies on sha256sum which isn't available which can be resolved with `brew install coreutils`.

For the python part I installed pylint using `pip3 install pylint`.

But now got this issue,

```
Testing example programs.
Compiling gravity.c
Compiling galactic.c
Compiling camera.c
Compiling moonphase.c
Compiling positions.c
Compiling linux_riseset.c
Compiling riseset.c
Compiling seasons.c
Compiling culminate.c
Compiling horizon.c
Compiling lunar_eclipse.c
Compiling triangulate.c
Testing example: camera.c
2c2
< Moon check: x = 1.0000e+00, y = -2.0726e-16, z = -8.2904e-17
---
> Moon check: x = 1.0000e+00, y = -2.0726e-16, z = -1.0363e-16
FATAL(~/astronomy/demo/c/test/test): Error comparing camera.c output.
ERROR(./run): Error testing C examples
```

Maybe is because of my timezone or something? Most of the tests just work without any issue so guess this should be trivial issue, at least hopefully.
Guess the best way to ensure it is working as expected is to put it on CI, https://github.com/ebraminio/astronomy/commit/dd2d54655d3e1b4ffac4785f7c497224710748db 

https://github.com/ebraminio/astronomy/runs/4733627170
Hi @ebraminio. I didn't know we could set up GitHub Actions to run on MacOS. That is really cool! I will take a look at the issue you mentioned in a couple of hours. The failure you encountered is a minor thing where the test is just too picky. There are likely to be other slight floating point roundoff errors that trigger needless failures that I will also need to fix. Thank you so much for taking an interest in this! It is a huge help.

Fix patch:
diff --git a/generate/README.md b/generate/README.md
index f72e71f1..1078a1af 100644
--- a/generate/README.md
+++ b/generate/README.md
@@ -10,7 +10,7 @@ and use the [source code that has already been generated for that language](../s
 
 ---
 
-# Linux
+# Linux and macOS
 
 ## Tool setup
 
@@ -24,6 +24,7 @@ The following tools are required for developers:
 - doxygen
 - xsltproc
 - graphviz
+- coreutils
 
 Change into the directory `hydrogen` and execute:  `npm init`.
 
@@ -59,13 +60,3 @@ Once you have all the tools installed and configured, you are ready to proceed.
 Change into the `generate` directory (this directory) and run the
 batch file `run.bat` to rebuild all code, generate all documentation,
 and run all the unit tests.
-
----
-
-# Mac
-
-I could use some help getting this to work on the Mac. If you are looking
-for an open source project to help with, and you have a Mac, here is your chance!
-This should be similar to the Linux steps, but may require some tweaks.
-See issue #142 for more information.
-


Test patch:
diff --git a/.github/workflows/astronomy-engine-tests.yml b/.github/workflows/astronomy-engine-tests.yml
index af08f72b..34064422 100644
--- a/.github/workflows/astronomy-engine-tests.yml
+++ b/.github/workflows/astronomy-engine-tests.yml
@@ -23,3 +23,26 @@ jobs:
         node-version: 14.x
     - name: Test Astronomy Engine
       run: cd generate && rm -f output/vsop*.txt output/*.eph output/jupiter_moons.txt && ./run && ./verify_clean
+
+  Astronomy-Engine-Macos:
+    runs-on: macos-11
+    steps:
+    - uses: actions/checkout@v2
+    - name: Init dotnet core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 6.0.x
+    - name: Init Python 3.7
+      uses: actions/setup-python@v2
+      with:
+        python-version: 3.7
+    - name: Install Python linter
+      run: python -m pip install --upgrade pip && pip install pylint
+    - name: Install documentation tools
+      run: HOMEBREW_NO_AUTO_UPDATE=1 brew install doxygen
+    - name: Init Node.js 14.x
+      uses: actions/setup-node@v2
+      with:
+        node-version: 14.x
+    - name: Test Astronomy Engine
+      run: cd generate && rm -f output/vsop*.txt output/*.eph output/jupiter_moons.txt && ./run && ./verify_clean