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