Skip to content

Commit 88cefce

Browse files
committed
[other] refactor development and qa release process
1. Make startDev actually work out of the box 2. Remove the dev/ directory and everything related to that in favor of just using the output dist/ 3. Write proper example.html that is usable in s3 and locally
1 parent fa7fed4 commit 88cefce

19 files changed

+222
-680
lines changed

.github/workflows/build-push.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build and Push
2+
on: push
3+
4+
env:
5+
NODE_VERSION: 18
6+
JAVA_VERSION: 11
7+
JAVA_DISTRIBUTION: 'adopt'
8+
9+
jobs:
10+
build-push:
11+
name: run tests, build and push
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install Node ${{ env.NODE_VERSION }}
17+
uses: actions/setup-node@v3
18+
with:
19+
node-version: ${{ env.NODE_VERSION }}
20+
cache: 'npm'
21+
22+
- name: Set up JDK 11
23+
uses: actions/setup-java@v4
24+
with:
25+
java-version: ${{ env.JAVA_VERSION }}
26+
distribution: ${{ env.JAVA_DISTRIBUTION }}
27+
28+
- name: Install dependencies
29+
run: npm run ci
30+
31+
- name: Lint tests
32+
run: npm run lint
33+
34+
- name: Run tests
35+
run: npm run test-report
36+
37+
- name: Test Report
38+
uses: dorny/test-reporter@v1
39+
if: always()
40+
with:
41+
name: Unit Tests
42+
fail-on-error: true,
43+
path: test-results.json # Path to test results
44+
reporter: mocha-json # Format of test results
45+
46+
- name: Publish Test Results
47+
uses: EnricoMi/publish-unit-test-result-action@v2
48+
id: test-results
49+
if: always()
50+
with:
51+
files: "test-results.json"
52+
53+
- name: Run coverage
54+
run: npm run cover
55+
56+
- name: upload codecov
57+
uses: codecov/codecov-action@v4
58+
59+
- name: Check whether we will be able to make the release
60+
run: make release
61+
62+
- name: AWS, credentials setup
63+
if: ${{ github.ref == 'refs/heads/master' }}
64+
uses: aws-actions/configure-aws-credentials@v4
65+
with:
66+
aws-region: us-west-1
67+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
68+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
69+
70+
- name: Deploy updated builds to staging
71+
if: ${{ github.ref == 'refs/heads/master' }}
72+
id: build
73+
run: |
74+
./deployment/deploy-qa.sh

.github/workflows/deploy-qa.yml

Lines changed: 0 additions & 93 deletions
This file was deleted.

.github/workflows/gate-keep.yml

Lines changed: 0 additions & 94 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ dev
3737
test-results.json
3838
.idea/
3939
.direnv/
40+
dev.config
41+
dev.html
42+
example.html

Makefile

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,13 @@ ONPAGE_RELEASE=$(subst ",\",$(shell perl -pe 'BEGIN{$$sub="https://cdn.branch.io
3131
ONPAGE_DEV=$(subst ",\",$(shell perl -pe 'BEGIN{$$sub="build.js"};s\#SCRIPT_URL_HERE\#$$sub\#' src/onpage.js | $(CLOSURE_COMPILER) | node transform.js branch_sdk))
3232
ONPAGE_TEST=$(subst ",\",$(shell perl -pe 'BEGIN{$$sub="../dist/build.js"};s\#SCRIPT_URL_HERE\#$$sub\#' src/onpage.js | $(CLOSURE_COMPILER) | node transform.js branch_sdk))
3333

34-
# Check if the target being executed is "dev" and set COMPILER_DEV_ARGS if API_ENDPOINT argument has value
35-
$(info Building dev...)
36-
ifeq ($(MAKECMDGOALS),dev)
37-
ifneq ($(API_ENDPOINT),)
38-
COMPILER_DEV_ARGS := --define='DEFAULT_API_ENDPOINT=$(API_ENDPOINT)'
39-
endif
40-
endif
41-
4234
.PHONY: clean
4335

44-
all: dist/build.min.js dist/build.js example.html test/branch-deps.js test/integration-test.html
36+
all: dist/build.min.js dist/build.js test/branch-deps.js test/integration-test.html
4537
clean:
46-
rm -f dist/** docs/web/3_branch_web.md example.html test/branch-deps.js dist/build.min.js.gz test/integration-test.html
38+
rm -f dist/** docs/web/3_branch_web.md test/branch-deps.js dist/build.min.js.gz test/integration-test.html
4739
release: clean all dist/build.min.js.gz
4840
@echo "released"
49-
dev-clean:
50-
rm -rf dev/*
51-
dev: dev-clean dev-build example.html
5241

5342
test/branch-deps.js: $(SOURCES)
5443
npx closure-make-deps \
@@ -71,21 +60,6 @@ dist/build.min.js.gz: dist/build.min.js
7160
mkdir -p dist && \
7261
gzip -c dist/build.min.js > dist/build.min.js.gz
7362

74-
dev-build: $(SOURCES) $(EXTERN)
75-
mkdir -p dev && \
76-
$(CLOSURE_COMPILER) $(COMPILER_ARGS) $(COMPILER_DEBUG_ARGS) $(COMPILER_DEV_ARGS) > dev/build.js
77-
78-
example.html: src/web/example.template.html
79-
ifeq ($(MAKECMDGOALS), release)
80-
perl -pe 'BEGIN{$$a="$(ONPAGE_RELEASE)"}; s#// INSERT INIT CODE#$$a#' src/web/example.template.html > example.html
81-
else ifeq ($(MAKECMDGOALS),dev)
82-
perl -pe 'BEGIN{$$b="$(KEY_VALUE)"}; s#key_place_holder#$$b#' src/web/example.template.html > dev/example.template.html
83-
perl -pe 'BEGIN{$$a="$(ONPAGE_DEV)"}; s#// INSERT INIT CODE#$$a#' dev/example.template.html > dev/example.html
84-
rm -rf dev/example.template.html
85-
else
86-
perl -pe 'BEGIN{$$a="$(ONPAGE_DEV)"}; s#// INSERT INIT CODE#$$a#' src/web/example.template.html > example.html
87-
endif
88-
8963
# Documentation
9064

9165
docs/web/3_branch_web.md: $(SOURCES)

0 commit comments

Comments
 (0)