2022-11-02 20:08:50 +01:00
|
|
|
name: CI Build
|
2022-11-02 19:14:30 +01:00
|
|
|
|
2023-02-08 17:40:27 +01:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- '**'
|
|
|
|
tags-ignore:
|
|
|
|
- '**'
|
2023-02-11 03:27:32 +01:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
|
|
|
- 'website/**'
|
2022-11-02 19:14:30 +01:00
|
|
|
|
2023-10-31 21:42:00 +01:00
|
|
|
# cancel older, redundant builds that haven't started yet
|
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
|
|
|
2022-11-02 19:14:30 +01:00
|
|
|
jobs:
|
2022-11-02 20:07:43 +01:00
|
|
|
ubuntu-build:
|
2023-04-04 20:05:08 +02:00
|
|
|
name: Build Linux AMD64 CLI
|
2023-01-24 17:38:58 +01:00
|
|
|
runs-on: ubuntu-20.04
|
2022-11-02 19:14:30 +01:00
|
|
|
steps:
|
2024-06-26 21:32:58 +02:00
|
|
|
- uses: actions/checkout@v4
|
2022-11-02 19:14:30 +01:00
|
|
|
|
|
|
|
- name: setup-go
|
2024-06-26 21:32:58 +02:00
|
|
|
uses: actions/setup-go@v5
|
2022-11-02 19:14:30 +01:00
|
|
|
with:
|
2024-06-26 21:32:58 +02:00
|
|
|
go-version-file: ./go.mod
|
2022-11-02 19:14:30 +01:00
|
|
|
|
2022-11-02 19:24:11 +01:00
|
|
|
- name: setup-node
|
2024-06-26 21:32:58 +02:00
|
|
|
uses: actions/setup-node@v4
|
2022-11-02 19:24:11 +01:00
|
|
|
with:
|
2024-10-04 18:07:00 +02:00
|
|
|
node-version: 20.x
|
2022-11-02 19:24:11 +01:00
|
|
|
|
2023-10-25 20:37:10 +02:00
|
|
|
- name: install ui node modules
|
|
|
|
shell: bash
|
|
|
|
run: npm install
|
2022-11-02 19:24:11 +01:00
|
|
|
working-directory: ui
|
|
|
|
|
2024-10-04 18:07:00 +02:00
|
|
|
- name: build ui
|
2023-10-25 20:37:10 +02:00
|
|
|
shell: bash
|
|
|
|
run: npm run build
|
2022-11-02 19:24:11 +01:00
|
|
|
working-directory: ui
|
2022-11-02 19:34:55 +01:00
|
|
|
env:
|
2023-06-28 19:38:28 +02:00
|
|
|
CI: "true"
|
2024-10-04 18:07:00 +02:00
|
|
|
|
2024-10-04 18:10:53 +02:00
|
|
|
- name: install agent ui node modules
|
2024-10-04 18:07:00 +02:00
|
|
|
shell: bash
|
2024-10-04 18:10:53 +02:00
|
|
|
run: npm install
|
2024-10-04 18:07:00 +02:00
|
|
|
working-directory: agent/agentUi
|
|
|
|
|
|
|
|
- name: build agent ui
|
|
|
|
shell: bash
|
2024-10-04 18:10:53 +02:00
|
|
|
run: npm run build
|
2024-10-04 18:07:00 +02:00
|
|
|
working-directory: agent/agentUi
|
2023-06-28 19:39:52 +02:00
|
|
|
|
2022-11-02 20:43:17 +01:00
|
|
|
- name: go install
|
2023-10-25 20:37:10 +02:00
|
|
|
shell: bash
|
2023-01-13 21:01:34 +01:00
|
|
|
run: go install -ldflags "-X github.com/openziti/zrok/build.Version=${{ github.ref }} -X github.com/openziti/zrok/build.Hash=${{ github.sha }}" ./...
|
2022-11-02 19:14:30 +01:00
|
|
|
|
2023-10-25 20:37:10 +02:00
|
|
|
- name: go test
|
|
|
|
shell: bash
|
2023-02-15 23:55:56 +01:00
|
|
|
run: go test -v ./...
|
|
|
|
|
2024-01-17 17:46:19 +01:00
|
|
|
- name: setup python
|
|
|
|
uses: actions/setup-python@v3
|
|
|
|
with:
|
|
|
|
python-version: '3.10'
|
|
|
|
|
|
|
|
- name: python deps
|
|
|
|
shell: bash
|
|
|
|
run: python -m pip install -U pip flake8
|
|
|
|
|
|
|
|
- name: python lint
|
|
|
|
shell: bash
|
|
|
|
run: flake8 sdk/python/sdk/zrok
|
|
|
|
|
2023-02-15 23:55:56 +01:00
|
|
|
- name: solve GOBIN
|
|
|
|
id: solve_go_bin
|
2023-10-25 20:37:10 +02:00
|
|
|
shell: bash
|
2023-02-15 23:55:56 +01:00
|
|
|
run: |
|
|
|
|
echo DEBUG: go_path="$(go env GOPATH)"
|
|
|
|
echo go_bin="$(go env GOPATH)/bin" >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: upload build artifact
|
2024-06-26 21:32:58 +02:00
|
|
|
uses: actions/upload-artifact@v4
|
2023-02-15 23:55:56 +01:00
|
|
|
with:
|
|
|
|
name: linux-amd64
|
|
|
|
path: ${{ steps.solve_go_bin.outputs.go_bin }}/zrok
|
2023-04-04 20:05:08 +02:00
|
|
|
if-no-files-found: error
|
2023-10-25 20:37:10 +02:00
|
|
|
|
2023-04-04 20:05:08 +02:00
|
|
|
# build a release candidate container image for branches named "main" or like "v*"
|
|
|
|
rc-container-build:
|
|
|
|
needs: ubuntu-build
|
|
|
|
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v')
|
|
|
|
name: Build Release Candidate Container Image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Set a container image tag from the branch name
|
|
|
|
id: slug
|
2023-10-25 20:37:10 +02:00
|
|
|
shell: bash
|
2023-04-04 20:05:08 +02:00
|
|
|
run: |
|
|
|
|
echo branch_tag=$(sed 's/[^a-z0-9_-]/__/gi' <<< "${GITHUB_REF#refs/heads/}") >> $GITHUB_OUTPUT
|
|
|
|
|
|
|
|
- name: Checkout Workspace
|
2024-06-26 21:32:58 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-04-04 20:05:08 +02:00
|
|
|
|
|
|
|
- name: Download Branch Build Artifact
|
2024-06-26 23:27:42 +02:00
|
|
|
uses: actions/download-artifact@v4
|
2023-04-04 20:05:08 +02:00
|
|
|
with:
|
|
|
|
name: linux-amd64
|
|
|
|
path: ./dist/amd64/linux/
|
|
|
|
|
|
|
|
- name: Set Up QEMU
|
2024-06-26 23:27:42 +02:00
|
|
|
uses: docker/setup-qemu-action@v3
|
2023-04-04 20:05:08 +02:00
|
|
|
with:
|
|
|
|
platforms: amd64,arm64
|
|
|
|
|
|
|
|
- name: Set Up Docker BuildKit
|
|
|
|
id: buildx
|
2024-06-26 23:27:42 +02:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-04-04 20:05:08 +02:00
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
2024-06-26 23:27:42 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-04-04 20:05:08 +02:00
|
|
|
with:
|
2023-10-31 21:42:00 +01:00
|
|
|
username: ${{ vars.DOCKER_HUB_API_USER || secrets.DOCKER_HUB_API_USER }}
|
2023-04-04 20:05:08 +02:00
|
|
|
password: ${{ secrets.DOCKER_HUB_API_TOKEN }}
|
|
|
|
|
|
|
|
- name: Set Up Container Image Tags for zrok CLI Container
|
|
|
|
env:
|
2023-04-13 06:02:15 +02:00
|
|
|
ZROK_CONTAINER_IMAGE_REPO: ${{ vars.ZROK_CONTAINER_IMAGE_REPO || 'openziti/zrok' }}
|
|
|
|
ZROK_CONTAINER_IMAGE_TAG: ${{ steps.slug.outputs.branch_tag }}
|
2023-04-04 20:05:08 +02:00
|
|
|
id: tagprep_cli
|
2023-10-25 20:37:10 +02:00
|
|
|
shell: bash
|
2023-04-04 20:05:08 +02:00
|
|
|
run: |
|
2023-10-25 20:37:10 +02:00
|
|
|
echo DOCKER_TAGS="${ZROK_CONTAINER_IMAGE_REPO}:${ZROK_CONTAINER_IMAGE_TAG}" \
|
|
|
|
| tee -a $GITHUB_OUTPUT
|
2023-04-04 20:05:08 +02:00
|
|
|
|
|
|
|
- name: Build & Push Linux AMD64 CLI Container Image to Hub
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
builder: ${{ steps.buildx.outputs.name }}
|
|
|
|
context: ${{ github.workspace }}/
|
|
|
|
file: ${{ github.workspace }}/docker/images/zrok/Dockerfile
|
|
|
|
platforms: linux/amd64
|
|
|
|
tags: ${{ steps.tagprep_cli.outputs.DOCKER_TAGS }}
|
|
|
|
build-args: |
|
|
|
|
DOCKER_BUILD_DIR=./docker/images/zrok
|
|
|
|
ARTIFACTS_DIR=./dist
|
|
|
|
push: true
|