Ver código fonte

setup github action for building

Grant Limberg 1 semana atrás
pai
commit
7c1bfc97c4

+ 41 - 0
.github/workflows/central-controller.yaml

@@ -0,0 +1,41 @@
+# on:
+#     workflow_dispatch:
+on:
+  push:
+  workflow_dispatch:
+
+jobs:
+  central_controller:
+    name: Central Controller Build
+    runs-on: [gha-runner-x64, gha-runner-arm64]
+    steps:
+    - name: checkout
+      uses: actions/checkout@v4
+    - name: Get Date
+      id: get-date
+      run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
+      shell: bash
+    - name: Cache Conda
+      uses: actions/cache@v4
+      with:
+        path: ~/miniconda3
+        key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.get-date.outputs.today }}-conda-${{ hashFiles('**/environment.yml') }}
+    - name: Setup Miniconda
+      uses: conda-incubator/setup-miniconda@v3
+      with:
+        auto-update-conda: false
+        channel-priority: strict
+        activate-environment: central_controller
+        environment-file: environment.yml
+        use-only-tar-bz2: true
+    - name: Setup CMake
+      uses: threeal/[email protected]
+      with:
+        options: |
+         -DCMAKE_BUILD_TYPE=Release
+         -DZT1_CENTRAL_CONTROLLER=1
+    - name: Build
+      run: cmake --build . --config Release -- -j 4
+    - name: SelfTest
+      run: |
+        ./build/zerotier-selftest

+ 19 - 0
environment.yml

@@ -0,0 +1,19 @@
+name: central_controller
+channels:
+  - conda-forge
+dependencies:
+  - conda-forge::cmake=3.27.4
+  - conda-forge::git
+  - conda-forge::cxx-compiler
+  - conda-forge::c-compiler
+  - conda-forge::make
+  - conda-forge::pkg-config
+  - conda-forge::libpqxx=7.7.3
+  - conda-forge::libopentelemetry-cpp=1.21.0
+  - conda-forge::libopentelemetry-cpp-headers=1.21.0
+  - conda-forge::google-cloud-cpp=2.39.0
+  - conda-forge::libgoogle-cloud=2.39.0
+  - conda-forge::rust=1.89.0
+  - conda-forge::inja=3.3.0
+  - conda-forge::libhiredis=1.3.0
+  - conda-forge::nlohmann_json=3.12.0

+ 2 - 16
nonfree/controller/README_CENTRAL_CONTROLLER.md

@@ -25,22 +25,8 @@ conda config --set channel_priority strict
 Install external dependencies:
 
 ```bash
-conda install -y -c conda-forge \
-    conda-forge::cmake \
-    conda-forge::git \
-    conda-forge::cxx-compiler \
-    conda-forge::c-compiler \
-    conda-forge::make \
-    conda-forge::pkg-config \
-    conda-forge::libpqxx=7.7.3 \
-    conda-forge::libopentelemetry-cpp=1.21.0 \
-    conda-forge::libopentelemetry-cpp-headers=1.21.0 \
-    conda-forge::google-cloud-cpp=2.39.0 \
-    conda-forge::libgoogle-cloud=2.39.0 \
-    conda-forge::rust=1.89.0 \
-    conda-forge::inja=3.3.0 \
-    conda-forge::libhiredis=1.3.0 \
-    conda-forge::nlohmann_json=3.12.0
+conda env create -f environment.yaml
+conda env activate central_controller
 ```
 
 ## Build the Central Controller Binary