Skip to content

Commit

Permalink
playing with the workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
recipe committed Feb 19, 2024
1 parent 9e5abfe commit d05667c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ jobs:
- uses: actions/checkout@v3

- name: Set up stored functions
run: |
cat ./semver.sql
mysql -uroot -proot test_db < ./semver.sql
run: mysql -uroot -proot test_db < ./semver.sql

- name: Run tests
run: if mysql -uroot -proot test_db < ./tests.sql | grep -q 'column'; then exit 1; fi
Expand Down
3 changes: 1 addition & 2 deletions semver.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@ CREATE FUNCTION `SEMANTIC_VERSION`(version VARCHAR(255)) RETURNS VARCHAR(255)
NO SQL
SQL SECURITY INVOKER
BEGIN
DECLARE re VARCHAR(255) DEFAULT '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$';
DECLARE sem_ver VARCHAR(255) DEFAULT NULL;

IF version IS NULL THEN
RETURN NULL;
END IF;

SET sem_ver = REGEXP_REPLACE(version, re, '$1,$2,$3,$4,$5');
SET sem_ver = REGEXP_REPLACE(version, '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$', '$1,$2,$3,$4,$5');

IF version = sem_ver THEN
SET sem_ver = NULL;
Expand Down

0 comments on commit d05667c

Please sign in to comment.