Skip to content

Commit

Permalink
chore: migrate to github actions (#555)
Browse files Browse the repository at this point in the history
* chore: migrate to github actions

* add comment

* delete circle CI jobs

* noop

* update readme badge

* fix goreleaser config
  • Loading branch information
npazosmendez authored Sep 30, 2024
1 parent b30db90 commit 43012fc
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 176 deletions.
174 changes: 0 additions & 174 deletions .circleci/config.yml

This file was deleted.

120 changes: 120 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
name: CI

on:
push:
tags:
- 'v[0-9]+(\.[0-9]+)*(-.*)*'
pull_request:

permissions:
contents: read
id-token: write

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.21.8
- run: make test

build:
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.21.8
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Install FPM and dependencies
run: |
sudo apt-get update
sudo apt-get install rpm
gem install fpm
- name: Install go-bindata
run: go install github.com/go-bindata/go-bindata/...@latest
- run: make LINUX_PACKAGE_GOARCH=amd64 build-linux
- run: make LINUX_PACKAGE_GOARCH=arm64 build-linux
- run: make build-win
- run: make build-darwin
- run: make build-bsd
- name: Make packages
run: make packages
- name: Build Docker image
run: |
make docker
docker save -o build/carbon-relay-ng.tar grafana/carbon-relay-ng
- name: Store version
run: git describe --tags --always | sed 's/^v//' > build/version.txt
- name: Upload package artifacts
if: github.ref_type == 'tag'
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: package-artifacts
path: build

# Release, runs on tags only
deploy:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
steps:
- uses: actions/checkout@v3
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: package-artifacts
path: build
- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
- name: Install package_cloud
run: gem install package_cloud
- name: Set PACKAGECLOUD_TOKEN
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
repo_secrets: |
PACKAGECLOUD_TOKEN=packagecloud:token
- name: Push packages
run: |
version=$(cat build/version.txt)
repo=raintank/raintank
[[ "$version" == *-* ]] && repo=raintank/testing
package_cloud push $repo/ubuntu/trusty build/deb-upstart/carbon-relay-ng-*.deb
package_cloud push $repo/ubuntu/xenial build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/jessie build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/stretch build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/debian/buster build/deb-systemd/carbon-relay-ng-*.deb
package_cloud push $repo/el/6 build/centos-6/carbon-relay-ng-*.el6.*.rpm
package_cloud push $repo/el/7 build/centos-7/carbon-relay-ng-*.el7.*.rpm
- name: Load Docker image
run: docker load -i build/carbon-relay-ng.tar
- name: Login to DockerHub
uses: grafana/shared-workflows/actions/dockerhub-login@main
- name: Push Docker image
run: |
version=$(cat build/version.txt)
docker push grafana/carbon-relay-ng:$version
# only versions without a hyphen - e.g. actual releases - are tagged as latest.
# in-between-release versions are tagged as master.
tag=latest
[[ "$version" == *-* ]] && tag=master
docker push grafana/carbon-relay-ng:$tag
github_binaries:
if: github.ref_type == 'tag'
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 1.21.8
- name: Run goreleaser
run: curl -sfL https://goreleaser.com/static/run | bash
3 changes: 2 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
version: 2
builds:
- id: "carbon-relay-ng"
main: ./cmd/carbon-relay-ng
Expand Down Expand Up @@ -25,4 +26,4 @@ checksum:
snapshot:
name_template: "{{ .Tag }}-next"
changelog:
skip: true
disable: true
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
[![Circle CI](https://circleci.com/gh/grafana/carbon-relay-ng.svg?style=shield)](https://circleci.com/gh/grafana/carbon-relay-ng)
[![Go Report Card](https://goreportcard.com/badge/github.com/grafana/carbon-relay-ng)](https://goreportcard.com/report/github.com/grafana/carbon-relay-ng)
[![GoDoc](https://godoc.org/github.com/grafana/carbon-relay-ng?status.svg)](https://godoc.org/github.com/grafana/carbon-relay-ng)

<a href="https://github.com/grafana/carbon-relay-ng/actions/workflows/ci.yaml?query=branch%3Amaster"><img src="https://github.com/grafana/carbon-relay-ng/actions/workflows/ci.yaml/badge.svg?query=branch%3Amaster" alt="Build" /></a>


carbon-relay-ng
===============

Expand Down

0 comments on commit 43012fc

Please sign in to comment.