Skip to content

Commit

Permalink
actions, testing
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterlong committed Jul 27, 2020
1 parent a84fad3 commit 84e68ea
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 54 deletions.
45 changes: 6 additions & 39 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,49 +57,16 @@ jobs:
- name: Upload Assets to S3
run: |
tar -czvf source.tar.gz source/
cp source.tar.gz source-${VERSION}.tar.gz
aws s3 cp source.tar.gz s3://assets.statping.com/
aws s3 cp source-${VERSION}.tar.gz s3://assets.statping.com/
rm -rf source.tar.gz
aws s3 cp source/dist/css/ s3://assets.statping.com/css/ --recursive --exclude "*" --include "*.css"
aws s3 cp source/dist/js/ s3://assets.statping.com/js/ --recursive --exclude "*" --include "*.js"
aws s3 cp source/dist/scss/ s3://assets.statping.com/scss/ --recursive --exclude "*" --include "*.scss"
rm -rf source-${VERSION}.tar.gz
aws s3 cp source/dist/css/ s3://assets.statping.com/css/ --recursive
aws s3 cp source/dist/js/ s3://assets.statping.com/js/ --recursive
aws s3 cp source/dist/scss/ s3://assets.statping.com/scss/ --recursive
aws s3 cp install.sh s3://assets.statping.com/
- name: Upload frontend assets to CDN
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: 'assets.statping.com'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: 'source/dist'

- name: Compress frontend source
run: |
tar -czvf frontend.tar.gz source
cp frontend.tar.gz frontend-${VERSION}.tar.gz
- name: Upload frontend dist to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: 'assets.statping.com'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: 'frontend.tar.gz'

- name: Upload frontend current version to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
env:
AWS_S3_BUCKET: 'assets.statping.com'
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
DEST_DIR: 'source'
SOURCE_DIR: frontend-${VERSION}.tar.gz

test:
needs: compile
runs-on: ubuntu-latest
Expand Down
3 changes: 2 additions & 1 deletion notifiers/gotify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ var (
)

func TestGotifyNotifier(t *testing.T) {
t.Parallel()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
GOTIFY_URL = utils.Params.GetString("GOTIFY_URL")
GOTIFY_TOKEN = utils.Params.GetString("GOTIFY_TOKEN")

Expand Down
5 changes: 3 additions & 2 deletions notifiers/mobile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ var (
)

func TestMobileNotifier(t *testing.T) {
t.Parallel()
t.SkipNow()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
t.SkipNow()

mobileToken = utils.Params.GetString("MOBILE_TOKEN")
if mobileToken == "" {
t.Log("Mobile notifier testing skipped, missing MOBILE_ID environment variable")
Expand Down
2 changes: 1 addition & 1 deletion notifiers/pushover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ var (
)

func TestPushoverNotifier(t *testing.T) {
t.Parallel()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
PUSHOVER_TOKEN = utils.Params.GetString("PUSHOVER_TOKEN")
PUSHOVER_API = utils.Params.GetString("PUSHOVER_API")

Expand Down
3 changes: 2 additions & 1 deletion notifiers/slack_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ var (
)

func TestSlackNotifier(t *testing.T) {
t.Parallel()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
Expand Down
3 changes: 2 additions & 1 deletion notifiers/statping_emailer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ var (
)

func TestStatpingEmailerNotifier(t *testing.T) {
t.Parallel()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
Expand Down
6 changes: 3 additions & 3 deletions notifiers/telegram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ var (
)

func TestTelegramNotifier(t *testing.T) {
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()

telegramToken = utils.Params.GetString("TELEGRAM_TOKEN")
Expand All @@ -29,9 +32,6 @@ func TestTelegramNotifier(t *testing.T) {
t.SkipNow()
}

err := utils.InitLogs()
require.Nil(t, err)

Telegram.ApiSecret = null.NewNullString(telegramToken)
Telegram.Var1 = null.NewNullString(telegramChannel)

Expand Down
8 changes: 4 additions & 4 deletions notifiers/twilio_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,20 @@ var (
)

func TestTwilioNotifier(t *testing.T) {
t.Parallel()

err := utils.InitLogs()
require.Nil(t, err)

TWILIO_SID = utils.Params.GetString("TWILIO_SID")
TWILIO_SECRET = utils.Params.GetString("TWILIO_SECRET")
t.Parallel()

db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
notifications.SetDB(db)
core.Example()

TWILIO_SID = utils.Params.GetString("TWILIO_SID")
TWILIO_SECRET = utils.Params.GetString("TWILIO_SECRET")

if TWILIO_SID == "" || TWILIO_SECRET == "" {
t.Log("twilio notifier testing skipped, missing TWILIO_SID and TWILIO_SECRET environment variable")
t.SkipNow()
Expand Down
6 changes: 4 additions & 2 deletions notifiers/webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ var (
)

func TestWebhookNotifier(t *testing.T) {
t.Parallel()
t.SkipNow()
err := utils.InitLogs()
require.Nil(t, err)

t.Parallel()
t.SkipNow()

db, err := database.OpenTester()
require.Nil(t, err)
db.AutoMigrate(&notifications.Notification{})
Expand Down

0 comments on commit 84e68ea

Please sign in to comment.