-
Notifications
You must be signed in to change notification settings - Fork 31
113 lines (99 loc) · 3.34 KB
/
main-runtests.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
name: CI-main-dataplane
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches:
- main
jobs:
tests:
runs-on: ubuntu-latest
# Service containers to run with `container-job`
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: timescale/timescaledb:latest-pg15
# Provide the password for postgres
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: "Hello123!"
POSTGRES_DB: "dataplane"
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
redis-service:
image: redis:7.2-alpine
ports:
- 6379:6379
nats:
image: nats:2.9-scratch
ports:
- 4222:4222
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.21
# Get values for cache paths to be used in later steps
- id: go-cache-paths
name: Github Actions Environment Variables
run: |
echo "go-build=$(go env GOCACHE)" >> "$GITHUB_ENV"
echo "go-mod=$(go env GOMODCACHE)" >> "$GITHUB_ENV"
echo "DP_VERSION=v0.0.0" >> "$GITHUB_ENV"
- name: ENV Version Test - version = ${{ env.DP_VERSION }}
run: |
echo release: $DP_VERSION
- name: Checkout code
uses: actions/checkout@v2
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v2
with:
path: ${{ env.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v2
with:
path: ${{ env.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
- name: Create file directory
run: echo ${{ github.workspace }}/appdev/code-files/ && mkdir -p ${{ github.workspace }}/appdev/code-files/
- name: Run Go Tests
env:
DP_DB_HOST: localhost
DP_DB_USER: postgres
DP_DB_SSL: "disable"
DP_DB_PORT: "5432"
DP_DB_DATABASE: "dataplane"
secret_db_pwd: "Hello123!"
DP_DATABASE: "timescaledb"
DP_MODE: "development"
DP_DEBUG: "true"
DP_DB_DEBUG: "false"
DP_MQ_DEBUG: "true"
DP_METRIC_DEBUG: "false"
DP_SCHEDULER_DEBUG: "true"
DP_WORKER_HEARTBEAT_SECONDS: "1"
DP_WORKER_GROUP: "python_1"
DP_WORKER_CMD: "/bin/bash"
DP_WORKER_TYPE: "vm"
DP_WORKER_LB: "roundrobin"
DP_WORKER_ENV: "Development"
DP_CLEANTASKS_DAYS: "60"
DP_REMOVELOGS_DAYS: "60"
DP_CODE_FOLDER: "${{ github.workspace }}/appdev/code-files/"
DP_CODE_FILE_STORAGE: "Database"
DP_DFS_CODE_FOLDER: "${{ github.workspace }}/appdev/dfs-code-files/"
DP_REDIS_HOST: "localhost"
DP_REDIS_PORT: "6379"
DP_REDIS_PASSWORD: ""
DP_REDIS_DB: "0"
run: cd app/mainapp && time go run Tests/mainTest.go