| 1 | name: V Apps and Modules |
| 2 | |
| 3 | on: |
| 4 | push: |
| 5 | branches: |
| 6 | - master |
| 7 | paths-ignore: |
| 8 | - '**.md' |
| 9 | - '**.yml' |
| 10 | - '!**/v_apps_and_modules_compile_ci.yml' |
| 11 | - 'examples/**' |
| 12 | - 'cmd/tools/vrepl.v' |
| 13 | pull_request: |
| 14 | paths-ignore: |
| 15 | - '**.md' |
| 16 | - '**.yml' |
| 17 | - '!**/v_apps_and_modules_compile_ci.yml' |
| 18 | - 'examples/**' |
| 19 | - 'cmd/tools/vrepl.v' |
| 20 | |
| 21 | concurrency: |
| 22 | group: v_apps-${{ github.workflow }}-${{ github.ref == 'refs/heads/master' && github.sha || github.ref }} |
| 23 | cancel-in-progress: true |
| 24 | |
| 25 | jobs: |
| 26 | v-apps-compile: |
| 27 | strategy: |
| 28 | matrix: |
| 29 | os: [ubuntu-latest, macos-14] |
| 30 | fail-fast: false |
| 31 | runs-on: ${{ matrix.os }} |
| 32 | timeout-minutes: 60 |
| 33 | steps: |
| 34 | - uses: actions/checkout@v6 |
| 35 | |
| 36 | - name: Cache apt packages |
| 37 | if: runner.os == 'Linux' |
| 38 | uses: ./.github/actions/cache-apt-packages-action |
| 39 | |
| 40 | - name: Cache Homebrew downloads |
| 41 | if: runner.os == 'macOS' |
| 42 | uses: actions/cache@v5 |
| 43 | with: |
| 44 | path: ~/Library/Caches/Homebrew |
| 45 | key: brew-${{ matrix.os }}-v_apps-${{ hashFiles('.github/workflows/v_apps_and_modules_compile_ci.yml') }} |
| 46 | restore-keys: | |
| 47 | brew-${{ matrix.os }}-v_apps- |
| 48 | brew-${{ matrix.os }}- |
| 49 | |
| 50 | - name: Build V |
| 51 | id: build |
| 52 | run: make && sudo ./v symlink |
| 53 | |
| 54 | - name: Install dependencies |
| 55 | run: | |
| 56 | if [ "$RUNNER_OS" == 'Linux' ]; then |
| 57 | .github/workflows/disable_azure_mirror.sh |
| 58 | v retry -- sudo apt -qq update |
| 59 | v retry -- sudo apt -qq install libgc-dev libsodium-dev libssl-dev sqlite3 libsqlite3-dev |
| 60 | v retry -- sudo apt -qq install libfreetype6-dev libxi-dev libxcursor-dev libgl-dev libxrandr-dev libasound2-dev xfonts-75dpi xfonts-base libegl-dev libharfbuzz-dev libfribidi-dev libfontconfig1-dev libpango1.0-dev libglib2.0-dev libdbus-1-dev |
| 61 | v retry -- sudo apt -qq install sassc libgit2-dev # needed by gitly |
| 62 | v retry -- sudo apt -qq install libunwind-18-dev # needed by v-analyzer for libbacktrace |
| 63 | else |
| 64 | v retry brew install sassc libgit2 libsodium pango fribidi pkg-config |
| 65 | fi |
| 66 | |
| 67 | - name: Build docs generator |
| 68 | run: | |
| 69 | v retry -- v install markdown |
| 70 | v retry -- git clone https://github.com/vlang/docs --branch generator --depth 1 |
| 71 | cd docs |
| 72 | v . |
| 73 | |
| 74 | - name: Test vtcc |
| 75 | if: runner.os == 'macOS' |
| 76 | run: .github/workflows/compile_v_with_vtcc.sh |
| 77 | |
| 78 | - name: Test vsql compilation and examples |
| 79 | if: ${{ false && !cancelled() && steps.build.outcome == 'success' }} |
| 80 | run: | |
| 81 | echo "Install vsql" |
| 82 | v retry -- v install elliotchance.vsql |
| 83 | cd ~/.vmodules/elliotchance/vsql |
| 84 | echo "Compile vsql" |
| 85 | make bin/vsql |
| 86 | echo "Run examples" |
| 87 | make examples |
| 88 | echo "Run vsql/connection_test.v" |
| 89 | v vsql/connection_test.v |
| 90 | |
| 91 | - name: Test vlang/gui |
| 92 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 93 | run: .github/workflows/compile_vlang_gui_examples.sh |
| 94 | - name: Test discord.v |
| 95 | if: ${{ false && !cancelled() && steps.build.outcome == 'success' }} # disabled: upstream uses deprecated json2.raw_decode |
| 96 | run: .github/workflows/compile_discordv.sh |
| 97 | - name: Build herolib |
| 98 | if: ${{ false && !cancelled() && steps.build.outcome == 'success' }} |
| 99 | run: .github/workflows/compile_herolib.sh |
| 100 | - name: Build vlang/vab |
| 101 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 102 | run: | |
| 103 | echo "Install VAB" |
| 104 | v retry -- v install vab |
| 105 | echo "Build vab" |
| 106 | v ~/.vmodules/vab |
| 107 | echo "Build vab with -g" |
| 108 | v -g ~/.vmodules/vab |
| 109 | |
| 110 | - name: Build vlang/ved |
| 111 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 112 | run: | |
| 113 | v retry -- git clone --depth 1 https://github.com/vlang/ved |
| 114 | cd ved && v -o ved . |
| 115 | echo "Build" |
| 116 | v . |
| 117 | echo "Build with -autofree ..." |
| 118 | v -autofree . |
| 119 | echo "Build with -prod ..." |
| 120 | v -prod . |
| 121 | cd .. |
| 122 | |
| 123 | - name: Build vlang/pdf |
| 124 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 125 | run: | |
| 126 | v retry -- v install pdf |
| 127 | echo "PDF examples should compile" |
| 128 | v should-compile-all ~/.vmodules/pdf/examples |
| 129 | |
| 130 | - name: Build vlang/libsodium |
| 131 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 132 | run: | |
| 133 | echo "Install the libsodium wrapper" |
| 134 | v retry -- v install libsodium |
| 135 | echo "Test libsodium" |
| 136 | VJOBS=1 v test ~/.vmodules/libsodium |
| 137 | |
| 138 | - name: Build vlang/coreutils |
| 139 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 140 | run: | |
| 141 | echo "Clone Coreutils" |
| 142 | v retry -- git clone --depth 1 https://github.com/vlang/coreutils /tmp/coreutils |
| 143 | echo "Build Coreutils" |
| 144 | cd /tmp/coreutils; make |
| 145 | |
| 146 | - name: Build vlang/gitly |
| 147 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 148 | run: | |
| 149 | echo "Install markdown" |
| 150 | v retry -- v install markdown |
| 151 | echo "Install pcre" |
| 152 | v retry -- v install pcre |
| 153 | echo "Clone Gitly" |
| 154 | v retry -- git clone https://github.com/vlang/gitly /tmp/gitly |
| 155 | echo "Build Gitly" |
| 156 | v -cc gcc /tmp/gitly |
| 157 | ## echo "Build Gitly with -autofree" |
| 158 | ## v -cc gcc -autofree /tmp/gitly |
| 159 | echo "Compile gitly.css from gitly.scss" |
| 160 | sassc /tmp/gitly/static/css/gitly.scss > /tmp/gitly/static/css/gitly.css |
| 161 | # echo "Run first_run.v" |
| 162 | # v -cc gcc run /tmp/gitly/tests/first_run.v |
| 163 | # # /tmp/gitly/gitly -ci_run |
| 164 | |
| 165 | - name: Build V UI examples |
| 166 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 167 | run: | |
| 168 | v retry -- v install ui |
| 169 | v -no-parallel ~/.vmodules/ui/examples/rectangles.v |
| 170 | v -no-parallel ~/.vmodules/ui/examples/users.v |
| 171 | # v run ~/.vmodules/ui/examples/build_examples.vsh |
| 172 | |
| 173 | - name: Build vlang/v-analyzer |
| 174 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 175 | run: | |
| 176 | echo "Clone v-analyzer" |
| 177 | v retry -- git clone --depth=1 --branch=master --filter=blob:none --recursive --shallow-submodules https://github.com/vlang/v-analyzer /tmp/v-analyzer |
| 178 | cd /tmp/v-analyzer |
| 179 | echo "Installing dependencies" |
| 180 | v install |
| 181 | echo "Build v-analyzer debug" |
| 182 | v build.vsh debug |
| 183 | echo "Build v-analyzer release" |
| 184 | v build.vsh release |
| 185 | |
| 186 | - name: Format vlang/v-analyzer |
| 187 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 188 | run: | |
| 189 | cd /tmp/v-analyzer |
| 190 | fmt_files=($(git ls-files '*.v' '*.vsh' ':!:metadata/stubs/*.v' ':!:src/metadata/stubs/*.v')) |
| 191 | set +e |
| 192 | v fmt -c "${fmt_files[@]}" |
| 193 | exit_code=$? |
| 194 | if [[ $exit_code -ne 0 && $exit_code -ne 5 ]]; then |
| 195 | # Don't fail if there are only internal errors (exit code 5). |
| 196 | v fmt -diff "${fmt_files[@]}" |
| 197 | exit 1 |
| 198 | fi |
| 199 | |
| 200 | - name: Build vlang/go2v |
| 201 | if: ${{ !cancelled() && steps.build.outcome == 'success' && matrix.os != 'macos-14' }} |
| 202 | run: | |
| 203 | echo "Clone Go2V" |
| 204 | v retry -- git clone --depth=1 https://github.com/vlang/go2v /tmp/go2v/ |
| 205 | echo "Build Go2V" |
| 206 | v /tmp/go2v/ |
| 207 | echo "Run Go2V tests" |
| 208 | VJOBS=1 v test /tmp/go2v/ |
| 209 | |
| 210 | - name: Install UI through VPM and make sure its examples compile |
| 211 | if: ${{ false && !cancelled() && steps.build.outcome == 'success' }} # disabled: upstream vlang/ui has unused parameter notices that fail with -N -W |
| 212 | run: | |
| 213 | echo "Official VPM modules should be installable" |
| 214 | v retry -- v install ui |
| 215 | echo "Examples of UI should compile" |
| 216 | v ~/.vmodules/ui/examples/build_examples.vsh |
| 217 | |
| 218 | - name: Build vlang/adventofcode |
| 219 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 220 | run: | |
| 221 | echo "Clone the AdventOfCode repo" |
| 222 | v retry -- git clone --depth 1 https://github.com/vlang/adventofcode /tmp/adventofcode |
| 223 | echo "Install dependencies" |
| 224 | v retry -- v install pcre |
| 225 | echo "Execute Tests" |
| 226 | cd /tmp/adventofcode && v run verify.v |
| 227 | |
| 228 | - name: Build vlang/msgpack |
| 229 | if: ${{ !cancelled() && steps.build.outcome == 'success' }} |
| 230 | run: | |
| 231 | echo "Install msgpack" |
| 232 | v retry -- v install msgpack |
| 233 | echo "Build msgpack" |
| 234 | v -shared ~/.vmodules/msgpack/ |
| 235 | echo "Run msgpack tests" |
| 236 | v test ~/.vmodules/msgpack/ |
| 237 | echo "MessagePack examples should compile" |
| 238 | v should-compile-all ~/.vmodules/msgpack/examples |
| 239 | |
| 240 | # - name: Build VEX |
| 241 | # if: ${{ !cancelled() }} && steps.build.outcome == 'success' |
| 242 | # run: | |
| 243 | # echo "Install Vex" |
| 244 | # v retry -- v install nedpals.vex |
| 245 | # echo "Compile all of the Vex examples" |
| 246 | # v should-compile-all ~/.vmodules/nedpals/vex/examples |
| 247 | # echo "Compile the simple Vex example" |
| 248 | # v ~/.vmodules/nedpals/vex/examples/simple_example.v |
| 249 | # echo "Run Vex Tests" |
| 250 | # v test ~/.vmodules/nedpals/vex |
| 251 | |
| 252 | vpm-site-compile: |
| 253 | strategy: |
| 254 | matrix: |
| 255 | os: [ubuntu-24.04, macos-14] |
| 256 | fail-fast: false |
| 257 | runs-on: ${{ matrix.os }} |
| 258 | timeout-minutes: 20 |
| 259 | steps: |
| 260 | - uses: actions/checkout@v6 |
| 261 | - name: Build V |
| 262 | run: make && ./v symlink |
| 263 | - name: Build vpm |
| 264 | run: | |
| 265 | v retry -- v install markdown |
| 266 | v retry -- git clone --depth 1 https://github.com/vlang/vpm |
| 267 | cd vpm && v . |
| 268 | |