ci: set up pg database to test ORM

pull/2997/head
Alexander Medvednikov 2019-12-06 02:11:39 +03:00
parent 71c0c4803f
commit be323e2fb6
5 changed files with 48 additions and 37 deletions

View File

@ -29,7 +29,7 @@ jobs:
node-version: 12.x node-version: 12.x
- name: Install dependencies - name: Install dependencies
run: | run: |
brew install freetype glfw openssl brew install freetype glfw openssl postgres
export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/" export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
- name: Build V - name: Build V
run: make && ./v -o v v.v run: make && ./v -o v v.v
@ -37,6 +37,10 @@ jobs:
run: ./v -o v2 v.v && ./v2 -o v3 v.v run: ./v -o v2 v.v && ./v2 -o v3 v.v
- name: Test symlink - name: Test symlink
run: sudo ./v symlink run: sudo ./v symlink
- name: Set up pg database
run: |
psql -U postgres -c 'create database customerdb;'
psql -d customerdb -f examples/database/pg/mydb.sql
- name: Test v->c - name: Test v->c
run: ./v test-compiler run: ./v test-compiler
- name: Test v binaries - name: Test v binaries

View File

@ -19,7 +19,7 @@ pub mut:
fail string fail string
} }
pub fn new_test_sesion(vargs string) TestSession { pub fn new_test_session(vargs string) TestSession {
return TestSession{ return TestSession{
vexe: vexe_path() vexe: vexe_path()
vargs: vargs vargs: vargs
@ -50,6 +50,9 @@ pub fn (ts mut TestSession) test() {
$if windows { $if windows {
if file.contains('sqlite') { continue } if file.contains('sqlite') { continue }
} }
$if !macos {
if file.contains('customer') { continue }
}
$if msvc { $if msvc {
if file.contains('asm') { continue } if file.contains('asm') { continue }
} }
@ -112,7 +115,7 @@ pub fn v_build_failing(zargs string, folder string) bool {
eprintln(main_label) eprintln(main_label)
eprintln(' v compiler args: "$vargs"') eprintln(' v compiler args: "$vargs"')
mut session := new_test_sesion( vargs ) mut session := new_test_session( vargs )
files := os.walk_ext(filepath.join(parent_dir, folder),'.v') files := os.walk_ext(filepath.join(parent_dir, folder),'.v')
mains := files.filter(!it.contains('modules')) mains := files.filter(!it.contains('modules'))
mut rebuildable_mains := mains mut rebuildable_mains := mains

View File

@ -48,7 +48,7 @@ fn v_test_compiler(vargs string){
building_tools_failed := testing.v_build_failing(vargs, 'tools') building_tools_failed := testing.v_build_failing(vargs, 'tools')
eprintln('\nTesting all _test.v files...') eprintln('\nTesting all _test.v files...')
mut compiler_test_session := testing.new_test_sesion( vargs ) mut compiler_test_session := testing.new_test_session( vargs )
compiler_test_session.files << os.walk_ext(parent_dir, '_test.v') compiler_test_session.files << os.walk_ext(parent_dir, '_test.v')
compiler_test_session.test() compiler_test_session.test()
eprintln( compiler_test_session.benchmark.total_message('running V tests') ) eprintln( compiler_test_session.benchmark.total_message('running V tests') )

View File

@ -30,7 +30,7 @@ pub fn main() {
exit(1) exit(1)
} }
mut ts := testing.new_test_sesion(args_before) mut ts := testing.new_test_session(args_before)
for targ in args_after.split(' ') { for targ in args_after.split(' ') {
if os.exists(targ) && targ.ends_with('_test.v') { if os.exists(targ) && targ.ends_with('_test.v') {
ts.files << targ ts.files << targ

View File

@ -285,6 +285,10 @@ const (
N = 5 N = 5
) )
struct Foooj {
a [N]int
}
fn test_fixed() { fn test_fixed() {
mut nums := [4]int mut nums := [4]int
assert nums[0] == 0 assert nums[0] == 0