Skip to content

Commit ad557d5

Browse files
authored
Merge pull request #303 from StackStorm/travis_to_gha
Move tests from Travis to GitHub Actions
2 parents 20630ee + 3d40d21 commit ad557d5

File tree

4 files changed

+131
-40
lines changed

4 files changed

+131
-40
lines changed

.github/workflows/build.yaml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: build
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
# only on merges to master branch
8+
- master
9+
# and version branches, which only include minor versions (eg: v3.4)
10+
- v[0-9]+.[0-9]+
11+
tags:
12+
- v*
13+
pull_request:
14+
type: [opened, reopened, edited]
15+
schedule:
16+
# run every night at midnight
17+
- cron: '0 0 * * *'
18+
19+
jobs:
20+
integration:
21+
name: 'integration - ${{matrix.name}}'
22+
runs-on: ubuntu-latest
23+
strategy:
24+
fail-fast: false
25+
matrix:
26+
include:
27+
# note: actions/setup-ruby only allows using a major.minor release of ruby
28+
- ruby: '2.7'
29+
name: 'centos7-stable'
30+
distro: 'centos-7'
31+
repo: 'stable'
32+
- ruby: '2.7'
33+
name: 'centos7-unstable'
34+
distro: 'centos-7'
35+
repo: 'unstable'
36+
- ruby: '2.7'
37+
name: 'centos8-stable'
38+
distro: 'centos-8'
39+
repo: 'stable'
40+
- ruby: '2.7'
41+
name: 'centos8-unstable'
42+
distro: 'centos-8'
43+
repo: 'unstable'
44+
- ruby: '2.7'
45+
name: 'ubuntu18-stable'
46+
distro: 'ubuntu-18'
47+
repo: 'stable'
48+
- ruby: '2.7'
49+
name: 'ubuntu18-unstable'
50+
distro: 'ubuntu-18'
51+
repo: 'unstable'
52+
- ruby: '2.7'
53+
name: 'ubuntu20-stable'
54+
distro: 'ubuntu-20'
55+
repo: 'stable'
56+
- ruby: '2.7'
57+
name: 'ubuntu20-unstable'
58+
distro: 'ubuntu-20'
59+
repo: 'unstable'
60+
env:
61+
DISTRO: '${{ matrix.distro }}'
62+
ST2_REPO: '${{ matrix.repo }}'
63+
steps:
64+
- name: Checkout repository
65+
uses: actions/checkout@v2
66+
- name: Setup Ruby
67+
uses: actions/setup-ruby@v1
68+
with:
69+
ruby-version: '${{ matrix.ruby }}'
70+
- name: Bundle prep
71+
run: |
72+
gem install bundler
73+
bundle -v
74+
rm -f Gemfile.lock
75+
# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner"
76+
# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used"
77+
# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set"
78+
[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION
79+
gem --version
80+
bundle -v
81+
# note: this path is relative to the Gemfile path below
82+
bundle config path vendor/bundle
83+
bundle config without 'system_tests'
84+
# note: using custom gemfile for kitchen tests
85+
bundle config gemfile build/kitchen/Gemfile
86+
bundle lock
87+
# restore cache AFTER doing 'bundle lock' so that Gemfile.lock exists
88+
- uses: actions/cache@v2
89+
with:
90+
# note: this path is the Gemfile + path from above, so it's different than the base level Gemfile cache
91+
path: build/kitchen/vendor/bundle
92+
key: ${{ runner.os }}-${{ matrix.name }}-${{ matrix.ruby }}-gems-integration-v3-${{ hashFiles('**/Gemfile.lock') }}
93+
restore-keys: |
94+
${{ runner.os }}-${{ matrix.name }}-${{ matrix.ruby }}-gems-integration-v3-
95+
- name: Bundle install
96+
run: |
97+
bundle install --jobs $(nproc) --retry 3
98+
- name: Test
99+
run: |
100+
bundle exec kitchen test ${{matrix.distro}} --debug ${{ matrix.name }}
101+
env:
102+
HUBOT_SLACK_TOKEN: ${{ secrets.HUBOT_SLACK_TOKEN }}
103+
104+
slack-notification:
105+
name: Slack notification for failed master builds
106+
if: always()
107+
needs:
108+
- integration
109+
runs-on: ubuntu-latest
110+
steps:
111+
- name: Workflow conclusion
112+
# this step creates an environment variable WORKFLOW_CONCLUSION and is the most reliable way to check the status of previous jobs
113+
uses: technote-space/workflow-conclusion-action@v2
114+
- name: CI Run Failure Slack Notification
115+
if: ${{ env.WORKFLOW_CONCLUSION == 'failure' && github.ref == 'refs/heads/master' }}
116+
env:
117+
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
118+
uses: voxmedia/github-action-slack-notify-build@v1
119+
with:
120+
channel: ansible
121+
status: FAILED
122+
color: danger

.travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ Ansible playbooks to deploy [StackStorm](https://github.com/stackstorm/st2).
44
With over [50+ integrations](https://github.com/StackStorm/st2contrib/tree/master/packs) like GitHub, Docker, Nagios, NewRelic, AWS, Ansible it allows you to wire together your existing infrastructure into complex Workflows with auto-remediation and many more.
55
Aka IFTTT orchestration for Ops.
66

7-
[![Build Status](https://travis-ci.org/StackStorm/ansible-st2.svg?branch=master)](https://travis-ci.org/StackStorm/ansible-st2)
7+
8+
[![Build Status](https://github.com/StackStorm/ansible-st2/actions/workflows/build.yaml/badge.svg)](https://github.com/StackStorm/ansible-st2/actions/workflows/build.yaml)
89
[![Repository deb/rpm](https://img.shields.io/badge/Repository-deb/rpm-blue.svg)](https://packagecloud.io/StackStorm/stable/)
910
[![Join our community Slack](https://stackstorm-community.herokuapp.com/badge.svg)](https://stackstorm.com/community-signup)
1011

build/kitchen/Gemfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source 'https://rubygems.org'
2+
3+
# Gems for kitchen ci
4+
gem 'kitchen-docker'
5+
gem 'kitchen-ansible'
6+
gem 'kitchen-sync'
7+
gem 'test-kitchen'

0 commit comments

Comments
 (0)