-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.33 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
name: Test Oracle DB
on:
push:
paths:
- '**.go'
- '**.mod'
branches:
- main
pull_request:
paths:
- '**.go'
- '**.mod'
branches:
- main
jobs:
test:
runs-on: ubuntu-latest
services:
oracle:
image: container-registry.oracle.com/database/free:latest
env:
ORACLE_PWD: Test123
options: --name oracle
ports:
- 1521:1521
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.23
- name: Connect to Oracle DB and set up
run: |
docker exec oracle bash -c "
sqlplus sys/Test123@localhost:1521/FREE as sysdba <<EOF
alter session set \"_ORACLE_SCRIPT\"=true;
CREATE USER test IDENTIFIED BY Test123;
GRANT CONNECT, RESOURCE TO test;
ALTER USER test QUOTA UNLIMITED ON USERS;
CREATE TABLE test.test_table (id NUMBER, name VARCHAR2(50));
INSERT INTO test.test_table VALUES (1, 'John Doe');
INSERT INTO test.test_table VALUES (2, 'Jane Doe');
GRANT SELECT ON test.test_table TO test;
exit;
EOF
"
- name: Test the connection
run: go run main.go -server "oracle://test:Test123@localhost:1521/FREE" "select * from test_table"