mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: make ./v symlink
work platform independent in CI (part 1) (#21453)
This commit is contained in:
parent
02d123a667
commit
6cda618ead
2 changed files with 22 additions and 6 deletions
14
.github/workflows/check_symlink_works.yml
vendored
14
.github/workflows/check_symlink_works.yml
vendored
|
@ -16,18 +16,20 @@ concurrency:
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-sudo:
|
test:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-20.04, macos-13]
|
os: [ubuntu-20.04, macos-13, windows-2019]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Build V
|
- name: Build and symlink (Windows)
|
||||||
run: make -j4
|
if: runner.os == 'Windows'
|
||||||
- name: Symlink
|
run: ./make.bat && ./v symlink
|
||||||
run: sudo ./v symlink
|
- name: Build and symlink
|
||||||
|
if: runner.os != 'Windows'
|
||||||
|
run: make -j4 && sudo ./v symlink
|
||||||
- name: Check if V is usable
|
- name: Check if V is usable
|
||||||
run: |
|
run: |
|
||||||
pwd
|
pwd
|
||||||
|
|
|
@ -83,6 +83,20 @@ fn setup_symlink() {
|
||||||
warn_and_exit('You might need to run this again to have the `v` command in your %PATH%')
|
warn_and_exit('You might need to run this again to have the `v` command in your %PATH%')
|
||||||
}
|
}
|
||||||
C.RegCloseKey(reg_sys_env_handle)
|
C.RegCloseKey(reg_sys_env_handle)
|
||||||
|
if os.getenv('GITHUB_JOB') != '' {
|
||||||
|
// Append V's install location to GITHUBs PATH environment variable.
|
||||||
|
// Resources:
|
||||||
|
// 1. https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#environment-files
|
||||||
|
// 2. https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable
|
||||||
|
mut content := os.read_file(os.getenv('GITHUB_PATH')) or {
|
||||||
|
eprintln('The `GITHUB_PATH` env variable is not defined.')
|
||||||
|
exit(1)
|
||||||
|
}
|
||||||
|
content += '\n${new_sys_env_path}\n'
|
||||||
|
os.write_file(os.getenv('GITHUB_PATH'), content) or {
|
||||||
|
panic('Failed to write to GITHUB_PATH.')
|
||||||
|
}
|
||||||
|
}
|
||||||
println('Done.')
|
println('Done.')
|
||||||
println('Note: Restart your shell/IDE to load the new %PATH%.')
|
println('Note: Restart your shell/IDE to load the new %PATH%.')
|
||||||
println('After restarting your shell/IDE, give `v version` a try in another directory!')
|
println('After restarting your shell/IDE, give `v version` a try in another directory!')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue