ci: create test db automatically #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup FluentCI | |
uses: fluentci-io/setup-fluentci@v5 | |
with: | |
wasm: true | |
plugin: pkgx | |
args: install go | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: go get & build | |
run: | | |
go get | |
go build -o ./bin/main | |
- name: Check code style | |
run: gofmt main.go | diff --ignore-tab-expansion main.go - | |
- name: go test | |
run: | | |
fluentci run --wasm postgres start | |
go install gotest.tools/gotestsum@latest | |
PATH=$HOME/go/bin:$PATH gotestsum --junitfile junit.xml ./... | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NIX_CONFIG: "extra-access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | |
POSTGRES_USER: postgres | |
POSTGRES_DATABASE: s2 | |
- name: Test web server | |
run: | | |
./bin/main 8001 & | |
curl --silent localhost:8001/time | grep "The current time is" |