Skip to content

Commit

Permalink
Adding github actions workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
bl4ko committed Feb 7, 2024
1 parent ff49a14 commit ca02aec
Show file tree
Hide file tree
Showing 4 changed files with 102 additions and 1 deletion.
40 changes: 40 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy image to ghcr.io

on:
push:
branches:
- main
paths:
- cmd/**
- internal/**
- pkg/**
- Dockerfile
- .dockerignore
- .golangci.yml
- go.mod
- go.sum

jobs:
build_and_push:
runs-on: ubuntu-latest
steps:

- name: Login to dockerhub
uses: docker/login-action@v3
with:
username: bl4ko
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: bl4ko
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push final image
uses: docker/build-push-action@v5.1.0
with:
platforms: linux/amd64,linux/386,linux/arm64,linux/arm/v6,linux/arm/v7,linux/ppc64le
tags: bl4ko/netbox-ssot:latest
push: true
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Run tests and upload results

on:
push:
branches:
- main
- develop
paths:
- cmd/**
- internal/**
- .dockerignore
- .golangci.yml
- go.mod
- go.sum
pull_request:
branches:
- main
- develop
paths:
- cmd/**
- internal/**
- .dockerignore
- .golangci.yml
- go.mod
- go.sum
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
go-version: ["1.19", "1.20", "1.21.x"]

steps:
- uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54

- name: Install dependencies
run: go get .

- name: Test with Go
run: go test ./... -json > TestResults-${{ matrix.go-version }}.json

- name: Upload Go test results
uses: actions/upload-artifact@v4
with:
name: Go-results-${{ matrix.go-version }}
path: TestResults-${{ matrix.go-version }}.json

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/bl4ko/netbox-ssot

go 1.21.4
go 1.21

require (
github.com/ovirt/go-ovirt v4.3.4+incompatible // indirect
Expand Down
File renamed without changes.

0 comments on commit ca02aec

Please sign in to comment.