Skip to content

Commit

Permalink
(WIP) Adding Header Validation tool and github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
suriheemanshu committed Apr 30, 2024
1 parent 1f47f11 commit 9585d9a
Show file tree
Hide file tree
Showing 15 changed files with 3,919 additions and 0 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build
on:
pull_request:
branches:
- main
paths:
- 'Makefile'
push:
branches:
- main
paths:
- 'Makefile'
- 'header-validation/**'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: make
- name: Deploy
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./out
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
SHELL = /bin/bash
OUT_DIR ?= out

.PHONY: all clean validator
all: validator

validator: $(OUT_DIR)/validate-headers.html $(OUT_DIR)/validate-headers.js

$(OUT_DIR)/validate-headers.html: header-validation/index.html $(OUT_DIR)
@ cp $< $@

$(OUT_DIR)/validate-headers.js: header-validation/dist/main.js $(OUT_DIR)
@ cp $< $@

$(OUT_DIR):
@ mkdir -p $@

header-validation/dist/main.js: header-validation/package.json header-validation/src/*.js
@ npm ci --prefix ./header-validation
@ npm run build --prefix ./header-validation

clean:
@ rm -rf $(OUT_DIR)

2 changes: 2 additions & 0 deletions header-validation/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist
node_modules
65 changes: 65 additions & 0 deletions header-validation/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<!DOCTYPE html>
<meta charset=utf-8>
<title>Attribution Reporting Header Validation</title>

<!--Load Webpage Style-->
<link rel="stylesheet" href="style.css">

<body>
<!--Title-->
<h1>Attribution Reporting Header Validation</h1>
<form id=validation-form>
<noscript>JavaScript is required to use this form.</noscript>
<!--Input Box-->
<fieldset id=input>
<legend>Value</legend>
<textarea id=input-text></textarea>
</fieldset>
<!--Input Options/Output Results-->
<div id=right>
<!--Input Options-->
<fieldset id=header-options>
<legend>Header</legend>
<!--Header Type-->
<p><label><input type=radio name=header value=trigger checked><code>Attribution-Reporting-Register-Trigger</code></label>
<p><label><input type=radio name=header value=source><code>Attribution-Reporting-Register-Source</code></label>
<!--Source Type (only applicable to header type: Attribution-Reporting-Register-Source)-->
<fieldset id=source-type-options>
<legend>Source Type</legend>
<p><label><input type=radio name=source-type value=event checked>event</label>
<p><label><input type=radio name=source-type value=navigation>navigation</label>
</fieldset>
<!-- Registration Type -->
<fieldset id=registration-type-options>
<legend>Registration Type</legend>
<p><label><input type=radio name=registration-type value=app checked>app</label>
<p><label><input type=radio name=registration-type value=web>web</label>
</fieldset>
<!--Additional Feature Selection-->
<p><label><input type=checkbox name=feature-ara-parsing-alignment-v1>Measurement Enable ARA Parsing Alignment V1</label>
<p><label><input type=checkbox name=feature-lookback-window-filter>Measurement Enable Lookback Window Filter</label>
<p><label><input type=checkbox name=feature-trigger-data-matching>Measurement Enable Trigger Data Matching</label>
</fieldset>

<!--Output Results-->
<fieldset id=output>
<legend>Validation Result</legend>
<!--Output Options-->
<button type=button id=linkify>Copy Link</button>
<!--Output Text-->
<output>
<div id=success></div>
<p>Errors:
<ul id=errors></ul>
<p>Warnings:
<ul id=warnings></ul>
<p>Notes:
<ul id=notes></ul>
</output>
</fieldset>
</div>
</form>

<!--Load Webpage Script-->
<script src="./dist/main.js"></script>
</body>
Loading

0 comments on commit 9585d9a

Please sign in to comment.