diff --git a/.github/workflows/openbsd_ci.yml b/.github/workflows/openbsd_ci.yml new file mode 100644 index 0000000000..3f8badc064 --- /dev/null +++ b/.github/workflows/openbsd_ci.yml @@ -0,0 +1,102 @@ +name: CI OpenBSD + +on: + workflow_dispatch: + push: + paths-ignore: + - '**.md' + - '**.yml' + - 'cmd/tools/**' + - '!**/openbsd_ci.yml' + - '!ci/openbsd_ci.vsh' + - '!cmd/tools/builders/**.v' + pull_request: + paths-ignore: + - '**.md' + - '**.yml' + - 'cmd/tools/**' + - '!**/openbsd_ci.yml' + - '!ci/openbsd_ci.vsh' + - '!cmd/tools/builders/**.v' + +### See https://github.com/cross-platform-actions/action +### for a description of the used fields here + +jobs: + tcc-openbsd: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Tests on OpenBSD with tcc + id: tests-openbsd-tcc + uses: cross-platform-actions/action@v0.28.0 + with: + operating_system: openbsd + version: '7.7' + memory: 4G + shell: sh + sync_files: runner-to-vm + run: | + sudo pkg_add git sqlite3 gmake boehm-gc libiconv + # Mandatory: hostname not set in VM => some tests fail + sudo hostname -s openbsd-ci + echo "### OS infos" + uname -a + git config --global --add safe.directory . + gmake + sudo ./v symlink + export VFLAGS='-cc tcc -no-retry-compilation' + ./v run ci/openbsd_ci.vsh all + + clang-openbsd: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Tests on OpenBSD with clang + id: tests-openbsd-clang + uses: cross-platform-actions/action@v0.28.0 + with: + operating_system: openbsd + version: '7.7' + memory: 4G + shell: sh + sync_files: runner-to-vm + run: | + sudo pkg_add git sqlite3 gmake boehm-gc libiconv + # Mandatory: hostname not set in VM => some tests fail + sudo hostname -s openbsd-ci + echo "### OS infos" + uname -a + git config --global --add safe.directory . + gmake + sudo ./v symlink + export VFLAGS='-cc clang' + ./v run ci/openbsd_ci.vsh all + + gcc-openbsd: + runs-on: ubuntu-latest + timeout-minutes: 30 + steps: + - uses: actions/checkout@v4 + - name: Tests on OpenBSD with gcc + id: tests-openbsd-gcc + uses: cross-platform-actions/action@v0.28.0 + with: + operating_system: openbsd + version: '7.7' + memory: 4G + shell: sh + sync_files: runner-to-vm + run: | + sudo pkg_add git sqlite3 gmake boehm-gc libiconv gcc-11.2.0p15 + # Mandatory: hostname not set in VM => some tests fail + sudo hostname -s openbsd-ci + echo "### OS infos" + uname -a + git config --global --add safe.directory . + gmake + sudo ./v symlink + export VFLAGS='-cc egcc' + ./v run ci/openbsd_ci.vsh all diff --git a/ci/openbsd_ci.vsh b/ci/openbsd_ci.vsh new file mode 100644 index 0000000000..6e0df322e1 --- /dev/null +++ b/ci/openbsd_ci.vsh @@ -0,0 +1,59 @@ +import os +import common { Task, exec } + +fn v_doctor() { + dump(os.getenv('PATH')) + exec('v doctor') + if common.is_github_job { + exec('uname -mrs') + exec('sysctl hw.model') + exec('sysctl hw.ncpu') + exec('sysctl hw.physmem') + exec('sysctl hw.usermem') + exec('whoami') + exec('pwd') + exec('ls -la') + exec('git log -n1') + exec('cc --version') + } +} + +fn verify_v_test_works() { + exec('echo \$VFLAGS') + exec('v cmd/tools/test_if_v_test_system_works.v') + exec('./cmd/tools/test_if_v_test_system_works') +} + +fn build_fast_script() { + exec('cd cmd/tools/fast && v fast.v') +} + +fn check_math() { + exec('v -silent test vlib/math') + println('Test the math module, using only the pure V versions,') + println(' without the .c.v overrides.') + exec('v -silent -exclude @vlib/math/*.c.v test vlib/math') +} + +fn check_compress() { + exec('v -silent test vlib/compress') +} + +fn run_essential_tests() { + if common.is_github_job { + exec('VTEST_JUST_ESSENTIAL=1 v -silent test-self') + } else { + exec('VTEST_JUST_ESSENTIAL=1 v -progress test-self') + } +} + +const all_tasks = { + 'v_doctor': Task{v_doctor, 'Run v doctor'} + 'verify_v_test_works': Task{verify_v_test_works, 'Verify that v test works'} + 'build_fast_script': Task{build_fast_script, 'Check that building fast.v works'} + 'check_math': Task{check_math, 'Check the `math` module works'} + 'check_compress': Task{check_compress, 'Check the `compress` module works'} + 'run_essential_tests': Task{run_essential_tests, 'Run only the essential tests'} +} + +common.run(all_tasks)