Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9307524

Browse files
committed
Adding publishing of project version updates
1 parent 7e87558 commit 9307524

4 files changed

Lines changed: 165 additions & 114 deletions

File tree

.github/workflows/build.yml

Lines changed: 152 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Deploy and test
22
env:
3+
#utPLSQL install env
34
UT3_DEVELOP_SCHEMA: UT3_DEVELOP
45
UT3_DEVELOP_SCHEMA_PASSWORD: ut3
56
UT3_RELEASE_VERSION_SCHEMA: UT3
@@ -11,22 +12,17 @@ env:
1112
UT3_TESTER_HELPER: UT3_TESTER_HELPER
1213
UT3_TESTER_HELPER_PASSWORD: ut3
1314
UT3_TABLESPACE: users
15+
#Build env
1416
BUILD_DIR: ${{github.workspace}}
1517
JOB_ID: ${{github.run_id}}
1618
JOB_NUMBER: ${{github.run_number}}
17-
PULL_REQUEST_NAME: ${github.head_ref}
19+
PULL_REQUEST_NAME: ${{github.head_ref}}
1820
PULL_REQUEST_BRANCH: ${{github.head_ref}}
1921
TAG_NAME: ${TRAVIS_TAG}
2022
REPO_SLUG: ${{github.repository}}
2123
PR_SLUG: ${{github.repository}}
2224
UTPLSQL_REPO: "utPLSQL/utPLSQL"
2325
UTPLSQL_BUILD_NO_OFFSET: 3563
24-
UTPLSQL_BUILD_NO: $( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )
25-
UTPLSQL_VERSION: $(. .travis/get_project_version.sh)
26-
UTPLSQL_BUILD_VERSION: $(. .travis/get_project_build_version.sh)
27-
UTPLSQL_SOURCES_DIR: 'source'
28-
UTPLSQL_BUILD_USER_NAME: "Travis CI"
29-
CACHE_DIR: $HOME/.cache
3026
# Database Env
3127
SQLCLI: "sqlplus"
3228
OJDBC_HOME: ${{github.workspace}}/ojdbc
@@ -51,52 +47,120 @@ on:
5147
workflow_dispatch:
5248

5349
jobs:
54-
build:
55-
56-
env:
57-
ORACLE_VERSION: ${{matrix.oracle-version}}
58-
CONNECTION_STR: ${{matrix.connection-str}}
59-
ORACLE_PASSWORD: oracle
60-
DOCKER_VOLUME: ${{matrix.docker-volume}}
61-
DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR"
6250

