Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce github action #1

Merged
merged 6 commits into from
Oct 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: test
on: [push]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
- windows-latest
go-version: [1.12.x, 1.13.x]
steps:
- name: setup go
uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go-version }}
- name: checkout
uses: actions/checkout@v1
with:
fetch-depth: 1
- name: lint
run: |
GO111MODULE=off GOBIN=$(pwd)/bin go get golang.org/x/lint/golint
bin/golint -set_exit_status ./...
if: "matrix.os == 'ubuntu-latest'"
- name: test
run: |
go test -coverprofile coverage.out ./...
- name: prepare-coverage
run: |
GO111MODULE=off GOBIN=$(pwd)/bin go get github.com/ricallinson/covfmt
mkdir coverage
cat coverage.out | bin/covfmt > ./coverage/lcov.info
if: "github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.go-version == '1.13.x'"
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.github_token }}
if: "github.event_name == 'push' && matrix.os == 'ubuntu-latest' && matrix.go-version == '1.13.x'"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.*
!.gitignore
!.travis.yml
!.github
dist/
8 changes: 0 additions & 8 deletions .travis.yml

This file was deleted.

13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ deps:
.PHONY: devel-deps
devel-deps: deps
GO111MODULE=off go get ${u} \
golang.org/x/lint/golint \
github.com/mattn/goveralls \
github.com/Songmu/godzil/cmd/godzil \
github.com/Songmu/goxz/cmd/goxz \
github.com/Songmu/gocredits/cmd/gocredits \
github.com/tcnksm/ghr

.PHONY: test-tools
test-tools:
GO111MODULE=off go get ${u} \
golang.org/x/lint/golint \
github.com/mattn/goveralls

.PHONY: test
test: deps
test:
go test

.PHONY: lint
lint: devel-deps
go vet
lint: test-tools
golint -set_exit_status

.PHONY: cover
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(WIP) ecsched
=======

