Skip to content

Commit 98db3ae

Browse files
Merge pull request #44 from opensourcecobol/develop
2 parents a7cbec4 + c1e3103 commit 98db3ae

File tree

111 files changed

+8392
-25707
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+8392
-25707
lines changed

.github/workflows/ci.yml

Lines changed: 103 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1-
name: Open-COBOL-ESQL-4j tests on Ubuntu
1+
name: tests
22

33
on:
44
push:
55
pull_request:
66
types: [opened, reopened, review_requested, synchronize]
7+
workflow_dispatch:
8+
# Run tests 10:00 PM (JST) every day
9+
schedule:
10+
- cron: '0 13 * * *'
11+
12+
env:
13+
COBOL4J_LIB_DIR: /usr/lib/opensourcecobol4j
14+
COBOL4J_LIBCOBJ_JAR_PATH: /usr/lib/opensourcecobol4j/libcobj.jar
15+
OCESQL4J_LIB_DIR: /usr/lib/Open-COBOL-ESQL-4j
16+
OCESQL4J_POSTGRESQL_JDBC_PATH: /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar
17+
OCESQL4J_OCESQL4J_JAR_PATH: /usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar
18+
CLASSPATH: ":/usr/lib/opensourcecobol4j/sqlite.jar:/usr/lib/opensourcecobol4j/libcobj.jar:/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar:/usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar"
719

820
jobs:
921
Open-COBOL-ESQL-4j-tests:
22+
strategy:
23+
matrix:
24+
os: ["ubuntu:22.04", "almalinux:9"]
1025
runs-on: ubuntu-latest
26+
container:
27+
image: ${{ matrix.os }}
1128

12-
# Start PostgreSQL server
1329
services:
14-
postgres:
30+
# Start PostgreSQL 9.6 server
31+
postgres9_6:
1532
image: postgres:9.6
1633
ports:
1734
- 5432:5432
@@ -25,69 +42,111 @@ jobs:
2542
--health-interval 10s
2643
--health-timeout 5s
2744
--health-retries 5
45+
46+
# Start PostgreSQL 15 server
47+
postgres15:
48+
image: postgres:15
49+
ports:
50+
- 5433:5432
51+
env:
52+
POSTGRES_PASSWORD: password
53+
POSTGRES_USER: main_user
54+
POSTGRES_DB: testdb
55+
POSTGRES_HOST_AUTH_METHOD: 'trust'
56+
options: >-
57+
--health-cmd pg_isready
58+
--health-interval 10s
59+
--health-timeout 5s
60+
--health-retries 5
61+
2862
steps:
29-
- name: Install dependencies
63+
# Install dependencies (Ubuntu 22.04)
64+
- name: Install dependencies on Ubuntu 22.04
65+
if: matrix.os == 'ubuntu:22.04'
3066
run: |
31-
sudo apt-get update
32-
sudo apt-get install -y git
33-
sudo apt-get install -y build-essential bison flex gettext texinfo
67+
apt update -y
68+
apt install -y build-essential bison flex gettext texinfo automake autoconf curl
69+
70+
# Install dependencies (Almalinux 9)
71+
- name: Install dependencies on AlmaLinux 9
72+
if: matrix.os == 'almalinux:9'
73+
run: |
74+
dnf -y update
75+
dnf install -y gcc gcc-c++ make bison flex automake autoconf diffutils gettext
76+
77+
# Setup JDK
3478
- name: Setup JDK
3579
uses: actions/setup-java@v3
3680
with:
37-
distribution: temurin
81+
distribution: zulu
3882
java-version: 11
3983

40-
# Checkout Open-COBOL-ESQL-4j
84+
# Setup sbt
85+
- name: Setup sbt
86+
uses: olafurpg/setup-scala@v11
87+
with:
88+
java-version: [email protected]
89+
90+
# Checkout
4191
- name: Checkout Open-COBOL-ESQL-4j
42-
uses: actions/checkout@v2
92+
uses: actions/checkout@v3
4393

