Skip to content

Commit c9266b0

Browse files
committed
Github Actions: split testing and releasing (close #806)
1 parent 1ff9a79 commit c9266b0

File tree

2 files changed

+74
-71
lines changed

2 files changed

+74
-71
lines changed
Lines changed: 1 addition & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,82 +1,14 @@
1-
name: CI
1+
name: release
22

33
on:
44
push:
55
tags:
66
- '*'
77
branches:
8-
- master
9-
- develop
108
- 'snapshot/**'
11-
pull_request:
129

1310
jobs:
14-
test:
15-
runs-on: ubuntu-latest
16-
17-
services:
18-
postgres:
19-
image: postgres
20-
ports:
21-
- 5432:5432
22-
env:
23-
POSTGRES_USER: enricher
24-
POSTGRES_PASSWORD: supersecret1
25-
POSTGRES_DB: sql_enrichment_test
26-
POSTGRES_PORT: 5432
27-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
28-
29-
steps:
30-
- uses: actions/checkout@v2
31-
- uses: coursier/cache-action@v6
32-
- name: Set up JDK 11
33-
uses: actions/setup-java@v1
34-
with:
35-
java-version: 11
36-
- name: Start HTTP server to test API enrichment in Common Enrich
37-
run: python integration-tests/common/api-enrichment-test.py 8001 &
38-
- name: Start HTTP server to test API enrichment in Common Fs2
39-
run: python integration-tests/common-fs2/api-enrichment-test.py 8000 &
40-
- name: Prepare data in Postgres to test SQL enrichment in Common Enrich
41-
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common/sql-enrichment-test.sql
42-
env:
43-
PGPASSWORD: supersecret1
44-
- name: Prepare data in Postgres to test SQL enrichment in Common Fs2
45-
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common-fs2/sql-enrichment-test.sql
46-
env:
47-
PGPASSWORD: supersecret1
48-
- name: Run tests
49-
run: SBT_OPTS="-Xms1G -Xmx8G -Xss4M -XX:MaxMetaspaceSize=1024M" sbt coverage +test
50-
env:
51-
OER_KEY: ${{ secrets.OER_KEY }}
52-
- name: Check Scala formatting
53-
run: sbt scalafmtCheckAll
54-
- name: Check assets can be published
55-
run: sbt publishLocal
56-
- name: Run integration tests for enrich-kinesis
57-
run: sbt "project kinesisDistroless" IntegrationTest/test
58-
env:
59-
AWS_ACCESS_KEY_ID: foo
60-
AWS_SECRET_ACCESS_KEY: bar
61-
- name: Run integration tests for enrich-kafka
62-
run: |
63-
sbt "project kafka" "docker:publishLocal"
64-
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml up -d
65-
sbt "project kafka" IntegrationTest/test
66-
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml down
67-
- name: Run integration tests for enrich-nsq
68-
run: sbt "project nsqDistroless" IntegrationTest/test
69-
- name: Generate coverage report
70-
run: sbt coverageReport
71-
- name: Aggregate coverage data
72-
run: sbt coverageAggregate
73-
- name: Submit coveralls data
74-
run: sbt coveralls
75-
env:
76-
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
77-
7811
github_release:
79-
needs: test
8012
if: startsWith(github.ref, 'refs/tags/')
8113
runs-on: ubuntu-latest
8214
steps:
@@ -119,7 +51,6 @@ jobs:
11951
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12052

12153
publish_docker:
122-
needs: test
12354
if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/snapshot')
12455
runs-on: ubuntu-latest
12556
strategy:
@@ -247,7 +178,6 @@ jobs:
247178
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
248179

249180
publish_sce:
250-
needs: test
251181
if: startsWith(github.ref, 'refs/tags/')
252182
runs-on: ubuntu-latest
253183
steps:

.github/workflows/test.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: test
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '**'
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
services:
15+
postgres:
16+
image: postgres
17+
ports:
18+
- 5432:5432
19+
env:
20+
POSTGRES_USER: enricher
21+
POSTGRES_PASSWORD: supersecret1
22+
POSTGRES_DB: sql_enrichment_test
23+
POSTGRES_PORT: 5432
24+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- uses: coursier/cache-action@v6
29+
- name: Set up JDK 11
30+
uses: actions/setup-java@v1
31+
with:
32+
java-version: 11
33+
- name: Start HTTP server to test API enrichment in Common Enrich
34+
run: python integration-tests/common/api-enrichment-test.py 8001 &
35+
- name: Start HTTP server to test API enrichment in Common Fs2
36+
run: python integration-tests/common-fs2/api-enrichment-test.py 8000 &
37+
- name: Prepare data in Postgres to test SQL enrichment in Common Enrich
38+
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common/sql-enrichment-test.sql
39+
env:
40+
PGPASSWORD: supersecret1
41+
- name: Prepare data in Postgres to test SQL enrichment in Common Fs2
42+
run: psql -h localhost -p 5432 -U enricher -d sql_enrichment_test < integration-tests/common-fs2/sql-enrichment-test.sql
43+
env:
44+
PGPASSWORD: supersecret1
45+
- name: Run tests
46+
run: SBT_OPTS="-Xms1G -Xmx8G -Xss4M -XX:MaxMetaspaceSize=1024M" sbt coverage +test
47+
env:
48+
OER_KEY: ${{ secrets.OER_KEY }}
49+
- name: Check Scala formatting
50+
run: sbt scalafmtCheckAll
51+
- name: Check assets can be published
52+
run: sbt publishLocal
53+
- name: Run integration tests for enrich-kinesis
54+
run: sbt "project kinesisDistroless" IntegrationTest/test
55+
env:
56+
AWS_ACCESS_KEY_ID: foo
57+
AWS_SECRET_ACCESS_KEY: bar
58+
- name: Run integration tests for enrich-kafka
59+
run: |
60+
sbt "project kafka" "docker:publishLocal"
61+
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml up -d
62+
sbt "project kafka" IntegrationTest/test
63+
docker-compose -f integration-tests/enrich-kafka/docker-compose.yml down
64+
- name: Run integration tests for enrich-nsq
65+
run: sbt "project nsqDistroless" IntegrationTest/test
66+
- name: Generate coverage report
67+
run: sbt coverageReport
68+
- name: Aggregate coverage data
69+
run: sbt coverageAggregate
70+
- name: Submit coveralls data
71+
run: sbt coveralls
72+
env:
73+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}

0 commit comments

Comments
 (0)