[![Build Status](https://travis-ci.org/Songmu/ecsched.svg?branch=master)][travis]
[![Test Status](https://github.com/Songmu/ecsched/workflows/test/badge.svg?branch=master)][travis]
[![Coverage Status](https://coveralls.io/repos/Songmu/ecsched/badge.svg?branch=master)][coveralls]
[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)][license]
[![GoDoc](https://godoc.org/github.com/Songmu/ecsched?status.svg)][godoc]
Expand Down
14 changes: 0 additions & 14 deletions appveyor.yml

This file was deleted.

2 changes: 2 additions & 0 deletions aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ import (
"github.com/aws/aws-sdk-go/service/sts"
)

// NewAWSSession return new AWS session
func NewAWSSession() (*session.Session, error) {
return session.NewSession()
}

// GetAWSAccountID returns id
func GetAWSAccountID(sess *session.Session) (string, error) {
svc := sts.New(sess)
input := &sts.GetCallerIdentityInput{}
Expand Down
4 changes: 4 additions & 0 deletions config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,21 @@ import (

const defaultRole = "ecsEventsRole"

// BaseConfig baseconfig
type BaseConfig struct {
Region string `json:"region"`
Cluster string `json:"cluster"`
AccountID string `json:"-"`
}

// Config config
type Config struct {
Role string `json:"role,omitempty"`
*BaseConfig
Rules []*Rule `json:"rules"`
}

// GetRuleByName gets rule by name
func (c *Config) GetRuleByName(name string) *Rule {
for _, r := range c.Rules {
if r.Name == name {
Expand All @@ -30,6 +33,7 @@ func (c *Config) GetRuleByName(name string) *Rule {
return nil
}

// LoadConfig loads config
func LoadConfig(r io.Reader, accountID string) (*Config, error) {
c := Config{}
bs, err := ioutil.ReadAll(r)
Expand Down
227 changes: 227 additions & 0 deletions coverage.out
Original file line number Diff line number Diff line change
@@ -0,0 +1,227 @@
mode: set
github.com/Songmu/ecsched/context.go:19.58,21.2 1 0
github.com/Songmu/ecsched/context.go:23.39,25.31 2 0
github.com/Songmu/ecsched/context.go:28.2,28.12 1 0
github.com/Songmu/ecsched/context.go:25.31,27.3 1 0
github.com/Songmu/ecsched/ecsched.go:15.63,22.20 6 0
github.com/Songmu/ecsched/ecsched.go:29.2,33.39 2 0
github.com/Songmu/ecsched/ecsched.go:36.2,36.10 1 0
github.com/Songmu/ecsched/ecsched.go:39.2,40.16 2 0
github.com/Songmu/ecsched/ecsched.go:43.2,44.16 2 0
github.com/Songmu/ecsched/ecsched.go:47.2,51.17 2 0
github.com/Songmu/ecsched/ecsched.go:63.2,65.19 3 0
github.com/Songmu/ecsched/ecsched.go:68.2,69.9 2 0
github.com/Songmu/ecsched/ecsched.go:72.2,72.53 1 0
github.com/Songmu/ecsched/ecsched.go:22.20,27.3 4 0
github.com/Songmu/ecsched/ecsched.go:33.39,35.3 1 0
github.com/Songmu/ecsched/ecsched.go:36.10,38.3 1 0
github.com/Songmu/ecsched/ecsched.go:40.16,42.3 1 0
github.com/Songmu/ecsched/ecsched.go:44.16,46.3 1 0
github.com/Songmu/ecsched/ecsched.go:51.17,53.17 2 0
github.com/Songmu/ecsched/ecsched.go:56.3,58.17 3 0
github.com/Songmu/ecsched/ecsched.go:61.3,61.15 1 0
github.com/Songmu/ecsched/ecsched.go:53.17,55.4 1 0
github.com/Songmu/ecsched/ecsched.go:58.17,60.4 1 0
github.com/Songmu/ecsched/ecsched.go:65.19,67.3 1 0
github.com/Songmu/ecsched/ecsched.go:69.9,71.3 1 0
github.com/Songmu/ecsched/ecsched.go:75.40,78.2 2 0
github.com/Songmu/ecsched/ecsched.go:86.47,87.25 1 1
github.com/Songmu/ecsched/ecsched.go:87.25,89.25 2 1
github.com/Songmu/ecsched/ecsched.go:92.3,92.34 1 1
github.com/Songmu/ecsched/ecsched.go:95.3,97.39 3 1
github.com/Songmu/ecsched/ecsched.go:89.25,91.4 1 1
github.com/Songmu/ecsched/ecsched.go:92.34,94.4 1 0
github.com/Songmu/ecsched/ecsched.go:97.39,99.4 1 1
github.com/Songmu/ecsched/ecsched.go:105.13,111.2 1 1
github.com/Songmu/ecsched/ecsched.go:113.36,115.35 2 0
github.com/Songmu/ecsched/ecsched.go:115.35,118.3 2 0
github.com/Songmu/ecsched/rule.go:43.44,44.22 1 0
github.com/Songmu/ecsched/rule.go:47.2,47.20 1 0
github.com/Songmu/ecsched/rule.go:44.22,46.3 1 0
github.com/Songmu/ecsched/rule.go:50.37,51.22 1 0
github.com/Songmu/ecsched/rule.go:54.2,54.21 1 0
github.com/Songmu/ecsched/rule.go:51.22,53.3 1 0
github.com/Songmu/ecsched/rule.go:57.33,58.39 1 0
github.com/Songmu/ecsched/rule.go:61.2,62.16 2 0
github.com/Songmu/ecsched/rule.go:65.2,65.66 1 0
github.com/Songmu/ecsched/rule.go:58.39,60.3 1 0
github.com/Songmu/ecsched/rule.go:62.16,64.3 1 0
github.com/Songmu/ecsched/rule.go:68.33,70.2 1 0
github.com/Songmu/ecsched/rule.go:72.45,73.42 1 0
github.com/Songmu/ecsched/rule.go:76.2,76.86 1 0
github.com/Songmu/ecsched/rule.go:73.42,75.3 1 0
github.com/Songmu/ecsched/rule.go:79.53,80.49 1 0
github.com/Songmu/ecsched/rule.go:83.2,83.101 1 0
github.com/Songmu/ecsched/rule.go:80.49,82.3 1 0
github.com/Songmu/ecsched/rule.go:86.31,87.16 1 0
github.com/Songmu/ecsched/rule.go:90.2,90.18 1 0
github.com/Songmu/ecsched/rule.go:87.16,89.3 1 0
github.com/Songmu/ecsched/rule.go:93.61,94.18 1 1
github.com/Songmu/ecsched/rule.go:98.2,98.25 1 1
github.com/Songmu/ecsched/rule.go:102.2,102.20 1 0
github.com/Songmu/ecsched/rule.go:105.2,105.21 1 0
github.com/Songmu/ecsched/rule.go:108.2,108.23 1 0
github.com/Songmu/ecsched/rule.go:94.18,97.3 1 1
github.com/Songmu/ecsched/rule.go:98.25,101.3 2 1
github.com/Songmu/ecsched/rule.go:102.20,104.3 1 0
github.com/Songmu/ecsched/rule.go:105.21,107.3 1 0
github.com/Songmu/ecsched/rule.go:108.23,110.3 1 0
github.com/Songmu/ecsched/rule.go:114.62,122.2 1 0
github.com/Songmu/ecsched/rule.go:125.68,130.2 1 0
github.com/Songmu/ecsched/rule.go:147.50,148.21 1 0
github.com/Songmu/ecsched/rule.go:151.2,152.42 2 0
github.com/Songmu/ecsched/rule.go:166.2,176.3 2 0
github.com/Songmu/ecsched/rule.go:148.21,150.3 1 0
github.com/Songmu/ecsched/rule.go:152.42,154.36 2 0
github.com/Songmu/ecsched/rule.go:160.3,164.5 1 0
github.com/Songmu/ecsched/rule.go:154.36,159.4 1 0
github.com/Songmu/ecsched/rule.go:180.72,182.57 2 0
github.com/Songmu/ecsched/rule.go:185.2,186.12 2 0
github.com/Songmu/ecsched/rule.go:182.57,184.3 1 0
github.com/Songmu/ecsched/rule.go:190.83,193.42 3 0
github.com/Songmu/ecsched/rule.go:214.2,223.16 2 0
github.com/Songmu/ecsched/rule.go:226.2,226.27 1 0
github.com/Songmu/ecsched/rule.go:232.2,232.12 1 0
github.com/Songmu/ecsched/rule.go:193.42,198.36 2 0
github.com/Songmu/ecsched/rule.go:204.3,204.32 1 0
github.com/Songmu/ecsched/rule.go:207.3,211.5 1 0
github.com/Songmu/ecsched/rule.go:198.36,203.4 1 0
github.com/Songmu/ecsched/rule.go:204.32,206.4 1 0
github.com/Songmu/ecsched/rule.go:223.16,225.3 1 0
github.com/Songmu/ecsched/rule.go:226.27,229.3 2 0
github.com/Songmu/ecsched/cmd_dump.go:20.34,22.2 1 1
github.com/Songmu/ecsched/cmd_dump.go:24.41,26.2 1 0
github.com/Songmu/ecsched/cmd_dump.go:28.98,37.39 4 0
github.com/Songmu/ecsched/cmd_dump.go:40.2,43.17 4 0
github.com/Songmu/ecsched/cmd_dump.go:54.2,54.14 1 0
github.com/Songmu/ecsched/cmd_dump.go:57.2,57.19 1 0
github.com/Songmu/ecsched/cmd_dump.go:60.2,60.20 1 0
github.com/Songmu/ecsched/cmd_dump.go:63.2,63.18 1 0
github.com/Songmu/ecsched/cmd_dump.go:66.2,66.17 1 0
github.com/Songmu/ecsched/cmd_dump.go:72.2,72.37 1 0
github.com/Songmu/ecsched/cmd_dump.go:75.2,81.16 6 0
github.com/Songmu/ecsched/cmd_dump.go:84.2,93.35 2 0
github.com/Songmu/ecsched/cmd_dump.go:171.2,173.16 3 0
github.com/Songmu/ecsched/cmd_dump.go:176.2,177.12 2 0
github.com/Songmu/ecsched/cmd_dump.go:37.39,39.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:43.17,45.17 2 0
github.com/Songmu/ecsched/cmd_dump.go:48.3,50.17 3 0
github.com/Songmu/ecsched/cmd_dump.go:45.17,47.4 1 0
github.com/Songmu/ecsched/cmd_dump.go:50.17,52.4 1 0
github.com/Songmu/ecsched/cmd_dump.go:54.14,56.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:57.19,59.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:60.20,62.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:63.18,65.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:66.17,68.18 2 0
github.com/Songmu/ecsched/cmd_dump.go:68.18,70.4 1 0
github.com/Songmu/ecsched/cmd_dump.go:72.37,74.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:81.16,83.3 1 0
github.com/Songmu/ecsched/cmd_dump.go:93.35,94.48 1 0
github.com/Songmu/ecsched/cmd_dump.go:97.3,100.17 2 0
github.com/Songmu/ecsched/cmd_dump.go:103.3,104.32 2 0
github.com/Songmu/ecsched/cmd_dump.go:152.3,158.23 2 0
github.com/Songmu/ecsched/cmd_dump.go:169.3,169.28 1 0
github.com/Songmu/ecsched/cmd_dump.go:94.48,95.12 1 0
github.com/Songmu/ecsched/cmd_dump.go:100.17,102.4 1 0
github.com/Songmu/ecsched/cmd_dump.go:104.32,105.28 1 0
github.com/Songmu/ecsched/cmd_dump.go:108.4,109.27 2 0
github.com/Songmu/ecsched/cmd_dump.go:112.4,113.24 2 0
github.com/Songmu/ecsched/cmd_dump.go:117.4,119.43 2 0
github.com/Songmu/ecsched/cmd_dump.go:123.4,124.22 2 0
github.com/Songmu/ecsched/cmd_dump.go:127.4,130.67 3 0
github.com/Songmu/ecsched/cmd_dump.go:133.4,134.49 2 0
github.com/Songmu/ecsched/cmd_dump.go:149.4,150.37 2 0
github.com/Songmu/ecsched/cmd_dump.go:105.28,106.22 1 0
github.com/Songmu/ecsched/cmd_dump.go:109.27,111.5 1 0
github.com/Songmu/ecsched/cmd_dump.go:113.24,115.22 1 0
github.com/Songmu/ecsched/cmd_dump.go:119.43,121.5 1 0
github.com/Songmu/ecsched/cmd_dump.go:124.22,126.5 1 0
github.com/Songmu/ecsched/cmd_dump.go:130.67,132.5 1 0
github.com/Songmu/ecsched/cmd_dump.go:134.49,136.34 2 0
github.com/Songmu/ecsched/cmd_dump.go:139.5,140.39 2 0
github.com/Songmu/ecsched/cmd_dump.go:143.5,147.7 1 0
github.com/Songmu/ecsched/cmd_dump.go:136.34,138.6 1 0
github.com/Songmu/ecsched/cmd_dump.go:140.39,142.6 1 0
github.com/Songmu/ecsched/cmd_dump.go:159.10,160.21 1 0
github.com/Songmu/ecsched/cmd_dump.go:161.10,162.26 1 0
github.com/Songmu/ecsched/cmd_dump.go:163.11,165.21 1 0
github.com/Songmu/ecsched/cmd_dump.go:173.16,175.3 1 0
github.com/Songmu/ecsched/cmd_run.go:15.33,17.2 1 1
github.com/Songmu/ecsched/cmd_run.go:19.40,21.2 1 0
github.com/Songmu/ecsched/cmd_run.go:23.103,32.39 4 0
github.com/Songmu/ecsched/cmd_run.go:35.2,35.17 1 0
github.com/Songmu/ecsched/cmd_run.go:38.2,40.17 3 0
github.com/Songmu/ecsched/cmd_run.go:51.2,52.15 2 0
github.com/Songmu/ecsched/cmd_run.go:55.2,56.13 2 0
github.com/Songmu/ecsched/cmd_run.go:59.2,60.15 2 0
github.com/Songmu/ecsched/cmd_run.go:65.2,65.13 1 0
github.com/Songmu/ecsched/cmd_run.go:68.2,68.37 1 0
github.com/Songmu/ecsched/cmd_run.go:32.39,34.3 1 0
github.com/Songmu/ecsched/cmd_run.go:35.17,37.3 1 0
github.com/Songmu/ecsched/cmd_run.go:40.17,42.17 2 0
github.com/Songmu/ecsched/cmd_run.go:45.3,47.17 3 0
github.com/Songmu/ecsched/cmd_run.go:42.17,44.4 1 0
github.com/Songmu/ecsched/cmd_run.go:47.17,49.4 1 0
github.com/Songmu/ecsched/cmd_run.go:52.15,54.3 1 0
github.com/Songmu/ecsched/cmd_run.go:56.13,58.3 1 0
github.com/Songmu/ecsched/cmd_run.go:60.15,61.17 1 0
github.com/Songmu/ecsched/cmd_run.go:61.17,63.4 1 0
github.com/Songmu/ecsched/cmd_run.go:65.13,67.3 1 0
github.com/Songmu/ecsched/config.go:27.51,28.28 1 0
github.com/Songmu/ecsched/config.go:33.2,33.12 1 0
github.com/Songmu/ecsched/config.go:28.28,29.21 1 0
github.com/Songmu/ecsched/config.go:29.21,31.4 1 0
github.com/Songmu/ecsched/config.go:37.65,40.16 3 1
github.com/Songmu/ecsched/config.go:43.2,44.16 2 1
github.com/Songmu/ecsched/config.go:47.2,47.47 1 1
github.com/Songmu/ecsched/config.go:50.2,51.28 2 1
github.com/Songmu/ecsched/config.go:54.2,54.16 1 1
github.com/Songmu/ecsched/config.go:40.16,42.3 1 0
github.com/Songmu/ecsched/config.go:44.16,46.3 1 0
github.com/Songmu/ecsched/config.go:47.47,49.3 1 0
github.com/Songmu/ecsched/config.go:51.28,53.3 1 1
github.com/Songmu/ecsched/aws.go:12.48,14.2 1 0
github.com/Songmu/ecsched/aws.go:17.61,21.16 4 0
github.com/Songmu/ecsched/aws.go:24.2,24.27 1 0
github.com/Songmu/ecsched/aws.go:27.2,27.29 1 0
github.com/Songmu/ecsched/aws.go:21.16,23.3 1 0
github.com/Songmu/ecsched/aws.go:24.27,26.3 1 0
github.com/Songmu/ecsched/cmd_apply.go:17.35,19.2 1 1
github.com/Songmu/ecsched/cmd_apply.go:21.42,23.2 1 0
github.com/Songmu/ecsched/cmd_apply.go:25.105,34.39 4 0
github.com/Songmu/ecsched/cmd_apply.go:37.2,37.17 1 0
github.com/Songmu/ecsched/cmd_apply.go:40.2,42.17 3 0
github.com/Songmu/ecsched/cmd_apply.go:53.2,54.15 2 0
github.com/Songmu/ecsched/cmd_apply.go:57.2,58.13 2 0
github.com/Songmu/ecsched/cmd_apply.go:61.2,62.15 2 0
github.com/Songmu/ecsched/cmd_apply.go:72.2,72.13 1 0
github.com/Songmu/ecsched/cmd_apply.go:75.2,75.33 1 0
github.com/Songmu/ecsched/cmd_apply.go:34.39,36.3 1 0
github.com/Songmu/ecsched/cmd_apply.go:37.17,39.3 1 0
github.com/Songmu/ecsched/cmd_apply.go:42.17,44.17 2 0
github.com/Songmu/ecsched/cmd_apply.go:47.3,49.17 3 0
github.com/Songmu/ecsched/cmd_apply.go:44.17,46.4 1 0
github.com/Songmu/ecsched/cmd_apply.go:49.17,51.4 1 0
github.com/Songmu/ecsched/cmd_apply.go:54.15,56.3 1 0
github.com/Songmu/ecsched/cmd_apply.go:58.13,60.3 1 0
github.com/Songmu/ecsched/cmd_apply.go:62.15,63.17 1 0
github.com/Songmu/ecsched/cmd_apply.go:63.17,64.44 1 0
github.com/Songmu/ecsched/cmd_apply.go:68.4,69.76 2 0
github.com/Songmu/ecsched/cmd_apply.go:64.44,67.5 1 0
github.com/Songmu/ecsched/cmd_apply.go:72.13,74.3 1 0
github.com/Songmu/ecsched/template.go:17.13,19.38 1 1
github.com/Songmu/ecsched/template.go:19.38,21.27 2 1
github.com/Songmu/ecsched/template.go:28.4,28.12 1 1
github.com/Songmu/ecsched/template.go:21.27,23.16 2 1
github.com/Songmu/ecsched/template.go:26.5,26.10 1 1
github.com/Songmu/ecsched/template.go:23.16,25.6 1 0
github.com/Songmu/ecsched/template.go:30.39,31.38 1 0
github.com/Songmu/ecsched/template.go:34.4,34.69 1 0
github.com/Songmu/ecsched/template.go:31.38,33.5 1 0
github.com/Songmu/ecsched/template.go:39.47,41.16 2 1
github.com/Songmu/ecsched/template.go:44.2,45.43 2 1
github.com/Songmu/ecsched/template.go:53.2,53.25 1 1
github.com/Songmu/ecsched/template.go:41.16,43.3 1 0
github.com/Songmu/ecsched/template.go:45.43,48.73 1 0
github.com/Songmu/ecsched/template.go:51.3,51.57 1 0
github.com/Songmu/ecsched/template.go:48.73,49.14 1 0
9 changes: 9 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
module github.com/Songmu/ecsched

go 1.12

require (
github.com/aws/aws-sdk-go v1.25.18
github.com/ghodss/yaml v1.0.0
github.com/pkg/errors v0.8.1
github.com/stretchr/testify v1.4.0 // indirect
golang.org/x/net v0.0.0-20191021144547-ec77196f6094 // indirect
gopkg.in/yaml.v2 v2.2.4 // indirect
)
Loading