51+
# build:
52+
# env:
53+
# ORACLE_VERSION: ${{matrix.oracle-version}}
54+
# CONNECTION_STR: ${{matrix.connection-str}}
55+
# ORACLE_PASSWORD: oracle
56+
# DOCKER_VOLUME: ${{matrix.docker-volume}}
57+
# DOCKER_ENV: "-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR"
58+
#
59+
# runs-on: ubuntu-latest
60+
# strategy:
61+
# fail-fast: false
62+
# matrix:
63+
# include:
64+
# - oracle-version: "gvenzl/oracle-xe:11-full"
65+
# connection-str: '127.0.0.1:1521/XE'
66+
## TODO - need to add healthcheck.sh into our containers
67+
## - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small"
68+
## connection-str: '127.0.0.1:1521/ORCLCDB'
69+
## - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small"
70+
## connection-str: '127.0.0.1:1521/ORCLCDB'
71+
# - oracle-version: "gvenzl/oracle-xe:18-slim"
72+
# connection-str: '127.0.0.1:1521/XE'
73+
## - oracle-version: "utplsqlv3/oracledb:18c-se2-small"
74+
## connection-str: '127.0.0.1:1521/ORCLCDB'
75+
## - oracle-version: "utplsqlv3/oracledb:19c-se2-small"
76+
## connection-str: '127.0.0.1:1521/ORCLCDB'
77+
# - oracle-version: "gvenzl/oracle-xe:21-slim"
78+
# connection-str: '127.0.0.1:1521/XE'
79+
#
80+
# services:
81+
# oracle:
82+
# image: ${{matrix.oracle-version}}
83+
# env:
84+
# ORACLE_PASSWORD: oracle
85+
## credentials:
86+
## username: ${{ secrets.DOCKER_USER }}
87+
## password: ${{ secrets.DOCKER_PASSWORD }}
88+
# ports:
89+
# - 1521:1521
90+
# options: >-
91+
# --health-cmd healthcheck.sh
92+
# --health-interval 10s
93+
# --health-timeout 5s
94+
# --health-retries 10
95+
# -e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR
96+
#
97+
# steps:
98+
# - uses: actions/checkout@v2
99+
# with:
100+
# fetch-depth: 0
101+
#
102+
# - uses: nelonoel/[email protected]
103+
#
104+
# - name: Set dynamic environment variables
105+
# run: |
106+
# echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV
107+
# echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV
108+
# echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV
109+
# shell: bash
110+
#
111+
# - name: Set buid version number
112+
# run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV
113+
# shell: bash
114+
#
115+
# - name: print variables
116+
# run: |
117+
# echo github.run_number is ${{ github.run_number }}
118+
# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO
119+
# echo UTPLSQL_VERSION is $UTPLSQL_VERSION
120+
# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION
121+
#
122+
# - name: Update project version & build number to verify that code is deployable after the update
123+
# run: .travis/update_project_version.sh
124+
#
125+
# - name: Download latest utPLSQL release
126+
# run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR
127+
#
128+
# - name: Add OJDBC home
129+
# run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar
130+
#
131+
# - name: Install utPLSQL-cli
132+
# run: curl -Lk -o utPLSQL-cli.zip "https://github.com/utPLSQL/utPLSQL-cli/releases/download/v3.1.8/utPLSQL-cli.zip" && unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli
133+
#
134+
# - name: Update privileges on sources
135+
# run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source}
136+
#
137+
# - name: Install utPLSQL
138+
# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh
139+
#
140+
# - name: Install utPLSQL release
141+
# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh
142+
#
143+
# - name: Run Examples
144+
# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh
145+
#
146+
# - name: Install tests
147+
# run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh
148+
#
149+
# - name: Run Tests
150+
# run: bash test/run_tests.sh
151+
#
152+
# - name: Validate utPLSQL reports format
153+
# run: bash .travis/validate_report_files.sh
154+
#
155+
# - name: SonarCloud Scan
156+
# uses: SonarSource/sonarcloud-github-action@master
157+
# env:
158+
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
159+
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
160+
161+
publish:
162+
# needs: build
63163
runs-on: ubuntu-latest
64-
strategy:
65-
fail-fast: false
66-
matrix:
67-
include:
68-
- oracle-version: "gvenzl/oracle-xe:11-full"
69-
connection-str: '127.0.0.1:1521/XE'
70-
# TODO - need to add healthcheck.sh into our containers
71-
# - oracle-version: "utplsqlv3/oracledb:12c-r1-se2-small"
72-
# connection-str: '127.0.0.1:1521/ORCLCDB'
73-
# - oracle-version: "utplsqlv3/oracledb:12c-r2-se2-small"
74-
# connection-str: '127.0.0.1:1521/ORCLCDB'
75-
- oracle-version: "gvenzl/oracle-xe:18-slim"
76-
connection-str: '127.0.0.1:1521/XE'
77-
# - oracle-version: "utplsqlv3/oracledb:18c-se2-small"
78-
# connection-str: '127.0.0.1:1521/ORCLCDB'
79-
# - oracle-version: "utplsqlv3/oracledb:19c-se2-small"
80-
# connection-str: '127.0.0.1:1521/ORCLCDB'
81-
- oracle-version: "gvenzl/oracle-xe:21-slim"
82-
connection-str: '127.0.0.1:1521/XE'
83-
84-
services:
85-
oracle:
86-
image: ${{matrix.oracle-version}}
87-
env:
88-
ORACLE_PASSWORD: oracle
89-
# credentials:
90-
# username: ${{ secrets.DOCKER_USER }}
91-
# password: ${{ secrets.DOCKER_PASSWORD }}
92-
ports:
93-
- 1521:1521
94-
options: >-
95-
--health-cmd healthcheck.sh
96-
--health-interval 10s
97-
--health-timeout 5s
98-
--health-retries 10
99-
-e SQLCLI=sqlplus -e UT3_DEVELOP_SCHEMA -e UT3_DEVELOP_SCHEMA_PASSWORD -e UT3_RELEASE_VERSION_SCHEMA -e UT3_RELEASE_VERSION_SCHEMA_PASSWORD -e UT3_USER -e UT3_USER_PASSWORD -e UT3_TESTER -e UT3_TESTER_PASSWORD -e UT3_TESTER_HELPER -e UT3_TESTER_HELPER_PASSWORD -e UT3_TABLESPACE -e ORACLE_PWD -e CONNECTION_STR -e UTPLSQL_DIR
100164

101165
steps:
102166
- uses: actions/checkout@v2
@@ -109,51 +173,44 @@ jobs:
109173
run: |
110174
echo "CURRENT_BRANCH=${BRANCH_NAME}" >> $GITHUB_ENV
111175
echo "UTPLSQL_BUILD_NO=$( expr ${{github.run_number}} + ${UTPLSQL_BUILD_NO_OFFSET} )" >> $GITHUB_ENV
112-
echo "UTPLSQL_VERSION=$(. .travis/get_project_version.sh)" >> $GITHUB_ENV
113-
echo UTPLSQL_BUILD_VERSION=$(sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}") >> $GITHUB_ENV
176+
echo "UTPLSQL_VERSION=$(.travis/get_project_version.sh)" >> $GITHUB_ENV
177+
shell: bash
114178

