Skip to content

Commit

Permalink
Retire Travis (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
martialonline authored Oct 6, 2020
1 parent e2add4b commit 2945f88
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
icon_emoji: ':octocat:',
mention: 'channel',
attachments: [{
title: '${{ steps.commit.outputs.repo }} ${{ github.workflow }} pipeline has failed',
title: '[${{ steps.commit.outputs.repo }}] ${{ github.workflow }} pipeline has failed',
color: '${{ steps.check.outputs.status }}' == 'failure' ? 'danger' : 'warning',
fields: [{
title: 'Commit Hash',
Expand Down
87 changes: 87 additions & 0 deletions .github/workflows/fossa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Fossa

on:
push:
branches:
- master

defaults:
run:
shell: bash

env:
FOSSA_VER: 1.1.0
FOSSA_URL: https://github.com/fossas/fossa-cli/releases/download
GOLANG_VERSION: 1.15

jobs:

scan:
name: Fossa
runs-on: ubuntu-18.04
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Golang Environment
uses: actions/setup-go@v2
with:
go-version: '${{ env.GOLANG_VERSION }}'
- name: Configure Fossa CLI
run: |
wget ${{ env.FOSSA_URL }}/v${{ env.FOSSA_VER }}/fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
tar xzf fossa-cli_${{ env.FOSSA_VER }}_linux_amd64.tar.gz
./fossa init
- name: Run License Scan
env:
FOSSA_API_KEY: ${{ secrets.FOSSA_TOKEN }}
GO111MODULE: on
GOPATH: /home/runner/go
run: ./fossa analyze -t ${GITHUB_REPOSITORY#*/} -b ${GITHUB_REF##*/}

notify:
name: Notify
runs-on: ubuntu-18.04
needs: scan
if: always()
steps:
- name: Workflow Status
id: check
uses: martialonline/workflow-status@v1
- name: Output Variables
id: commit
run: |
echo "::set-output name=sha::$(echo ${GITHUB_SHA} | cut -c1-7)"
echo "::set-output name=repo::${GITHUB_REPOSITORY#*/}"
- name: Send Notification
uses: 8398a7/action-slack@v3
if: steps.check.outputs.status == 'failure'
with:
status: custom
custom_payload: |
{
username: 'Fossa Scan',
icon_emoji: ':fossa:',
mention: 'channel',
attachments: [{
title: '[${{ steps.commit.outputs.repo }}] ${{ github.workflow }} license scan has failed',
color: 'danger',
fields: [{
title: 'Commit Hash',
value: '${{ steps.commit.outputs.sha }}',
short: true
},
{
title: 'Author',
value: '${{ github.actor }}',
short: true
},
{
title: 'Job URL',
value: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}',
short: false
}]
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
9 changes: 0 additions & 9 deletions .travis.yml

This file was deleted.

0 comments on commit 2945f88

Please sign in to comment.