-
Notifications
You must be signed in to change notification settings - Fork 9
152 lines (135 loc) · 4.68 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
name: tests
on:
push:
pull_request:
types: [opened, reopened, review_requested, synchronize]
workflow_dispatch:
# Run tests 10:00 PM (JST) every day
schedule:
- cron: '0 13 * * *'
env:
COBOL4J_LIB_DIR: /usr/lib/opensourcecobol4j
COBOL4J_LIBCOBJ_JAR_PATH: /usr/lib/opensourcecobol4j/libcobj.jar
OCESQL4J_LIB_DIR: /usr/lib/Open-COBOL-ESQL-4j
OCESQL4J_POSTGRESQL_JDBC_PATH: /usr/lib/Open-COBOL-ESQL-4j/postgresql.jar
OCESQL4J_OCESQL4J_JAR_PATH: /usr/lib/Open-COBOL-ESQL-4j/ocesql4j.jar
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"
jobs:
Open-COBOL-ESQL-4j-tests:
strategy:
matrix:
os: ["ubuntu:22.04", "almalinux:9"]
runs-on: ubuntu-latest
container:
image: ${{ matrix.os }}
services:
# Start PostgreSQL 9.6 server
postgres9_6:
image: postgres:9.6
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: main_user
POSTGRES_DB: testdb
POSTGRES_HOST_AUTH_METHOD: 'trust'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Start PostgreSQL 15 server
postgres15:
image: postgres:15
ports:
- 5433:5432
env:
POSTGRES_PASSWORD: password
POSTGRES_USER: main_user
POSTGRES_DB: testdb
POSTGRES_HOST_AUTH_METHOD: 'trust'
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
# Install dependencies (Ubuntu 22.04)
- name: Install dependencies on Ubuntu 22.04
if: matrix.os == 'ubuntu:22.04'
run: |
apt update -y
apt install -y build-essential bison flex gettext texinfo automake autoconf curl
# Install dependencies (Almalinux 9)
- name: Install dependencies on AlmaLinux 9
if: matrix.os == 'almalinux:9'
run: |
dnf -y update
dnf install -y gcc gcc-c++ make bison flex automake autoconf diffutils gettext
# Setup JDK
- name: Setup JDK
uses: actions/setup-java@v3
with:
distribution: zulu
java-version: 11
# Setup sbt
- name: Setup sbt
uses: olafurpg/setup-scala@v11
with:
java-version: zulu@1.11
# Checkout
- name: Checkout Open-COBOL-ESQL-4j
uses: actions/checkout@v3
# Install JDBC
- name: Install JDBC
run: |
mkdir -p $COBOL4J_LIB_DIR $OCESQL4J_LIB_DIR
curl -L -o $OCESQL4J_POSTGRESQL_JDBC_PATH https://jdbc.postgresql.org/download/postgresql-42.2.24.jre6.jar
# Checkout opensource COBOL 4J
- name: Checkout opensourcecobol 4J
uses: actions/checkout@v3
with:
repository: opensourcecobol/opensourcecobol4j
path: opensourcecobol4j
# Install opensource COBOL 4J
- name: Install opensource COBOL 4J
run: |
cd opensourcecobol4j
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
./configure --prefix=/usr/
make
make install
# Build and Install Open COBOL ESQL 4J
- name: Install Open COBOL ESQL 4J
run: |
cp $OCESQL4J_POSTGRESQL_JDBC_PATH dblibj/lib
cp $COBOL4J_LIBCOBJ_JAR_PATH dblibj/lib
sh configure --prefix=/usr/
make
make install
# Run Autotest for PostgreSQL 9.6
- name: Run tests for PostgreSQL 9.6
run: |
cd tests
cp ../.github/workflows/db-settings/embed_db_info_postgresql_9.6.sh embed_db_info.sh
make test
# Run Autotest for PostgreSQL 15
- name: Run tests for PostgreSQL 15
run: |
cd tests
cp ../.github/workflows/db-settings/embed_db_info_postgresql_15.sh embed_db_info.sh
make test
# Create an issue if one or more tests fail in scheduled tests
create-issue-on-failure:
needs: Open-COBOL-ESQL-4j-tests
if: failure() && github.event_name == 'schedule' && github.actor == 'opensourcecobol'
runs-on: ubuntu-latest
steps:
- name: Create an Issue
uses: imjohnbo/issue-bot@v3
with:
assignees: "yutaro-sakamoto"
title: A scheduled build is failed
body: |
Scheduled build is failed.
See ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}