v2 / .github / workflows / cross_ci.yml
138 lines · 121 sloc · 4.06 KB · a51ed8416224e15d17196584165f9fae71ec613f
Raw
1name: Cross CI
2
3on:
4 push:
5 paths-ignore:
6 - '**.md'
7 - '**.yml'
8 - '!**/cross_ci.yml'
9 - 'cmd/tools/**'
10 - '!cmd/tools/builders/**.v'
11 pull_request:
12 paths-ignore:
13 - '**.md'
14 - '**.yml'
15 - '!**/cross_ci.yml'
16 - 'cmd/tools/**'
17 - '!cmd/tools/builders/**.v'
18
19concurrency:
20 group: cross-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }}
21 cancel-in-progress: true
22
23jobs:
24 cross-macos:
25 runs-on: macos-latest
26 timeout-minutes: 20
27 env:
28 VFLAGS: -cc clang
29 steps:
30 - uses: actions/checkout@v6
31 with:
32 fetch-depth: 10
33 - name: Cache Homebrew downloads
34 uses: actions/cache@v4
35 with:
36 path: ~/Library/Caches/Homebrew
37 key: brew-cross-macos-${{ hashFiles('.github/workflows/cross_ci.yml') }}
38 restore-keys: |
39 brew-cross-macos-
40 - name: Build V
41 run: make -j4 && ./v symlink
42
43 - name: Install dependencies
44 run: |
45 ./v retry -- brew install mingw-w64
46 export LIBRARY_PATH="$LIBRARY_PATH:/usr/local/opt/openssl/lib/"
47
48 - name: Test symlink
49 run: ./v symlink
50
51 - name: Cross-compilation to Linux
52 run: |
53 ./v -os linux cmd/v
54 # TODO: fix this: ./v -os linux examples/2048/2048.v
55
56 - name: Cross-compilation of veb app to Linux with -d use_openssl
57 run: ./v -d use_openssl -os linux examples/veb/veb_example.v
58
59 - name: Cross-compilation of vlang/gitly to Linux with -d use_openssl
60 run: |
61 ./v retry -- ./v install markdown
62 ./v retry -- ./v install pcre
63 ./v retry -- git clone --depth 1 https://github.com/vlang/gitly /tmp/gitly
64 ./v -d use_openssl -os linux /tmp/gitly
65 file /tmp/gitly/gitly
66
67 - name: Cross-compilation to Windows
68 run: |
69 ./v -os windows cmd/v
70 ./v -os windows examples/2048/2048.v
71
72 cross-linux:
73 runs-on: ubuntu-24.04
74 timeout-minutes: 20
75 env:
76 VFLAGS: -cc tcc -no-retry-compilation
77 steps:
78 - uses: actions/checkout@v6
79 with:
80 fetch-depth: 10
81 - uses: ./.github/actions/cache-apt-packages-action
82 - name: Build v
83 run: make -j4 && ./v symlink
84
85 - name: Install dependencies
86 run: |
87 .github/workflows/disable_azure_mirror.sh
88 ./v retry -- sudo apt update -y -qq
89 ./v retry -- sudo apt install --quiet -y mingw-w64 wine wine64 winetricks libssl-dev sqlite3 libsqlite3-dev
90
91 - name: Show diagnostics for wine
92 run: |
93 which wine
94 # shellcheck disable=SC2046
95 ls -la $(realpath $(which wine))
96
97 - name: v.c can be compiled and run with -os cross
98 run: |
99 ./v -os cross -o /tmp/v.c cmd/v
100 gcc -g -std=gnu11 -w -o v_from_vc /tmp/v.c -lm -lpthread
101 ls -lart v_from_vc
102 ./v_from_vc version
103
104 - name: v_win.c can be compiled and run with -os windows
105 run: |
106 ./v -cc msvc -os windows -o /tmp/v_win.c cmd/v
107 x86_64-w64-mingw32-gcc /tmp/v_win.c -std=c99 -w -municode -o v_from_vc.exe -lws2_32 -Wl,-stack=33554432
108 ls -lart v_from_vc.exe
109 wine ./v_from_vc.exe version
110
111 - name: hello_world.v can be cross compiled to hello_world.exe
112 run: |
113 ./v -os windows examples/hello_world.v
114 ls -lart examples/hello_world.exe
115 wine examples/hello_world.exe
116
117 - name: 2048.v can be cross compiled to 2048.exe
118 run: |
119 ./v -os windows examples/2048/2048.v
120 ls -lart examples/2048/2048.exe
121
122 cross-windows:
123 runs-on: windows-2025
124 timeout-minutes: 20
125 steps:
126 - uses: actions/checkout@v6
127 - name: Build
128 run: |
129 echo %VFLAGS%
130 echo $VFLAGS
131 .\makev.bat -msvc
132 - name: TODO v_win.c can be compiled and run with -os windows
133 run: |
134 .\v.exe -os windows -cc msvc -showcc -o v2.exe cmd\v
135 .\v.exe -os windows -cc msvc -o v_win.c cmd\v
136 dir v2.exe
137 dir v_win.c
138 .\v2.exe version
139