build in containers

This commit is contained in:
Grant Limberg 2025-09-04 14:14:59 -07:00
parent 70d24fc7eb
commit 8bd96d360f

View file

@ -14,43 +14,31 @@ jobs:
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Setup Miniconda # - name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3 # uses: conda-incubator/setup-miniconda@v3
with: # with:
miniconda-version: latest # miniconda-version: latest
activate-environment: central_controller # activate-environment: central_controller
- name: Conda Environment Cache # - name: Conda Environment Cache
id: cache # id: cache
uses: actions/cache@v4 # uses: actions/cache@v4
with: # with:
path: ${{ env.CONDA }}/envs # path: ${{ env.CONDA }}/envs
key: ${{ runner.os }}-${{ runner.arch }}-${{ github.ref_name }}-conda-${{ hashFiles('environment.yml') }} # key: ${{ runner.os }}-${{ runner.arch }}-${{ github.ref_name }}-conda-${{ hashFiles('environment.yml') }}
- name: Update Conda Environment # - name: Update Conda Environment
if: steps.cache.outputs.cache-hit != 'true' # if: steps.cache.outputs.cache-hit != 'true'
run: | # run: |
source ~/miniconda3/etc/profile.d/conda.sh # source ~/miniconda3/etc/profile.d/conda.sh
conda env update --file environment.yml # conda env update --file environment.yml
- name: Build # - name: Build
run: | # run: |
source ~/miniconda3/etc/profile.d/conda.sh # source ~/miniconda3/etc/profile.d/conda.sh
conda activate central_controller # conda activate central_controller
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DZT1_CENTRAL_CONTROLLER=1 # cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DZT1_CENTRAL_CONTROLLER=1
cmake --build build/ --target all -j4 --verbose # cmake --build build/ --target all -j4 --verbose
- name: SelfTest # - name: SelfTest
run: | # run: |
./build/zerotier-selftest # ./build/zerotier-selftest
- name: GCP Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
- name: Set up GCloud CLI
uses: google-github-actions/setup-gcloud@v2
- name: Docker Auth
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Get branch name and sanitize - name: Get branch name and sanitize
id: branch id: branch
run: | run: |
@ -64,9 +52,22 @@ jobs:
calculatedSha=$(git rev-parse --short ${{ github.sha }}) calculatedSha=$(git rev-parse --short ${{ github.sha }})
echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV echo "COMMIT_SHORT_SHA=$calculatedSha" >> $GITHUB_ENV
- name: Build
run: |
docker build -t us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }} -f ext/central-controller-docker/Dockerfile.new .
- name: GCP Auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.DOCKER_REGISTRY_WRITER}}
- name: Set up GCloud CLI
uses: google-github-actions/setup-gcloud@v2
- name: Docker Auth
run: gcloud auth configure-docker us-central1-docker.pkg.dev --quiet
- name: Build and push Docker Image - name: Build and push Docker Image
run: | run: |
docker build -t us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }} -f ext/central-controller-docker/Dockerfile.conda .
docker push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }} docker push us-central1-docker.pkg.dev/zerotier-421eb9/docker-images/ztcentral-controller:${{ env.COMMIT_SHORT_SHA }}-${{ steps.branch.outputs.branch_name }}-${{ runner.arch }}
multi-arch-docker: multi-arch-docker: