fix grant permissions to public schema #7
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 | |
pkgx psql --host=localhost -d postgres -U `whoami` -c 'CREATE DATABASE s2;' | |
pkgx psql --host=localhost -d s2 -U `whoami` -c 'CREATE USER postgres CREATEROLE;' | |
pkgx psql --host=localhost -d s2 -U `whoami` -c 'GRANT ALL PRIVILEGES ON DATABASE s2 TO postgres;' | |
pkgx psql --host=localhost -d s2 -U `whoami` -c 'GRANT ALL ON SCHEMA public TO postgres;' | |
pkgx psql --host=localhost -d s2 -U `whoami` -c 'GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO postgres;' | |
pkgx psql --host=localhost -d s2 -U `whoami` -c 'ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT ALL ON TABLES TO postgres;' | |
go install gotest.tools/gotestsum@latest | |
PATH=$HOME/go/bin:$PATH gotestsum --junitfile junit.xml ./... | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Test web server | |
run: | | |
./bin/main 8001 & | |
curl --silent localhost:8001/time | grep "The current time is" |