Skip to content

Commit

Permalink
Workflow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andreev-io committed Jan 23, 2025
1 parent 5043156 commit 3daa75b
Showing 1 changed file with 48 additions and 18 deletions.
66 changes: 48 additions & 18 deletions .github/workflows/kubenetmon.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,23 @@ jobs:
with:
version: v1.60

# test:
# name: Test code
# needs: golangci
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.23'
# cache: true
# cache-dependency-path: go.sum
# - name: Run tests
# run: |
# make test
# make integration-test
test:
name: Test code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: true
cache-dependency-path: go.sum
- name: Run tests
run: |
make test
make integration-test
build-docker-image:
name: Build Docker image
# needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
Expand Down Expand Up @@ -121,7 +119,7 @@ jobs:
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' }}
uses: helm/[email protected]
with:
config: ${{ github.workspace }}/src/test/kind-config.yaml
config: ${{ github.workspace }}/test/kind-config.yaml

- name: Set up kubectl
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' }}
Expand All @@ -137,7 +135,7 @@ jobs:
- name: Run chart-testing (install)
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/main' || github.event.inputs.deploy_to_dev == 'true' || github.event.inputs.build_and_push == 'true' }}
run: |
cd src/kubenetmon/deploy/helm
cd kubenetmon/deploy/helm
ct install \
--config ../../../.github/workflows/configs/ct.yaml \
--target-branch ${{ github.event.repository.default_branch }} \
Expand Down Expand Up @@ -165,3 +163,35 @@ jobs:
--set=region=europe-north1 \
--set=environment=development \
--set=cloud=gcp"
docker-publish:
name: Publish Docker image
needs: [golangci, test, build-docker-image, helm-test]
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
steps:
- name: Download Docker image
uses: actions/download-artifact@v4
with:
name: docker-image

- name: Load Docker image
run: docker load -i image.tar

- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Push to GitHub Container Registry
run: |
IMAGE_TAG=$(echo ${{ needs.build-and-push-image.outputs.image-tags }} | cut -d':' -f2)
docker tag ${{ needs.build-and-push-image.outputs.image-tags }} ghcr.io/${{ github.repository }}:$IMAGE_TAG
docker tag ${{ needs.build-and-push-image.outputs.image-tags }} ghcr.io/${{ github.repository }}:latest
docker push ghcr.io/${{ github.repository }}:$IMAGE_TAG
docker push ghcr.io/${{ github.repository }}:latest

0 comments on commit 3daa75b

Please sign in to comment.