Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: separate build and test context #51

Merged
merged 2 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/develop.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Orb Agent - develop
on:
workflow_dispatch:
push:
branches: [ develop ]
paths:
- "agent/**"
- "cmd/**"
- "!agent/docker/**"

permissions:
contents: write

env:
GO_VERSION: '1.23'

jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0

- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set build info
run: |
echo ${GITHUB_SHA::7} > ./agent/version/BUILD_COMMIT.txt
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
echo $LATEST_RELEASE > ./agent/version/BUILD_VERSION.txt

- name: Build image and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0
with:
context: .
file: agent/docker/Dockerfile
platforms: linux/amd64, linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: netboxlabs/orb-agent:develop
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
Fixed Show fixed Hide fixed
49 changes: 2 additions & 47 deletions .github/workflows/build.yaml → .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Orb Agent - build
name: Orb Agent - tests
on:
push:
branches:
- "!release"
- "develop"
paths:
- "agent/**"
- "cmd/**"
Expand All @@ -18,9 +17,6 @@ concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

env:
GO_VERSION: '1.23'

permissions:
contents: write
pull-requests: write
Expand Down Expand Up @@ -73,45 +69,4 @@ jobs:
Go test coverage
${{ steps.go-test.outputs.coverage-report }}
Total coverage: ${{ steps.go-test.outputs.coverage-total }}%
edit-mode: replace

build-and-push:
needs: go-test
runs-on: ubuntu-latest
if: success() && github.ref == 'refs/heads/develop'
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0

- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Set build info
run: |
echo ${GITHUB_SHA::7} > ./agent/version/BUILD_COMMIT.txt
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name')
echo $LATEST_RELEASE > ./agent/version/BUILD_VERSION.txt

- name: Build image and push
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0
with:
context: .
file: agent/docker/Dockerfile
platforms: linux/amd64, linux/arm64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: netboxlabs/orb-agent:develop
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
edit-mode: replace
Loading