-
Notifications
You must be signed in to change notification settings - Fork 25
144 lines (126 loc) · 4.39 KB
/
test.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
name: Open-COBOL-ESQL tests
on:
push:
pull_request:
types: [opened, reopened, review_requested, synchronize]
permissions:
contents: read
jobs:
check-workflows:
uses: ./.github/workflows/check-workflows.yml
Open-COBOL-ESQL-tests:
needs: check-workflows
runs-on: ubuntu-latest
strategy:
matrix:
os: ["ubuntu:24.04", "almalinux:9"]
container:
image: ${{ matrix.os }}
# Start PostgreSQL server
services:
postgres:
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
steps:
# Install dependencies (Ubuntu 24.04)
- name: Install dependencies on Ubuntu 24.04
if: matrix.os == 'ubuntu:24.04'
run: |
apt update -y
# Install dependencies of Open-COBOL-ESQL
apt install -y build-essential bison flex gettext texinfo automake autoconf curl libtool libpq-dev pkgconf
# Install dependencies of opensource COBOL
apt install -y libgmp-dev
# Install dependencies (Almalinux 9)
- name: Install dependencies on AlmaLinux 9
if: matrix.os == 'almalinux:9'
run: |
dnf -y update
# Install dependencies of Open-COBOL-ESQL
dnf install -y gcc gcc-c++ make bison flex automake autoconf diffutils gettext libtool postgresql-devel
# Install dependencies of opensource COBOL
dnf install -y gmp-devel
# Cache the directory 'opensource-cobol-1.5.2J'
- name: Cache opnesource COBOL v1.5.2J
id: opensource_cobol_cache_id
uses: actions/cache@v4
with:
path: opensource-cobol-1.5.2J
key: opensource-cobol-1.5.2J-key
# Build opensource COBOL if the cache is not found
- name: Download and Build opensource COBOL v1.5.2J
if: steps.opensource_cobol_cache_id.outputs.cache-hit != 'true'
run: |
curl -L -o opensource-cobol-1.5.2J.tar.gz https://github.com/opensourcecobol/opensource-cobol/archive/refs/tags/v1.5.2J.tar.gz
tar zxf opensource-cobol-1.5.2J.tar.gz
cd opensource-cobol-1.5.2J/vbisam
./configure --prefix=/usr/
make
make install
cd ../
./configure --prefix=/usr/ --with-vbisam
make
# Install opensource COBOL
- name: Install opensource COBOL v1.5.2J
run: |
cd opensource-cobol-1.5.2J/vbisam
make install
cd ../
make install
# Checkout Open-COBOL-ESQL
- name: Checkout Open-COBOL-ESQL
uses: actions/checkout@v4
with:
path: Open-COBOL-ESQL
# Build and Install Open-COBOL-ESQL
- name: Install Open-COBOL-ESQL
working-directory: Open-COBOL-ESQL
run: |
chmod +x ./autogen.sh && ./autogen.sh
./configure
make install
# Create a log directory
- name: Create a log directory
run: |
mkdir -p Open-COBOL-ESQL/log/test
# Run Autotest
- name: Run tests
working-directory: Open-COBOL-ESQL/tests
run: |
make clean
cp ../.github/workflows/test-settings/atlocal atlocal
cp ../.github/workflows/test-settings/embed_db_info.sh embed_db_info.sh
cp ../.github/workflows/test-settings/cobol_runner.sh cobol_runner.sh
make
./basic
./cobol_data
./sql_data
./sqlca
./misc
cp -r basic.dir cobol_data.dir sql_data.dir sqlca.dir ./*.log ../log/test
# Define the archive name
- name: Define the archive name
run: |
echo "OCESQL_ARCHIVE_NAME=ocesql-${{ matrix.os }}" | sed s/:/-/g >> "$GITHUB_ENV"
# Upload test logs and the result of static checking
- name: Archive Logs
uses: actions/upload-artifact@v4
with:
name: ${{ env.OCESQL_ARCHIVE_NAME }}.log
path: Open-COBOL-ESQL/log/*
# Workflow fails if one or more test cases failed
- name: Check test results
run: |
cat Open-COBOL-ESQL/tests/*.log
! cat Open-COBOL-ESQL/tests/*.log | grep -q 'Failed tests:'