4494
# Install JDBC
4595
- name: Install JDBC
46-
if: steps.java_lib_cache_id.outputs.cache-hit != 'true'
4796
run: |
48-
mkdir ~/.java_lib
49-
curl -L -o ~/.java_lib/sqlite.jar https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
50-
curl -L -o ~/.java_lib/postgresql.jar https://jdbc.postgresql.org/download/postgresql-42.2.24.jre6.jar
97+
mkdir -p $COBOL4J_LIB_DIR $OCESQL4J_LIB_DIR
98+
curl -L -o $OCESQL4J_POSTGRESQL_JDBC_PATH https://jdbc.postgresql.org/download/postgresql-42.2.24.jre6.jar
5199
52-
# Checkout opensource COBOL 4j v1.0.10
53-
- name: Checkout opensourcecobol4j
54-
run: |
55-
curl -L -o opensourcecobol4j.tar.gz https://github.com/opensourcecobol/opensourcecobol4j/archive/refs/tags/v1.0.10.tar.gz
56-
tar zxf opensourcecobol4j.tar.gz
57-
mv opensourcecobol4j-1.0.10 opensourcecobol4j
100+
# Checkout opensource COBOL 4J
101+
- name: Checkout opensourcecobol 4J
102+
uses: actions/checkout@v3
103+
with:
104+
repository: opensourcecobol/opensourcecobol4j
105+
path: opensourcecobol4j
58106

59-
# Install opensource COBOL 4j v1.0.10
60-
- name: Install opensource COBOL
107+
# Install opensource COBOL 4J
108+
- name: Install opensource COBOL 4J
61109
run: |
62110
cd opensourcecobol4j
111+
curl -L -k -o libcobj/sqlite-jdbc/sqlite.jar https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
63112
./configure --prefix=/usr/
64-
export CLASSPATH="$CLASSPATH:$HOME/.java_lib/sqlite.jar"
65113
make
66-
sudo make install
67-
cd ../
114+
make install
68115
69-
# Build and Install Open-COBOL-ESQL-4j
70-
- name: Install Open-COBOL-ESQL-4j
116+
# Build and Install Open COBOL ESQL 4J
117+
- name: Install Open COBOL ESQL 4J
71118
run: |
119+
cp $OCESQL4J_POSTGRESQL_JDBC_PATH dblibj/lib
120+
cp $COBOL4J_LIBCOBJ_JAR_PATH dblibj/lib
72121
sh configure --prefix=/usr/
73122
make
74-
sudo make install
75-
cp ~/.java_lib/postgresql.jar dblibj/lib
76-
cp /usr/lib/opensourcecobol4j/libcobj.jar dblibj/lib
77-
cd dblibj
78-
export CLASSPATH="$HOME/.java_lib/sqlite.jar:$HOME/.java_lib/postgresql.jar:/usr/lib/opensourcecobol4j/libcobj.jar"
79-
sbt assembly
80-
cp target/scala-2.13/ocesql4j.jar ~/.java_lib
123+
make install
81124
82-
# Run Autotest
83-
- name: Run tests
125+
# Run Autotest for PostgreSQL 9.6
126+
- name: Run tests for PostgreSQL 9.6
84127
run: |
85-
export CLASSPATH=":$HOME/.java_lib/sqlite.jar:$HOME/.java_lib/postgresql.jar:/usr/lib/opensourcecobol4j/libcobj.jar:$HOME/.java_lib/ocesql4j.jar"
86128
cd tests
87-
cp ../.github/workflows/ubuntu-test-settings/embed_db_info.sh embed_db_info.sh
88-
make
89-
./basic
90-
./cobol_data
91-
./sql_data
92-
./sqlca
93-
./misc
129+
cp ../.github/workflows/db-settings/embed_db_info_postgresql_9.6.sh embed_db_info.sh
130+
make test
131+
132+
# Run Autotest for PostgreSQL 15
133+
- name: Run tests for PostgreSQL 15
134+
run: |
135+
cd tests
136+
cp ../.github/workflows/db-settings/embed_db_info_postgresql_15.sh embed_db_info.sh
137+
make test
138+
139+
# Create an issue if one or more tests fail in scheduled tests
140+
create-issue-on-failure:
141+
needs: Open-COBOL-ESQL-4j-tests
142+
if: failure() && github.event_name == 'schedule'
143+
runs-on: ubuntu-latest
144+
steps:
145+
- name: Create an Issue
146+
uses: imjohnbo/issue-bot@v3
147+
with:
148+
assignees: "yutaro-sakamoto"
149+
title: A scheduled build is failed
150+
body: |
151+
Scheduled build is failed.
152+
See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}

