2022-05-20 06:46:29 +03:00
name : ci
2022-05-11 20:12:26 +03:00
on :
push :
pull_request :
jobs :
test :
2022-05-20 10:34:54 +03:00
name : 'Unit- & API tests'
2022-05-11 20:12:26 +03:00
runs-on : ubuntu-latest
2022-05-20 06:46:29 +03:00
steps :
- name : Set up Go 1.x
2023-02-11 05:21:26 +03:00
uses : actions/setup-go@v3
2022-05-20 06:46:29 +03:00
with :
2022-12-03 02:32:30 +03:00
go-version : ^1.19
2022-05-20 06:46:29 +03:00
id : go
- name : Check out code into the Go module directory
2023-02-11 05:21:26 +03:00
uses : actions/checkout@v3
2022-05-20 06:46:29 +03:00
- name : Get dependencies
run : go get
- name : Unit Tests
2023-01-02 20:18:58 +03:00
run : CGO_ENABLED=0 go test `go list ./... | grep -v 'github.com/muety/wakapi/scripts'` -run ./... # skip scripts package, because not actually a package
2022-05-20 06:46:29 +03:00
- name : API Tests
run : |
npm -g install newman
./testing/run_api_tests.sh
mapi :
2022-05-20 10:34:54 +03:00
name : 'Automated pen-tests with Mayhem for API'
2022-05-20 06:46:29 +03:00
runs-on : ubuntu-latest
2022-09-30 01:02:30 +03:00
env :
CGO_ENABLED : 0
2022-05-11 20:12:26 +03:00
steps :
- name : Set up Go 1.x
2023-02-11 05:21:26 +03:00
uses : actions/setup-go@v3
2022-05-11 20:12:26 +03:00
with :
2022-12-03 02:32:30 +03:00
go-version : ^1.19
2022-05-11 20:12:26 +03:00
- name : Check out code into the Go module directory
2023-02-11 05:21:26 +03:00
uses : actions/checkout@v3
2022-05-11 20:12:26 +03:00
- name : Get dependencies
run : go get
- name : Build
2022-09-30 01:02:30 +03:00
run : go build -v .
2022-05-11 20:12:26 +03:00
- name : start wakapi
run : ./wakapi --config config.default.yml &
- name : create a trivial testing user
run : sqlite3 wakapi_db.db "insert into users (id, api_key) values ('mapi', 'test-api-key')"
- name : Run Mayhem for API
uses : ForAllSecure/mapi-action@v1
continue-on-error : true
with :
mapi-token : ${{ secrets.MAPI_TOKEN }}
api-url : http://localhost:3000/api/
api-spec : static/docs/swagger.yaml
2022-05-13 17:13:55 +03:00
target : muety/wakapi
2022-05-11 20:12:26 +03:00
duration : 1min
sarif-report : mapi.sarif
run-args : |
--header-auth
Authorization : Basic dGVzdC1hcGkta2V5
- name : Upload SARIF file
2023-01-25 13:14:22 +03:00
uses : github/codeql-action/upload-sarif@v2
2022-05-11 20:12:26 +03:00
with :
sarif_file : mapi.sarif
2022-05-20 06:46:29 +03:00
build :
2022-05-20 10:34:54 +03:00
name : 'Build (Win, Linux, Mac)'
2022-05-20 06:46:29 +03:00
strategy :
matrix :
platform : [ ubuntu-latest, macos-latest, windows-latest]
runs-on : ${{ matrix.platform }}
2022-09-30 01:02:30 +03:00
env :
CGO_ENABLED : 0
2022-05-20 06:46:29 +03:00
2022-09-30 01:02:30 +03:00
steps :
2022-05-20 06:46:29 +03:00
- name : Set up Go 1.x
2023-02-11 05:21:26 +03:00
uses : actions/setup-go@v3
2022-05-20 06:46:29 +03:00
with :
2022-12-03 02:32:30 +03:00
go-version : ^1.19
2022-05-20 06:46:29 +03:00
id : go
- name : Check out code into the Go module directory
2023-02-11 05:21:26 +03:00
uses : actions/checkout@v3
2022-05-20 06:46:29 +03:00
- name : Get dependencies
run : go get
- name : Build
2022-09-30 01:02:30 +03:00
run : go build -v .
2022-12-04 10:02:36 +03:00
migration :
name : Migration tests
runs-on : ubuntu-latest
2022-12-27 06:39:32 +03:00
strategy :
fail-fast : false
matrix :
db : [ sqlite, postgres, mysql, mariadb]
2022-12-04 10:02:36 +03:00
steps :
- name : Set up Go 1.x
2023-02-11 05:21:26 +03:00
uses : actions/setup-go@v3
2022-12-04 10:02:36 +03:00
with :
go-version : ^1.19
id : go
- name : Check out code into the Go module directory
2023-02-11 05:21:26 +03:00
uses : actions/checkout@v3
2022-12-04 10:02:36 +03:00
2022-12-27 06:39:32 +03:00
- run : ./testing/run_api_tests.sh ${{ matrix.db }} --migration