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