.github/workflows/coverage.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, reopened, review_requested, synchronize]
7+
workflow_dispatch:
8+
9+
env:
10+
COBOL4J_LIB_DIR: /usr/lib/opensourcecobol4j
11+
COBOL4J_LIBCOBJ_JAR_PATH: /usr/lib/opensourcecobol4j/libcobj.jar
12+
OCESQL4J_LIB_DIR: /usr/lib/Open-COBOL-ESQL-4j
13+
OCESQL4J_POSTGRESQL_JDBC_PATH: /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar
14+
OCESQL4J_OCESQL4J_JAR_PATH: /usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar
15+
CLASSPATH: ":/usr/lib/opensourcecobol4j/sqlite.jar:/usr/lib/opensourcecobol4j/libcobj.jar:/usr/lib/Open-COBOL-ESQL-4j/postgresql.jar:/usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar"
16+
17+
jobs:
18+
make-coverage-report:
19+
runs-on: ubuntu-latest
20+
21+
# Start PostgreSQL 15 server
22+
services:
23+
postgres15:
24+
image: postgres:15
25+
ports:
26+
- 5432:5432
27+
env:
28+
POSTGRES_PASSWORD: password
29+
POSTGRES_USER: main_user
30+
POSTGRES_DB: testdb
31+
POSTGRES_HOST_AUTH_METHOD: 'trust'
32+
options: >-
33+
--health-cmd pg_isready
34+
--health-interval 10s
35+
--health-timeout 5s
36+
--health-retries 5
37+
38+
steps:
39+
# Install dependencies
40+
- name: Install dependencies on Ubuntu 22.04
41+
run: |
42+
sudo apt update -y
43+
sudo apt install -y build-essential bison flex gettext texinfo automake autoconf curl gcovr
44+
45+
# Setup JDK
46+
- name: Setup JDK
47+
uses: actions/setup-java@v3
48+
with:
49+
distribution: zulu
50+
java-version: 11
51+
52+
# Setup sbt
53+
- name: Setup sbt
54+
uses: olafurpg/setup-scala@v11
55+
with:
56+
java-version: [email protected]
57+
58+
# Checkout
59+
- name: Checkout Open-COBOL-ESQL-4j
60+
uses: actions/checkout@v3
61+
62+
# Install JDBC
63+
- name: Install JDBC
64+
run: |
65+
sudo mkdir -p $COBOL4J_LIB_DIR $OCESQL4J_LIB_DIR
66+
sudo curl -L -o $OCESQL4J_POSTGRESQL_JDBC_PATH https://jdbc.postgresql.org/download/postgresql-42.2.24.jre6.jar
67+
68+
# Checkout opensource COBOL 4J
69+
- name: Checkout opensourcecobol 4J
70+
uses: actions/checkout@v3
71+
with:
72+
repository: opensourcecobol/opensourcecobol4j
73+
path: opensourcecobol4j
74+
75+
# Install opensource COBOL 4J
76+
- name: Install opensource COBOL 4J
77+
run: |
78+
cd opensourcecobol4j
79+
curl -L -k -o libcobj/sqlite-jdbc/sqlite.jar https://github.com/xerial/sqlite-jdbc/releases/download/3.36.0.3/sqlite-jdbc-3.36.0.3.jar
80+
./configure --prefix=/usr/
81+
make
82+
sudo make install
83+
84+
# Build and Install Open COBOL ESQL 4J
85+
- name: Install Open COBOL ESQL 4J
86+
run: |
87+
cp $OCESQL4J_POSTGRESQL_JDBC_PATH dblibj/lib
88+
cp $COBOL4J_LIBCOBJ_JAR_PATH dblibj/lib
89+
sh configure CFLAGS='-fprofile-arcs -ftest-coverage' --prefix=/usr/
90+
make
91+
sudo make install
92+
93+
# Run Autotest for PostgreSQL 15
94+
- name: Run tests for PostgreSQL 15
95+
run: |
96+
cd tests
97+
cp ../.github/workflows/db-settings/embed_db_info_postgresql_15_coverage.sh embed_db_info.sh
98+
make test
99+
100+
# Make a coverage report
101+
- name: Make a coverage report
102+
run: |
103+
cd ocesql
104+
gcov -l *.gcda
105+
gcovr -r . --html -o report.html
106+
mkdir coverage-report
107+
cp *.gcno *.gcda *.gcov report.html coverage-report
108+
109+
# Upload a coverage report
110+
- name: Archive a coverage report
111+
uses: actions/upload-artifact@v3
112+
with:
113+
name: code-coverage-report
114+
path: ocesql/coverage-report/

