Skip to content

Commit 59a8889

Browse files
authored
ci: use ubuntu-latest instead of ubuntu-20.04 (which is now scheduled for retirement) (#160)
1 parent aa055e5 commit 59a8889

File tree

7 files changed

+23
-7
lines changed

7 files changed

+23
-7
lines changed

.github/workflows/analyzer_tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
include:
2828
- os: macos-latest
2929
cc: clang
30-
- os: ubuntu-20.04
30+
- os: ubuntu-latest
3131
cc: gcc
3232
- os: windows-latest
3333
cc: gcc

.github/workflows/build_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
build:
2929
strategy:
3030
matrix:
31-
os: [ubuntu-20.04, macos-latest, windows-latest]
31+
os: [ubuntu-latest, macos-latest, windows-latest]
3232
mode: [debug, dev, release]
3333
fail-fast: false
3434

.github/workflows/install_ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
install:
1313
strategy:
1414
matrix:
15-
os: [ubuntu-20.04, macos-latest, windows-latest]
15+
os: [ubuntu-latest, macos-latest, windows-latest]
1616
fail-fast: false
1717

1818
runs-on: ${{ matrix.os }}

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ concurrency:
1818

1919
jobs:
2020
fmt:
21-
runs-on: ubuntu-20.04
21+
runs-on: ubuntu-latest
2222

2323
steps:
2424
- name: Install V

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
os: windows-latest
3434
bin_ext: .exe
3535
- target: linux-x86_64
36-
os: ubuntu-20.04
36+
os: ubuntu-latest
3737
- target: darwin-x86_64
3838
os: macos-latest
3939
vflags: -d cross_compile_macos_x86_64

.github/workflows/version_test.vv

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ fn test_version() {
66
eprintln('WARNING: expecting usage in combination with CI workflow.')
77
}
88

9-
git_ref := os.getenv('GITHUB_WORKFLOW_SHA').trim_space()[..7]
9+
for k, v in os.environ() {
10+
println('>>> env key: ${k} | value: ${v}')
11+
}
12+
13+
sha := os.getenv('GITHUB_WORKFLOW_SHA')
14+
assert sha.len > 10
15+
git_ref := sha.trim_space()[..7]
16+
1017
manifest := vmod.decode(@VMOD_FILE)!
1118
assert manifest.name == 'v-analyzer'
1219

build.vsh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ import src.metadata
1111

1212
const vexe = @VEXE
1313
const bin_path = './bin/v-analyzer' + $if windows { '.exe' } $else { '' }
14-
const build_commit = os.execute('git rev-parse --short HEAD').output.trim_space()
1514
const build_time = time.now()
15+
const build_commit = get_build_commit()
1616
const build_datetime = build_time.format_ss()
17+
1718
const gcheck = term.bold(term.green('✓'))
1819
const ynote = term.bold(term.gray('ⓘ '))
1920
const is_nixos = os.exists('/etc/NIXOS')
@@ -24,6 +25,14 @@ enum ReleaseMode {
2425
dev
2526
}
2627

28+
fn get_build_commit() string {
29+
// In pull requests, GA creates a merge commit, to test the latest changes,
30+
// as if they would have been merged in the main branch. However for building
31+
// and version checking, we need the commit hash of the actual last change in the PR.
32+
committish := os.getenv_opt('GITHUB_WORKFLOW_SHA') or { 'HEAD' }
33+
return os.execute('git rev-parse --short ${committish}').output.trim_space()
34+
}
35+
2736
fn eline(msg string) {
2837
eprintln('${term.bold(term.red('[ERROR]'))} ${msg}')
2938
}

0 commit comments

Comments
 (0)