Skip to content

Commit 0abfba9

Browse files
authored
Merge pull request cloudfoundry#480 from kart2bc/github-action
add github actions
2 parents cafb72c + 746981a commit 0abfba9

File tree

3 files changed

+401
-0
lines changed

3 files changed

+401
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Generate github actions from template
2+
3+
ytt -f ./gh_template.yml -f [ytt-helpers.star](https://github.com/cloudfoundry/wg-app-platform-runtime-ci/blob/main/shared/helpers/ytt-helpers.star) -f [index.yml](https://github.com/cloudfoundry/wg-app-platform-runtime-ci/blob/main/routing-release/index.yml) > ./workflows/tests-workflow.yml
4+
5+
## Supported jobs
6+
- Template tests
7+
- Basic Verifications
8+
- Unit and Integration tests
Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#@ load("@ytt:data", "data")
2+
#@ load("ytt-helpers.star", "helpers")
3+
4+
name: unit-integration-tests
5+
6+
on:
7+
push:
8+
branches:
9+
- develop
10+
pull_request:
11+
12+
env:
13+
MAPPING: |
14+
build_nats_server=src/code.cloudfoundry.org/vendor/github.com/nats-io/nats-server/v2
15+
build_routing_api_cli=src/code.cloudfoundry.org/routing-api-cli
16+
FLAGS: |
17+
--keep-going
18+
--trace
19+
-r
20+
--fail-on-pending
21+
--randomize-all
22+
--nodes=7
23+
--race
24+
--timeout 30m
25+
--flake-attempts 2
26+
RUN_AS: root
27+
VERIFICATIONS: |
28+
verify_go repo/$DIR
29+
verify_go_version_match_bosh_release repo
30+
verify_gofmt repo/$DIR
31+
verify_govet repo/$DIR
32+
verify_staticcheck repo/$DIR
33+
FUNCTIONS: ci/routing-release/helpers/configure-binaries.bash
34+
35+
jobs:
36+
repo-clone:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: routing-release-repo
40+
uses: actions/checkout@v4
41+
with:
42+
repository: cloudfoundry/routing-release.git
43+
ref: github-action
44+
submodules: recursive
45+
path: repo
46+
- name: Check out wg-appruntime code
47+
uses: actions/checkout@v4
48+
with:
49+
repository: cloudfoundry/wg-app-platform-runtime-ci
50+
path: ci
51+
- name: zip repo artifacts
52+
run: |
53+
tar -czf repo-artifact.tar.gz repo
54+
tar -czf ci-artifact.tar.gz ci
55+
- name: upload artifact
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: repo
59+
path: |
60+
repo-artifact.tar.gz
61+
ci-artifact.tar.gz
62+
template-tests:
63+
runs-on: ubuntu-latest
64+
needs: repo-clone
65+
container:
66+
image: cloudfoundry/tas-runtime-mysql-5.7
67+
steps:
68+
- name: Download artifact
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: repo
72+
- run: "tar -xzvf repo-artifact.tar.gz\ntar -xzvf ci-artifact.tar.gz\n"
73+
- name: template-tests
74+
run: |
75+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-tests-templates/task.bash
76+
test-on-mysql-5-7:
77+
runs-on: ubuntu-latest
78+
needs: repo-clone
79+
container:
80+
image: cloudfoundry/tas-runtime-mysql-5.7
81+
steps:
82+
- name: Download artifact
83+
uses: actions/download-artifact@v4
84+
with:
85+
name: repo
86+
- run: |
87+
tar -xzvf repo-artifact.tar.gz
88+
tar -xzvf ci-artifact.tar.gz
89+
- name: build binaries
90+
run: |
91+
export DEFAULT_PARAMS="${GITHUB_WORKSPACE}/ci/routing-release/default-params/build-binaries/linux.yml"
92+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/build-binaries/task.bash
93+
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
94+
- name: #@ "{}-mysql".format(package.name)
95+
env:
96+
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
97+
DB: mysql
98+
run: |
99+
"${GITHUB_WORKSPACE}"/ci/routing-release/helpers/configure-binaries.bash
100+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-bin-test/task.bash --keep-going --trace -r --fail-on-pending --randomize-all --nodes=7 --race --timeout 30m --flake-attempts 2
101+
#@ end
102+
test-repos-withoutdb:
103+
runs-on: ubuntu-latest
104+
needs: repo-clone
105+
container:
106+
image: cloudfoundry/tas-runtime-build
107+
steps:
108+
- name: Download artifact
109+
uses: actions/download-artifact@v4
110+
with:
111+
name: repo
112+
- run: |
113+
tar -xzvf repo-artifact.tar.gz
114+
tar -xzvf ci-artifact.tar.gz
115+
- name: build binaries
116+
run: |
117+
export DEFAULT_PARAMS="${GITHUB_WORKSPACE}/ci/routing-release/default-params/build-binaries/linux.yml"
118+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/build-binaries/task.bash
119+
#@ for package in helpers.packages_without_configure_db(data.values.internal_repos):
120+
- name: #@ package.name
121+
env:
122+
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
123+
run: |
124+
export DIR=$DIR
125+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-bin-test/task.bash --keep-going --trace -r --fail-on-pending --randomize-all --nodes=7 --race --timeout 30m --flake-attempts 2
126+
#@ end
127+
test-on-postgres:
128+
runs-on: ubuntu-latest
129+
needs: repo-clone
130+
container:
131+
image: cloudfoundry/tas-runtime-postgres
132+
steps:
133+
- name: Download artifact
134+
uses: actions/download-artifact@v4
135+
with:
136+
name: repo
137+
- run: |
138+
tar -xzvf repo-artifact.tar.gz
139+
tar -xzvf ci-artifact.tar.gz
140+
- name: build binaries
141+
run: |
142+
export DEFAULT_PARAMS="${GITHUB_WORKSPACE}/ci/routing-release/default-params/build-binaries/linux.yml"
143+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/build-binaries/task.bash
144+
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
145+
- name: #@ "{}-mysql".format(package.name)
146+
env:
147+
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
148+
DB: postgres
149+
run: |
150+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-bin-test/task.bash --keep-going --trace -r --fail-on-pending --randomize-all --nodes=7 --race --timeout 30m --flake-attempts 2
151+
#@ end
152+
test-on-mysql-8-0:
153+
runs-on: ubuntu-latest
154+
needs: repo-clone
155+
container:
156+
image: cloudfoundry/tas-runtime-mysql-8.0
157+
steps:
158+
- name: Download artifact
159+
uses: actions/download-artifact@v4
160+
with:
161+
name: repo
162+
- run: |
163+
tar -xzvf repo-artifact.tar.gz
164+
tar -xzvf ci-artifact.tar.gz
165+
- name: build binaries
166+
run: |
167+
export DEFAULT_PARAMS="${GITHUB_WORKSPACE}/ci/routing-release/default-params/build-binaries/linux.yml"
168+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/build-binaries/task.bash
169+
#@ for package in helpers.packages_with_configure_db(data.values.internal_repos):
170+
- name: #@ "{}-mysql".format(package.name)
171+
env:
172+
DIR: #@ "src/code.cloudfoundry.org/{}".format(package.name)
173+
DB: mysql
174+
run: |
175+
"${GITHUB_WORKSPACE}"/ci/shared/tasks/run-bin-test/task.bash --keep-going --trace -r --fail-on-pending --randomize-all --nodes=7 --race --timeout 30m --flake-attempts 2
176+
#@ end

0 commit comments

Comments
 (0)