.github/workflows/ubuntu-test-settings/embed_db_info.sh renamed to .github/workflows/db-settings/embed_db_info_postgresql_15.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Database Settings ----------
22
DB_NAME=testdb
3-
DB_HOST=localhost
3+
DB_HOST=postgres15
44
DB_PORT=5432
55
DB_USER=main_user
66
DB_PASSWORD=password
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Database Settings ----------
2+
DB_NAME=testdb
3+
DB_HOST=localhost
4+
DB_PORT=5432
5+
DB_USER=main_user
6+
DB_PASSWORD=password
7+
# ----------------------------
8+
9+
TEMP_FILE=$(mktemp)
10+
11+
cat $1 |
12+
sed -e "s/<|DB_NAME|>/${DB_NAME}/g" |
13+
sed -e "s/<|DB_HOST|>/${DB_HOST}/g" |
14+
sed -e "s/<|DB_PORT|>/${DB_PORT}/g" |
15+
sed -e "s/<|DB_USER|>/${DB_USER}/g" |
16+
sed -e "s/<|DB_PASSWORD|>/${DB_PASSWORD}/g" > ${TEMP_FILE}
17+
18+
mv ${TEMP_FILE} $1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Database Settings ----------
2+
DB_NAME=testdb
3+
DB_HOST=postgres9_6
4+
DB_PORT=5432
5+
DB_USER=main_user
6+
DB_PASSWORD=password
7+
# ----------------------------
8+
9+
TEMP_FILE=$(mktemp)
10+
11+
cat $1 |
12+
sed -e "s/<|DB_NAME|>/${DB_NAME}/g" |
13+
sed -e "s/<|DB_HOST|>/${DB_HOST}/g" |
14+
sed -e "s/<|DB_PORT|>/${DB_PORT}/g" |
15+
sed -e "s/<|DB_USER|>/${DB_USER}/g" |
16+
sed -e "s/<|DB_PASSWORD|>/${DB_PASSWORD}/g" > ${TEMP_FILE}
17+
18+
mv ${TEMP_FILE} $1

.github/workflows/static_analysis.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: static analysis
2+
3+
on:
4+
push:
5+
pull_request:
6+
types: [opened, reopened, review_requested, synchronize]
7+
workflow_dispatch:
8+
9+
jobs:
10+
static_analysis:
11+
runs-on: ubuntu-latest
12+
steps:
13+
# Checkout
14+
- name: Checkout Open COBOL ESQL 4J
15+
uses: actions/checkout@v3
16+
17+
# Install static analysis tools
18+
- name: Install static analysis tools
19+
run: |
20+
sudo apt-get update -y
21+
sudo apt-get install -y clang-format cppcheck
22+
23+
# check if source code is formatted
24+
- name: Check format with clang-format
25+
run: |
26+
./check-format
27+
28+
# Check C files in ocesql/ using cppcheck
29+
- name: Run cppcheck
30+
run: |
31+
cd ocesql && cppcheck define.h errorfile.c ocesql.c ocesql.h ocesqlutil.c ocesqlutil.h ppout.c
32+
33+
# Check Scala files in dblibj/ using Scalastyle
34+
- name: Run Scalastyle
35+
run: |
36+
cd dblibj && sbt scalastyle

0 commit comments

Comments
 (0)