Skip to content

Commit cc9a69a

Browse files
authored
Merge pull request #95 from cipherstash/add-version-function
feat: Add cs_eql_version function
2 parents 2e9e808 + 5427616 commit cc9a69a

File tree

9 files changed

+28
-1
lines changed

9 files changed

+28
-1
lines changed

Diff for: .github/workflows/release-eql.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Build EQL release
3939
run: |
40-
mise run build
40+
mise run build --version ${{github.event.release.tag_name}}
4141
4242
- name: Upload EQL artifacts
4343
uses: actions/upload-artifact@v4

Diff for: .gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Based on https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
22

3+
sql/000-version.sql
4+
35
# Logs
46

57
logs

Diff for: sql/000-ore.sql renamed to sql/001-ore.sql

File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: tasks/000-version-template.sql

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
DROP FUNCTION IF EXISTS cs_eql_version();
2+
3+
CREATE FUNCTION cs_eql_version()
4+
RETURNS text
5+
IMMUTABLE STRICT PARALLEL SAFE
6+
AS $$
7+
SELECT '$RELEASE_VERSION';
8+
$$ LANGUAGE SQL;
9+

Diff for: tasks/build.sh

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#MISE alias="b"
44
#MISE sources=["sql/*.sql"]
55
#MISE outputs=["release/cipherstash-encrypt.sql","release/cipherstash-encrypt-uninstall.sql"]
6+
#USAGE flag "--version <version>" help="Specify release version of EQL" default="DEV"
67

78
#!/bin/bash
89

@@ -13,6 +14,12 @@ mkdir -p release
1314
rm -f release/cipherstash-encrypt-uninstall.sql
1415
rm -f release/cipherstash-encrypt.sql
1516

17+
rm -f sql/000-version.sql
18+
19+
RELEASE_VERSION=${usage_version}
20+
sed "s/\$RELEASE_VERSION/$RELEASE_VERSION/g" tasks/000-version-template.sql > sql/000-version.sql
21+
22+
1623
# Collect all the drops
1724
# In reverse order (tac) so that we drop the constraints before the tables
1825
grep -h -E '^(DROP)' sql/0*-*.sql | tac > release/cipherstash-encrypt-tmp-drop-install.sql

Diff for: tasks/test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ mise run build
3737
mise run reset --postgres ${POSTGRES_VERSION}
3838

3939
# tests
40+
run_test tests/version.sql
4041
run_test tests/core.sql
4142
run_test tests/core-functions.sql
4243
run_test tests/config.sql

Diff for: tests/version.sql

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
\set ON_ERROR_STOP on
2+
3+
DO $$
4+
BEGIN
5+
ASSERT (SELECT true WHERE cs_eql_version() = 'DEV');
6+
7+
END;
8+
$$ LANGUAGE plpgsql;

0 commit comments

Comments
 (0)