Skip to content

Commit

Permalink
Run default and integration tests on commit
Browse files Browse the repository at this point in the history
Update the GitHub Action to run the tests in both default mode (with
virtualised service calls), and integration mode (with calls to the real
GitHub API).
  • Loading branch information
johnboyes committed Jul 16, 2020
1 parent 69d0bd2 commit 89bc8cd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on: [push] # yamllint disable-line rule:truthy
name: Tests
jobs:
tests:
name: Integration
strategy:
matrix:
go-version: [1.14.x]
Expand All @@ -18,4 +19,4 @@ jobs:
- name: Tests
env:
INPUT_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: go test ./...
run: go test -integration -v .
40 changes: 40 additions & 0 deletions .github/workflows/virtual_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
on: [push] # yamllint disable-line rule:truthy
name: Tests
jobs:
tests:
name: Virtual
strategy:
matrix:
go-version: [1.14.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Install Hoverfly
working-directory: ${{ runner.temp }}
run: |
mkdir -p $GITHUB_WORKSPACE/bin
export HOVERFLY_PLATFORM=linux_amd64
export HOVERFLY_VERSION=v1.3.0
export HOVERFLY_BUNDLE=hoverfly_bundle_$HOVERFLY_PLATFORM
export HOVERFLY_DOWNLOAD_URL=https://github.com/SpectoLabs/hoverfly/releases/download/
wget $HOVERFLY_DOWNLOAD_URL$HOVERFLY_VERSION/$HOVERFLY_BUNDLE.zip
unzip $HOVERFLY_BUNDLE.zip
mv hoverfly $GITHUB_WORKSPACE/bin/
mv hoverctl $GITHUB_WORKSPACE/bin/
echo "::add-path::$GITHUB_WORKSPACE/bin"
chmod +x $GITHUB_WORKSPACE/bin/hoverfly
chmod +x $GITHUB_WORKSPACE/bin/hoverctl
- name: Add and trust Hoverfly default certificate
run: |
wget https://raw.githubusercontent.com/SpectoLabs/hoverfly/master/core/cert.pem
sudo mv cert.pem /usr/local/share/ca-certificates/hoverfly.crt
sudo update-ca-certificates
- name: Tests
run: go test -v .
8 changes: 8 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
extends: default

rules:
# 120 chars should be enough, but don't fail if a line is longer
line-length:
max: 120
level: warning

0 comments on commit 89bc8cd

Please sign in to comment.