ci: test the new prebuilt packages
parent
71378b8041
commit
1bfcdaa2cc
|
@ -2,14 +2,14 @@ name: CI
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
jobs:
|
jobs:
|
||||||
|
|
||||||
build-alpine-docker-musl-gcc:
|
alpine-docker-musl-gcc:
|
||||||
name: Alpine/musl
|
name: Alpine/musl
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v1
|
uses: actions/checkout@v1
|
||||||
|
|
||||||
- name: Build V
|
- name: Build V
|
||||||
uses: spytheman/docker_alpine_v@v5.0
|
uses: spytheman/docker_alpine_v@v5.0
|
||||||
with:
|
with:
|
||||||
|
@ -20,7 +20,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
entrypoint: .github/workflows/alpine.test.sh
|
entrypoint: .github/workflows/alpine.test.sh
|
||||||
|
|
||||||
build-osx:
|
macos:
|
||||||
runs-on: macOS-10.14
|
runs-on: macOS-10.14
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -46,7 +46,7 @@ jobs:
|
||||||
git clone --depth 1 https://github.com/vlang/vid.git
|
git clone --depth 1 https://github.com/vlang/vid.git
|
||||||
cd vid && ../v -o vid .
|
cd vid && ../v -o vid .
|
||||||
|
|
||||||
build-ubuntu:
|
ubuntu:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -68,7 +68,16 @@ jobs:
|
||||||
- name: x64 machine code generation
|
- name: x64 machine code generation
|
||||||
run: cd examples/x64 && ../../v -x64 hello_world.v && ./hello_world
|
run: cd examples/x64 && ../../v -x64 hello_world.v && ./hello_world
|
||||||
|
|
||||||
build-ubuntu-tcc:
|
ubuntu-prebuilt:
|
||||||
|
runs-on: ubuntu-18.04
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Download V
|
||||||
|
run: wget https://github.com/vbinaries/vbinaries/releases/download/latest/v_linux.zip
|
||||||
|
&& unzip v_linux.zip && ./v --version
|
||||||
|
|
||||||
|
|
||||||
|
ubuntu-tcc:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -85,7 +94,7 @@ jobs:
|
||||||
./v -o v2 v.v # Make sure vtcc can build itself
|
./v -o v2 v.v # Make sure vtcc can build itself
|
||||||
./v test v
|
./v test v
|
||||||
|
|
||||||
build-ubuntu-musl:
|
ubuntu-musl:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -101,7 +110,7 @@ jobs:
|
||||||
# - name: Test v->js
|
# - name: Test v->js
|
||||||
# run: ./v -o hi.js examples/hello_v_js.v && node hi.js
|
# run: ./v -o hi.js examples/hello_v_js.v && node hi.js
|
||||||
|
|
||||||
build-windows-gcc:
|
windows-gcc:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
@ -120,7 +129,7 @@ jobs:
|
||||||
#.\v.exe -o hi.js examples/hello_v_js.v
|
#.\v.exe -o hi.js examples/hello_v_js.v
|
||||||
#node hi.js
|
#node hi.js
|
||||||
|
|
||||||
build-windows-msvc:
|
windows-msvc:
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
32
vlib/os/os.v
32
vlib/os/os.v
|
@ -212,7 +212,7 @@ fn vfopen(path, mode string) *C.FILE {
|
||||||
} $else {
|
} $else {
|
||||||
return C.fopen(*char(path.str), *char(mode.str))
|
return C.fopen(*char(path.str), *char(mode.str))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read_lines reads the file in `path` into an array of lines.
|
// read_lines reads the file in `path` into an array of lines.
|
||||||
pub fn read_lines(path string) ?[]string {
|
pub fn read_lines(path string) ?[]string {
|
||||||
|
@ -254,7 +254,7 @@ pub fn read_lines(path string) ?[]string {
|
||||||
fn read_ulines(path string) ?[]ustring {
|
fn read_ulines(path string) ?[]ustring {
|
||||||
lines := read_lines(path) or {
|
lines := read_lines(path) or {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// mut ulines := new_array(0, lines.len, sizeof(ustring))
|
// mut ulines := new_array(0, lines.len, sizeof(ustring))
|
||||||
mut ulines := []ustring
|
mut ulines := []ustring
|
||||||
for myline in lines {
|
for myline in lines {
|
||||||
|
@ -269,7 +269,7 @@ pub fn open(path string) ?File {
|
||||||
$if windows {
|
$if windows {
|
||||||
wpath := path.to_wide()
|
wpath := path.to_wide()
|
||||||
mode := 'rb'
|
mode := 'rb'
|
||||||
file = File {
|
file = File {
|
||||||
cfile: C._wfopen(wpath, mode.to_wide())
|
cfile: C._wfopen(wpath, mode.to_wide())
|
||||||
}
|
}
|
||||||
} $else {
|
} $else {
|
||||||
|
@ -290,7 +290,7 @@ pub fn create(path string) ?File {
|
||||||
$if windows {
|
$if windows {
|
||||||
wpath := path.replace('/', '\\').to_wide()
|
wpath := path.replace('/', '\\').to_wide()
|
||||||
mode := 'wb'
|
mode := 'wb'
|
||||||
file = File {
|
file = File {
|
||||||
cfile: C._wfopen(wpath, mode.to_wide())
|
cfile: C._wfopen(wpath, mode.to_wide())
|
||||||
}
|
}
|
||||||
} $else {
|
} $else {
|
||||||
|
@ -310,7 +310,7 @@ pub fn open_append(path string) ?File {
|
||||||
$if windows {
|
$if windows {
|
||||||
wpath := path.replace('/', '\\').to_wide()
|
wpath := path.replace('/', '\\').to_wide()
|
||||||
mode := 'ab'
|
mode := 'ab'
|
||||||
file = File {
|
file = File {
|
||||||
cfile: C._wfopen(wpath, mode.to_wide())
|
cfile: C._wfopen(wpath, mode.to_wide())
|
||||||
}
|
}
|
||||||
} $else {
|
} $else {
|
||||||
|
@ -384,7 +384,7 @@ fn posix_wait4_to_exit_status(waitret int) (int,bool) {
|
||||||
if C.WIFEXITED( waitret ) {
|
if C.WIFEXITED( waitret ) {
|
||||||
ret = C.WEXITSTATUS( waitret )
|
ret = C.WEXITSTATUS( waitret )
|
||||||
is_signaled = false
|
is_signaled = false
|
||||||
} else if C.WIFSIGNALED( waitret ){
|
} else if C.WIFSIGNALED( waitret ){
|
||||||
ret = C.WTERMSIG( waitret )
|
ret = C.WTERMSIG( waitret )
|
||||||
is_signaled = true
|
is_signaled = true
|
||||||
}
|
}
|
||||||
|
@ -411,10 +411,10 @@ pub:
|
||||||
|
|
||||||
// `system` works like `exec()`, but only returns a return code.
|
// `system` works like `exec()`, but only returns a return code.
|
||||||
pub fn system(cmd string) int {
|
pub fn system(cmd string) int {
|
||||||
if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
//if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
||||||
// TODO remove panic
|
// TODO remove panic
|
||||||
panic(';, &&, || and \\n are not allowed in shell commands')
|
//panic(';, &&, || and \\n are not allowed in shell commands')
|
||||||
}
|
//}
|
||||||
mut ret := int(0)
|
mut ret := int(0)
|
||||||
$if windows {
|
$if windows {
|
||||||
// overcome bug in system & _wsystem (cmd) when first char is quote `"`
|
// overcome bug in system & _wsystem (cmd) when first char is quote `"`
|
||||||
|
@ -472,7 +472,7 @@ pub fn sigint_to_signal_name(si int) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
// `getenv` returns the value of the environment variable named by the key.
|
// `getenv` returns the value of the environment variable named by the key.
|
||||||
pub fn getenv(key string) string {
|
pub fn getenv(key string) string {
|
||||||
$if windows {
|
$if windows {
|
||||||
s := C._wgetenv(key.to_wide())
|
s := C._wgetenv(key.to_wide())
|
||||||
if s == 0 {
|
if s == 0 {
|
||||||
|
@ -503,7 +503,7 @@ pub fn setenv(name string, value string, overwrite bool) int {
|
||||||
|
|
||||||
pub fn unsetenv(name string) int {
|
pub fn unsetenv(name string) int {
|
||||||
$if windows {
|
$if windows {
|
||||||
format := '${name}='
|
format := '${name}='
|
||||||
return C._putenv(format.str)
|
return C._putenv(format.str)
|
||||||
} $else {
|
} $else {
|
||||||
return C.unsetenv(name.str)
|
return C.unsetenv(name.str)
|
||||||
|
@ -535,7 +535,7 @@ pub fn rm(path string) {
|
||||||
// rmdir removes a specified directory.
|
// rmdir removes a specified directory.
|
||||||
pub fn rmdir(path string) {
|
pub fn rmdir(path string) {
|
||||||
$if !windows {
|
$if !windows {
|
||||||
C.rmdir(path.str)
|
C.rmdir(path.str)
|
||||||
}
|
}
|
||||||
$else {
|
$else {
|
||||||
C.RemoveDirectory(path.to_wide())
|
C.RemoveDirectory(path.to_wide())
|
||||||
|
@ -834,7 +834,7 @@ pub fn chdir(path string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// getwd returns the absolute path name of the current directory.
|
// getwd returns the absolute path name of the current directory.
|
||||||
pub fn getwd() string {
|
pub fn getwd() string {
|
||||||
$if windows {
|
$if windows {
|
||||||
max := 512 // MAX_PATH * sizeof(wchar_t)
|
max := 512 // MAX_PATH * sizeof(wchar_t)
|
||||||
buf := &u16(calloc(max*2))
|
buf := &u16(calloc(max*2))
|
||||||
|
@ -864,12 +864,12 @@ pub fn realpath(fpath string) string {
|
||||||
ret = C._fullpath(fullpath, fpath.str, MAX_PATH)
|
ret = C._fullpath(fullpath, fpath.str, MAX_PATH)
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
return fpath
|
return fpath
|
||||||
}
|
}
|
||||||
} $else {
|
} $else {
|
||||||
ret = C.realpath(fpath.str, fullpath)
|
ret = C.realpath(fpath.str, fullpath)
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
return fpath
|
return fpath
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return string(fullpath)
|
return string(fullpath)
|
||||||
}
|
}
|
||||||
|
@ -1020,4 +1020,4 @@ pub fn tmpdir() string {
|
||||||
|
|
||||||
pub fn chmod(path string, mode int) {
|
pub fn chmod(path string, mode int) {
|
||||||
C.chmod(path.str, mode)
|
C.chmod(path.str, mode)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,7 @@ pub fn init_os_args(argc int, argv &byteptr) []string {
|
||||||
mut args := []string
|
mut args := []string
|
||||||
for i in 0 .. argc {
|
for i in 0 .. argc {
|
||||||
args << string(argv[i])
|
args << string(argv[i])
|
||||||
}
|
}
|
||||||
return args
|
return args
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ pub fn dir_exists(path string) bool {
|
||||||
/*
|
/*
|
||||||
$if linux {
|
$if linux {
|
||||||
C.syscall(4, path.str) // sys_newstat
|
C.syscall(4, path.str) // sys_newstat
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
dir := C.opendir(path.str)
|
dir := C.opendir(path.str)
|
||||||
res := !isnil(dir)
|
res := !isnil(dir)
|
||||||
|
@ -73,9 +73,9 @@ pub fn mkdir(path string) ?bool {
|
||||||
|
|
||||||
// exec starts the specified command, waits for it to complete, and returns its output.
|
// exec starts the specified command, waits for it to complete, and returns its output.
|
||||||
pub fn exec(cmd string) ?Result {
|
pub fn exec(cmd string) ?Result {
|
||||||
if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
//if cmd.contains(';') || cmd.contains('&&') || cmd.contains('||') || cmd.contains('\n') {
|
||||||
return error(';, &&, || and \\n are not allowed in shell commands')
|
//return error(';, &&, || and \\n are not allowed in shell commands')
|
||||||
}
|
//}
|
||||||
pcmd := '$cmd 2>&1'
|
pcmd := '$cmd 2>&1'
|
||||||
f := vpopen(pcmd)
|
f := vpopen(pcmd)
|
||||||
if isnil(f) {
|
if isnil(f) {
|
||||||
|
|
Loading…
Reference in New Issue