Skip to content

Commit

Permalink
Migrate to Github actions for CI/CD (closes #158)
Browse files Browse the repository at this point in the history
  • Loading branch information
adatzer committed Jan 25, 2021
1 parent 5dbfb71 commit 13ea8d9
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 38 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Build

on:
push:
branches:
- master
pull_request:

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'

- name: Launch the docker-compose stack
run: make setup-up

- name: Build
run: make

- name: Test and send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make
make goveralls
DISTRO=linux make integration
76 changes: 76 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Deploy

on:
push:
tags:
- '*.*.*'

jobs:
deploy:
runs-on: ubuntu-20.04

env:
BINTRAY_SNOWPLOW_GENERIC_USER: ${{ secrets.BINTRAY_SNOWPLOW_GENERIC_USER }}
BINTRAY_SNOWPLOW_GENERIC_API_KEY: ${{ secrets.BINTRAY_SNOWPLOW_GENERIC_API_KEY }}

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.15'

- name: Launch the docker-compose stack
run: make setup-up

- name: Build
run: make

- name: Test and send coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make
make goveralls
DISTRO=linux make integration
- name: Setup Python 3.8
uses: actions/setup-python@v2
with:
python-version: '3.8'

- name: Install dependencies and update PATH
run: |
python -m pip install --upgrade pip
sudo pip install pyOpenSSL==16.2.0
pip install --user release-manager==0.4.1
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Get tag and sql-runner version information
id: version
run: |
echo ::set-output name=TAG_VERSION::${GITHUB_REF#refs/*/}
echo "##[set-output name=SQL_RUNNER_VERSION;]$(cat VERSION)"
- name: Upload to bintray
env:
TAG_VERSION: ${{ steps.version.outputs.TAG_VERSION }}
SQL_RUNNER_VERSION: ${{ steps.version.outputs.SQL_RUNNER_VERSION }}
run: make release

- name: Get date for release name
id: date
run: echo "RELEASE_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV

- name: Create release
if: ${{ ! contains(steps.version.outputs.TAG_VERSION, '-rc') }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Version ${{ github.ref }} (${{ env.RELEASE_DATE }})
draft: false
prerelease: false
6 changes: 3 additions & 3 deletions .release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
local:
root_dir : <%= ENV['TRAVIS_BUILD_DIR'] %>
root_dir : <%= ENV['GITHUB_WORKSPACE'] %>

targets:
- type : "bintray"
Expand All @@ -14,8 +14,8 @@ packages:
publish : true
override : false
continue_on_conflict: false
version : <%= CMD['cat VERSION'] %>
build_version : <%= ENV['TRAVIS_TAG'] %>
version : <%= ENV['SQL_RUNNER_VERSION'] %>
build_version : <%= ENV['TAG_VERSION'] %>
artifacts:
- prefix : "sql_runner_"
suffix : "_linux_amd64"
Expand Down
31 changes: 0 additions & 31 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ test:

goveralls: test
GO111MODULE=on go get -u github.com/mattn/goveralls
goveralls -coverprofile=$(coverage_out) -service=travis-ci
goveralls -coverprofile=$(coverage_out) -service=github

integration:
ifndef DISTRO
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SQL Runner

[![Build Status][travis-image]][travis] [![Coveralls][coveralls-image]][coveralls] [![Go Report Card][goreport-image]][goreport] [![Release][release-image]][releases] [![License][license-image]][license]
[![Build Status][gh-actions-image]][gh-actions] [![Coveralls][coveralls-image]][coveralls] [![Go Report Card][goreport-image]][goreport] [![Release][release-image]][releases] [![License][license-image]][license]

## Overview

Expand Down Expand Up @@ -114,8 +114,8 @@ limitations under the License.
[docker-url]: https://docs.docker.com/get-docker/
[docker-compose-url]: https://docs.docker.com/compose/install/
[travis]: https://travis-ci.org/snowplow/sql-runner
[travis-image]: https://travis-ci.org/snowplow/sql-runner.png?branch=master
[gh-actions]: https://github.com/snowplow/sql-runner/actions
[gh-actions-image]: https://github.com/snowplow/sql-runner/workflows/Build/badge.svg?branch=master
[release-image]: http://img.shields.io/badge/release-0.9.2-6ad7e5.svg?style=flat
[releases]: https://github.com/snowplow/sql-runner/releases
Expand Down

0 comments on commit 13ea8d9

Please sign in to comment.