115-
# - name: print variables
116-
# run: |
117-
# echo github.run_number is ${{ github.run_number }}
118-
# echo UTPLSQL_BUILD_NO is $UTPLSQL_BUILD_NO
119-
# echo UTPLSQL_VERSION is $UTPLSQL_VERSION
120-
# echo UTPLSQL_BUILD_VERSION is $UTPLSQL_BUILD_VERSION
121-
122-
- name: Update project version & build number
123-
run: .travis/update_project_version.sh
124-
125-
- name: Download latest utPLSQL release
126-
run: git clone --depth=1 --branch=main https://github.com/utPLSQL/utPLSQL.git $UTPLSQL_DIR
127-
128-
- name: Add OJDBC home
129-
run: mkdir -p ${OJDBC_HOME} && curl -Lk -o ${OJDBC_HOME}/ojdbc8.jar ${OJDBC_URL}/ojdbc8.jar && curl -Lk -o ${OJDBC_HOME}/orai18n.jar ${OJDBC_URL}/orai18n.jar
130-
131-
- name: Install utPLSQL-cli
132-
run: curl -Lk -o utPLSQL-cli.zip "https://github.com/utPLSQL/utPLSQL-cli/releases/download/v3.1.8/utPLSQL-cli.zip" && unzip utPLSQL-cli.zip && chmod -R u+x utPLSQL-cli
133-
134-
- name: Update privileges on sources
135-
run: chmod -R go+w ./{source,test,examples,${UTPLSQL_DIR}/source}
179+
- name: Set buid version number
180+
run: echo UTPLSQL_BUILD_VERSION=$(echo ${UTPLSQL_VERSION} | sed -E "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)?/\1\2\3\.${UTPLSQL_BUILD_NO}\4/") >> $GITHUB_ENV
181+
shell: bash
136182

137-
- name: Install utPLSQL
138-
run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} .travis/install.sh
139183

140-
- name: Install utPLSQL release
141-
run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/install_utplsql_release.sh
184+
- name: Install MkDocs
185+
run: pip install mkdocs
142186

143-
- name: Run Examples
144-
run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./.travis/run_examples.sh
145-
146-
- name: Install tests
147-
run: docker run --rm -v $(pwd):/utPLSQL -w /utPLSQL --network host --entrypoint bash ${DOCKER_ENV} ${ORACLE_VERSION} ./test/install_tests.sh
148-
149-
- name: Run Tests
150-
run: bash test/run_tests.sh
151-
152-
- name: Validate utPLSQL reports format
153-
run: bash .travis/validate_report_files.sh
154-
155-
- name: SonarCloud Scan
156-
uses: SonarSource/sonarcloud-github-action@master
157-
env:
158-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
159-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
187+
- name: Update project version & build number in source code and documentation
188+
run: .travis/update_project_version.sh
189+
shell: bash
190+
191+
- name: Push version update to repository
192+
uses: test-room-7/action-update-file@v1
193+
with:
194+
file-path: |
195+
sonar-project.properties
196+
VERSION
197+
source/**
198+
docs/**
199+
commit-msg: Updated project version after build [skip ci]
200+
github-token: ${{ secrets.PUSH_TOKEN }}
201+
branch: ${{ env.CURRENT_BRANCH }}
202+
if: |
203+
${{
204+
github.ref_type == 'branch'
205+
&& github.repository == 'utPLSQL/utPLSQL'
206+
&& ( startsWith(env.CURRENT_BRANCH,'release/')
207+
|| env.CURRENT_BRANCH == 'develop'
208+
|| env.CURRENT_BRANCH == 'feature/github_actions'
209+
)
210+
}}
211+
212+
213+
# TODO - add slack notifications
214+
# TODO - add push of documentation
215+
# TODO - add building of release archive
216+
# TODO - add publishing of release

.travis/push_project_version.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
3+
set -v
4+
echo Current branch is "${CURRENT_BRANCH}"
5+
echo "Committing version & buildNo into branch (${CURRENT_BRANCH})"
6+
git add sonar-project.properties
7+
git add VERSION
8+
git add source/*
9+
git add docs/*
10+
git commit -m 'Updated project version after build [skip ci]'
11+
echo "Pushing to origin"
12+
git push --quiet origin HEAD:${CURRENT_BRANCH}

.travis/push_release_version.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

.travis/update_project_version.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ UTPLSQL_VERSION_PATTERN="v?([0-9]+\.){3}[0-9]+[^']*"
55
echo Current branch is "${CURRENT_BRANCH}"
66

77
echo Update version in project source files
8-
find ${UTPLSQL_SOURCES_DIR} -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PATTERN}/${UTPLSQL_BUILD_VERSION}/" {} \;
8+
find source -type f -name '*' -exec sed -i -r "s/${UTPLSQL_VERSION_PATTERN}/${UTPLSQL_BUILD_VERSION}/" {} \;
99
echo Source files updated with version tag: ${UTPLSQL_BUILD_VERSION}
1010

1111
echo Update version in documentation files

0 commit comments

Comments
 (0)