Skip to content

Commit

Permalink
Moves CI to GitHub Actions (#180)
Browse files Browse the repository at this point in the history
This moves from Travis to GitHub Actions based test and deploy workflow.
Notably, this uses standard script conventions used by other projects in
OpenZipkin. The main change to the actual code here is reverting
version.rb to 0.0.0 like some other Ruby projects are doing, instead of
updating it manually in git each time.

Co-authored-by: Anuraag Agrawal <[email protected]>
  • Loading branch information
adriancole and anuraaga authored Dec 4, 2020
1 parent 2faafd0 commit 78afbc0
Show file tree
Hide file tree
Showing 20 changed files with 504 additions and 43 deletions.
11 changes: 11 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Contributing to Zipkin

If you would like to contribute code, fork this GitHub repository and
send a pull request (on a branch other than `master` or `gh-pages`).

## License

By contributing your code, you agree to license your contribution under
the terms of the [APLv2](../LICENSE).

All files are copyright "The OpenZipkin Authors" and released with the Apache 2.0 license.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Bug
about: If you’ve found a bug, spend the time to write a failing test. Bugs with tests get fixed and stay fixed. If you have a solution in mind, skip raising an issue and open a pull request instead.
labels: bug
---
## Describe the Bug
A clear and concise description of what the bug is. If you have a solution in mind, skip raising an issue and open a pull request instead.

Regardless, the best is to spend some time to write a failing test. Bugs with tests get fixed and stay fixed.

## Steps to Reproduce
Steps to reproduce the behavior:

## Expected Behaviour
Suggest what you think correct behaviour should be. Note, it may be solved differently depending on the problem.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://gitter.im/openzipkin/zipkin
about: Please ask questions about how to do something or to understand why something isn't working on our Gitter chat - we'll be happy to respond there in detail. This issue tracker is not for questions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature Request
about: Please first, look at existing issues to see if the feature has been requested before.
labels: enhancement
---
Please first, look at [existing issues](https://github.com/openzipkin/zipkin-ruby/issues) to see if the feature has been requested before. If you don't find anything tell us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.

## Feature
Description of the feature

## Rationale
Why would this feature help others besides me?

## Example Scenario
What kind of use cases would benefit from this feature?

## Prior Art
* Links to prior art
* More links
34 changes: 34 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# yamllint --format github .github/workflows/deploy.yml
---
name: deploy

# We deploy on a release versions, regardless of if the commit is documentation-only or not.
#
# See https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet
on:
push:
tags: '[0-9]+.[0-9]+.[0-9]+**' # Ex. 1.2.3
branches: master

jobs:
deploy:
runs-on: ubuntu-20.04 # newest available distribution, aka focal
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 1 # full history is not needed
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
bundler-cache: true
- name: Deploy
env:
# RUBYGEMS_API_KEY=<hex token value>
# - needs to own the gem
# - generated at https://rubygems.org/settings/edit
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
run: | # GITHUB_REF will be refs/tags/MAJOR.MINOR.PATCH
build-bin/configure_deploy &&
build-bin/deploy $(echo ${GITHUB_REF} | cut -d/ -f 3)
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# yamllint --format github .github/workflows/test.yml
---
name: test

# We don't test documentation-only commits.
on:
# We run tests on non-tagged pushes to master
push:
tags: ''
branches: master
paths-ignore: '**/*.md'
# We also run tests on pull requests targeted at the master branch.
pull_request:
branches: master
paths-ignore: '**/*.md'

jobs:
test:
runs-on: ubuntu-20.04 # newest available distribution, aka focal
strategy:
fail-fast: false
matrix: # https://github.com/ruby/setup-ruby/blob/master/README.md#supported-versions
ruby: [2.3, 2.4, 2.5, 2.6, 2.7, jruby-9.1, jruby-9.2]
gemfile:
- gemfiles/faraday_0.x.gemfile
- gemfiles/faraday_1.x.gemfile
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 1 # full history is not needed
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Test
run: build-bin/configure_test && build-bin/test
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,7 @@
Gemfile.lock

.byebug_history

# IntelliJ
.idea
*.iml
36 changes: 0 additions & 36 deletions .travis.yml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.47.3
* Moved CI to [GitHub Actions](https://github.com/openzipkin/zipkin-ruby/workflows).

# 0.47.2
* Fix to not flush local component span when a server span or a consumer span is in the stack.

Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# ZipkinTracer: Zipkin client for Ruby

[![Build Status](https://api.travis-ci.org/openzipkin/zipkin-ruby.svg?branch=master)](https://travis-ci.org/openzipkin/zipkin-ruby)
[![Gitter chat](http://img.shields.io/badge/gitter-join%20chat%20%E2%86%92-brightgreen.svg)](https://gitter.im/openzipkin/zipkin)
[![Build Status](https://github.com/openzipkin/zipkin-ruby/workflows/test/badge.svg)](https://github.com/openzipkin/zipkin-ruby/actions?query=workflow%3Atest)
[![Gem Version](https://badge.fury.io/rb/zipkin-tracer.svg)](https://badge.fury.io/rb/zipkin-tracer)

Rack and Faraday integration middlewares for Zipkin tracing.

Expand Down
48 changes: 43 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,44 @@
## Release Process
# OpenZipkin Release Process

* tag the commit `git tag -v0.0.0`
* push tags to origin `git push origin --tags`
* Travis will automatically build and push to rubygems
* TODO: have travis push the tag using info from version.rb
This repo uses semantic versions. Please keep this in mind when choosing version numbers.

1. **Alert others you are releasing**

There should be no commits made to master while the release is in progress (about 10 minutes). Before you start
a release, alert others on [gitter](https://gitter.im/openzipkin/zipkin) so that they don't accidentally merge
anything. If they do, and the build fails because of that, you'll have to recreate the release tag described below.

1. **Push a git tag**

The tag should formatted `MAJOR.MINOR.PATCH`, ex `git tag 1.18.1 && git push origin 1.18.1`.

1. **Wait for CI**

The `MAJOR.MINOR.PATCH` tag triggers [`build-bin/deploy`](build-bin/deploy), which does the following:
* https://rubygems.org/gems/zipkin-tracer [`build-bin/gem/gem_push`](build-bin/gem/gem_push)

## Credentials

The release process uses various credentials. If you notice something failing due to unauthorized,
look at the notes in [.github/workflows/deploy.yml] and check the [org secrets](https://github.com/organizations/openzipkin/settings/secrets/actions).

## Manually releasing

If for some reason, you lost access to CI or otherwise cannot get automation to work, bear in mind
this is a normal ruby project, and can be released accordingly.

```bash
# First, set variable according to your personal credentials. These would normally be assigned as
# org secrets: https://github.com/organizations/openzipkin/settings/secrets/actions
export RUBYGEMS_API_KEY=your_api_key
release_version=xx-version-to-release-xx

# now from latest master, create the MAJOR.MINOR.PATCH tag
git tag ${release_version}

# Run the deploy using the version you added as a tag
./build-bin/deploy ${release_version}

# Finally, push the tag
git push origin ${release_version}
```
Loading

0 comments on commit 78afbc0

Please sign in to comment.