Skip to content

Commit 20072af

Browse files
Migrate to github actions (#454)
* ci: experiment with gha * ci: iterate * ci: iterate * ci: add more jobs * ci: fix test typo, restore cci to compare timing * ci: upload coverage and publish results * ci: bump * ci: fix codecov upload, remove cci * ci: more stuff * ci: bump * ci: fix download path * ci: fix download * ci: add publish
1 parent e18c50e commit 20072af

File tree

4 files changed

+215
-226
lines changed

4 files changed

+215
-226
lines changed

.circleci/config.yml

Lines changed: 0 additions & 226 deletions
This file was deleted.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: build-and-test
2+
on:
3+
pull_request:
4+
push:
5+
branches:
6+
- main
7+
jobs:
8+
build:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v2
13+
14+
- name: Cache node modules
15+
uses: actions/cache@v2
16+
with:
17+
path: ~/.npm
18+
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-node-${{ hashFiles('package.json') }}-
21+
${{ runner.os }}-node-
22+
23+
- name: NPM Install
24+
run: npm ci
25+
26+
- name: Build
27+
run: npm run build:ci
28+
29+
- name: Archive build artifacts
30+
uses: actions/upload-artifact@v2
31+
with:
32+
name: dist
33+
path: dist
34+
lint:
35+
runs-on: ubuntu-20.04
36+
steps:
37+
- name: Check out code
38+
uses: actions/checkout@v2
39+
40+
- name: Cache node modules
41+
uses: actions/cache@v2
42+
with:
43+
path: ~/.npm
44+
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
45+
restore-keys: |
46+
${{ runner.os }}-node-${{ hashFiles('package.json') }}-
47+
${{ runner.os }}-node-
48+
- name: NPM Install
49+
run: npm ci
50+
51+
- name: Lint
52+
run: npm run lint
53+
54+
- name: Prettier Check
55+
run: npm run prettier:check
56+
test:
57+
runs-on: ubuntu-20.04
58+
steps:
59+
- name: Check out code
60+
uses: actions/checkout@v2
61+
# Used by CCI uploader to detect base commit
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Cache node modules
66+
uses: actions/cache@v2
67+
with:
68+
path: ~/.npm
69+
key: ${{ runner.os }}-node-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
70+
restore-keys: |
71+
${{ runner.os }}-node-${{ hashFiles('package.json') }}-
72+
${{ runner.os }}-node-
73+
74+
- name: NPM Install
75+
run: npm ci
76+
77+
- name: Test
78+
run: npm run test:ci
79+
80+
- name: Upload coverage to Codecov
81+
uses: codecov/codecov-action@v1
82+
with:
83+
fail_ci_if_error: true
84+
85+
- name: Publish Unit Test Results
86+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6
87+
if: always()
88+
with:
89+
github_token: ${{ secrets.GITHUB_TOKEN }}
90+
files: test-results/**/*.xml
91+
validate-helm-charts:
92+
runs-on: ubuntu-20.04
93+
steps:
94+
- name: Check out code
95+
uses: actions/checkout@v2
96+
- name: Set up Helm
97+
uses: azure/setup-helm@v1
98+
with:
99+
version: v3.3.0
100+
- name: validate charts
101+
uses: hypertrace/actions/validate-charts@main
102+
merge-publish:
103+
if: github.event_name == 'push'
104+
runs-on: ubuntu-20.04
105+
needs: [build, lint, test, validate-helm-charts]
106+
steps:
107+
- name: Check out code
108+
uses: actions/checkout@v2
109+
# Used by gradle version calculation
110+
with:
111+
fetch-depth: 0
112+
113+
- name: Create checksum file
114+
uses: hypertrace/actions/checksum@main
115+
116+
- name: Cache gradle
117+
uses: actions/cache@v2
118+
with:
119+
path: ~/.gradle
120+
key: gradle-${{ runner.os }}-${{ hashFiles('**/checksum.txt') }}
121+
restore-keys: |
122+
gradle-${{ runner.os }}
123+
124+
- name: Download build results
125+
uses: actions/download-artifact@v2
126+
with:
127+
name: dist
128+
path: dist
129+
130+
- name: Login to Docker Hub
131+
uses: docker/login-action@v1
132+
with:
133+
username: ${{ secrets.DOCKERHUB_READ_USER }}
134+
password: ${{ secrets.DOCKERHUB_READ_TOKEN }}
135+
136+
- name: Push docker image
137+
run: ./gradlew dockerPushImages
138+
env:
139+
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_PUBLISH_USER }}
140+
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_PUBLISH_TOKEN }}

0 commit comments

Comments
 (0)