Skip to content

Commit 8872d33

Browse files
Baltolirv-auditor
andauthored
Bump versions and cut releases (#1035)
This is a follow-up PR to #1034 that implements version bumping on each PR, and propagates that version information into places in the build system where it's required. Additionally, it adds a CI job on release that tags a GitHub release with the appropriate metadata. Eventually, we will be attaching a `.deb` build to that release, but for now it's just a tag. --------- Co-authored-by: devops <[email protected]>
1 parent 1b5ad2e commit 8872d33

File tree

7 files changed

+41
-12
lines changed

7 files changed

+41
-12
lines changed

.github/workflows/release.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ jobs:
1111
runs-on: ubuntu-latest
1212
environment: production
1313
steps:
14+
- name: 'Make release'
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
run: |
18+
set -x
19+
VERSION=v$(cat package/version)
20+
gh release create ${VERSION} --target ${{ github.sha }}
1421
- name: 'Update dependents'
1522
env:
1623
GITHUB_TOKEN: ${{ secrets.JENKINS_GITHUB_PAT }}

.github/workflows/test.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,32 @@ concurrency:
66
cancel-in-progress: true
77

88
jobs:
9+
10+
version-bump:
11+
name: 'Version Bump'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: 'Check out code'
15+
uses: actions/checkout@v3
16+
with:
17+
token: ${{ secrets.JENKINS_GITHUB_PAT }}
18+
# fetch-depth 0 means deep clone the repo
19+
fetch-depth: 0
20+
ref: ${{ github.event.pull_request.head.sha }}
21+
- name: 'Configure GitHub user'
22+
run: |
23+
git config user.name devops
24+
git config user.email [email protected]
25+
- name: 'Update version'
26+
run: |
27+
og_version=$(git show origin/${GITHUB_BASE_REF}:package/version)
28+
./package/version.sh bump ${og_version}
29+
./package/version.sh sub
30+
new_version=$(cat package/version)
31+
git add --update && git commit --message "Set Version: ${new_version}" || true
32+
- name: 'Push updates'
33+
run: git push origin HEAD:${GITHUB_HEAD_REF}
34+
935
compile-nix-flake:
1036
name: 'Nix flake'
1137
strategy:

flake.nix

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,6 @@
5959
cp -rv ${final.rapidjson-src}/* $out/deps/rapidjson
6060
cp -rv ${final.pybind11-src}/* $out/deps/pybind11
6161
'';
62-
63-
fixupPhase = ''
64-
substituteInPlace $out/tools/llvm-backend-version/version.inc.in \
65-
--replace '@LLVM_BACKEND_VERSION@' '${self.rev or "dirty"}'
66-
'';
6762
};
6863

6964
llvm-backend-matching-src = prev.lib.cleanSource

nix/llvm-backend.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ cmakeBuildType ? "FastBuild" # optimized release build, currently: LTO
88
let python-env = (python310.withPackages (ps: with ps; [ pybind11 ])); in
99
stdenv.mkDerivation {
1010
pname = "llvm-backend";
11-
version = "0";
11+
version = "${lib.removeSuffix "\n" (builtins.readFile ../package/version)}";
12+
1213
inherit src cmakeBuildType;
1314

1415
nativeBuildInputs = [ cmake flex llvm pkg-config ];

package/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.0
1+
0.1.1

tools/llvm-backend-version/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
execute_process(
2-
COMMAND git rev-parse --short HEAD
3-
OUTPUT_VARIABLE LLVM_BACKEND_VERSION
4-
OUTPUT_STRIP_TRAILING_WHITESPACE
1+
file(
2+
READ "${PROJECT_SOURCE_DIR}/package/version"
3+
LLVM_BACKEND_VERSION
54
)
5+
string(STRIP "${LLVM_BACKEND_VERSION}" LLVM_BACKEND_VERSION)
66

77
configure_file(version.inc.in version.inc @ONLY)
88

tools/llvm-backend-version/version.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
using namespace llvm;
77

8-
cl::OptionCategory version_cat("kprint options");
8+
cl::OptionCategory version_cat("llvm-backend-version options");
99

1010
cl::opt<bool> llvm_library_version(
1111
"llvm", cl::desc("Print LLVM version rather than backend version"),

0 commit comments

Comments
 (0)