Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @edgee-cloud/edgeers
96 changes: 96 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Check
on:
push:
branches:
- main
pull_request:

env:
EDGEE_API_TOKEN: ${{ secrets.EDGEE_API_TOKEN }}

jobs:
check:
name: cargo check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip2 # WebAssembly target
components: rustfmt
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component wit
- run: cargo check

fmt:
name: cargo fmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
target: wasm32-wasip2 # WebAssembly target
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component wit
- uses: actions-rust-lang/rustfmt@v1

clippy:
name: clippy
runs-on: ubuntu-latest
permissions:
checks: write
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
target: wasm32-wasip2 # WebAssembly target
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component wit
- uses: wearerequired/lint-action@master
with:
clippy: true

build:
name: cargo build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip2 # WebAssembly target
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component build
- name: Verify .wasm file exists
run: |
if [ ! -f "./woopra.wasm" ]; then
echo "❌ Error: woopra.wasm not found" >&2
exit 1
fi

test:
name: cargo test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip2 # WebAssembly target
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component wit
- run: make test

coverage:
name: coverage & coveralls
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip2 # WebAssembly target
- uses: taiki-e/install-action@cargo-llvm-cov
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component wit
- run: make test.coverage.lcov
- uses: coverallsapp/github-action@v2
33 changes: 33 additions & 0 deletions .github/workflows/wasm-build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and Release WASM

permissions:
contents: write
on:
release:
types: [ published ]

env:
EDGEE_API_TOKEN: ${{ secrets.EDGEE_API_TOKEN }}

jobs:
check:
name: Build and release wasm component
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: wasm32-wasip2
- uses: edgee-cloud/install-edgee-cli@v0.2.0
- run: edgee component build
- name: Upload WASM to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./woopra.wasm
asset_name: woopra.wasm
asset_content_type: application/wasm
- name: Push to Edgee Component Registry
run: edgee component push edgee --yes --changelog "${{ github.event.release.body }}"
13 changes: 5 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@
# will have compiled files and executables
debug/
target/
.edgee/
component.wasm

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# Generated by cargo mutants
# Contains mutation testing data
**/mutants.out*/
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
Expand Down
91 changes: 91 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Edgee Contributor Guidelines

Welcome! This project is created by the team at [Edgee](https://www.edgee.cloud).
We're glad you're interested in contributing! We welcome contributions from people of all backgrounds
who are interested in making great software with us.

At Edgee, we aspire to empower everyone to create interactive experiences. To do this,
we're exploring and pushing the boundaries of new technologies, and sharing our learnings with the open source community.

If you have ideas for collaboration, email us at opensource@edgee.cloud or join our [Slack](https://www.edgee.cloud/slack)!

We're also hiring full-time engineers to work with us everywhere! Check out our current job postings [here](https://github.com/edgee-cloud/careers/issues).

## Issues

### Feature Requests

If you have ideas or how to improve our projects, you can suggest features by opening a GitHub issue.
Make sure to include details about the feature or change, and describe any uses cases it would enable.

Feature requests will be tagged as `enhancement` and their status will be updated in the comments of the issue.

### Bugs

When reporting a bug or unexpected behavior in a project, make sure your issue describes steps
to reproduce the behavior, including the platform you were using, what steps you took, and any error messages.

Reproducible bugs will be tagged as `bug` and their status will be updated in the comments of the issue.

### Wontfix

Issues will be closed and tagged as `wontfix` if we decide that we do not wish to implement it,
usually due to being misaligned with the project vision or out of scope. We will comment on the issue with more detailed reasoning.

## Contribution Workflow

### Open Issues

If you're ready to contribute, start by looking at our open issues tagged as [`help wanted`](../../issues?q=is%3Aopen+is%3Aissue+label%3A"help+wanted") or [`good first issue`](../../issues?q=is%3Aopen+is%3Aissue+label%3A"good+first+issue").

You can comment on the issue to let others know you're interested in working on it or to ask questions.

### Making Changes

1. Fork the repository.

2. Review the [Development Workflow](#development-workflow) section to understand how to run the project locally.

3. Create a new feature [branch](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-and-deleting-branches-within-your-repository).

4. Make your changes on your branch. Ensure that there are no build errors by running the project with your changes locally.

5. [Submit the branch as a Pull Request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) pointing to the `main` branch of the Edgee repository. A maintainer should comment and/or review your Pull Request within a few days. Although depending on the circumstances, it may take longer.

### Development Workflow

#### Setup and run Edgee

```bash
cargo run
```

#### Test

```bash
cargo test
```

This command will be triggered to each PR as a requirement for merging it.


## Licensing

Unless otherwise specified, all Edgee open source projects shall comply with the Apache 2.0 licence. Please see the [LICENSE](LICENSE) file for more information.

## Contributor Terms

Thank you for your interest in Edgee’ open source project. By providing a contribution (new or modified code,
other input, feedback or suggestions etc.) you agree to these Contributor Terms.

You confirm that each of your contributions has been created by you and that you are the copyright owner.
You also confirm that you have the right to provide the contribution to us and that you do it under the
Apache 2.0 licence.

If you want to contribute something that is not your original creation, you may submit it to Edgee separately
from any contribution, including details of its source and of any license or other restriction
(such as related patents, trademarks, agreements etc.)

Please also note that our projects are released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md) to
ensure that they are welcoming places for everyone to contribute. By participating in any Edgee open source project,
you agree to keep to the Contributor Code of Conduct.
17 changes: 17 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "woopra-component"
version = "1.0.0"
edition = "2021"

[lib]
crate-type = ["cdylib"]

[dependencies]
anyhow = "1.0.86"
serde = { version = "1.0.204", features = ["derive"] }
serde_qs = "0.13.0"
wit-bindgen = "0.41.0"

[dev-dependencies]
pretty_assertions = "1.4.1"
uuid = { version = "1.10.0", features = ["v4"] }
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.PHONY: all
MAKEFLAGS += --silent

all: help

help:
@grep -E '^[a-zA-Z1-9\._-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| sed -e "s/^Makefile://" -e "s///" \
| awk 'BEGIN { FS = ":.*?## " }; { printf "\033[36m%-30s\033[0m %s\n", $$1, $$2 }'

build: ## Build the wasi component
edgee components build

test: ## Test the component on host platform
cargo test --lib

test.coverage:
cargo llvm-cov --all-features

test.coverage.lcov:
cargo llvm-cov --all-features --lcov --output-path lcov.info

test.coverage.html:
cargo llvm-cov --all-features --open
94 changes: 92 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,92 @@
# woopra-component
Woopra Edgee Component
<div align="center">
<p align="center">
<a href="https://www.edgee.cloud">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://cdn.edgee.cloud/img/component-dark.svg">
<img src="https://cdn.edgee.cloud/img/component.svg" height="100" alt="Edgee">
</picture>
</a>
</p>
</div>

<h1 align="center">Woopra component for Edgee</h1>

[![Coverage Status](https://coveralls.io/repos/github/edgee-cloud/woopra-component/badge.svg)](https://coveralls.io/github/edgee-cloud/woopra-component)
[![GitHub issues](https://img.shields.io/github/issues/edgee-cloud/woopra-component.svg)](https://github.com/edgee-cloud/woopra-component/issues)
[![Edgee Component Registry](https://img.shields.io/badge/Edgee_Component_Registry-Public-green.svg)](https://www.edgee.cloud/edgee/woopra)


This component enables seamless integration between [Edgee](https://www.edgee.cloud) and [Woopra](https://www.woopra.com/), allowing you to collect and forward analytics events to your Woopra project.


## Quick Start

1. Download the latest component version from our [releases page](../../releases)
2. Place the `woopra.wasm` file in your server (e.g., `/var/edgee/components`)
3. Add the following configuration to your `edgee.toml`:

```toml
[[destinations.data_collection]]
id = "woopra"
file = "/var/edgee/components/woopra.wasm"
settings.project = "example.com"
```


## Event Handling

### Event Mapping
The component maps Edgee events to Woopra events as follows.

| Edgee Event | Woopra event | Description |
|-------------|--------------------------------|--------------------------------------|
| Page | Track request with name = "pv" | Triggered when a user views a page |
| Track | Track request | Triggered for custom events |
| User | Identify request | Use it to update visitor properties |


## Configuration Options

### Basic Configuration
```toml
[[destinations.data_collection]]
id = "woopra"
file = "/var/edgee/components/woopra.wasm"
settings.project = "example.com"
```

### Event Controls
Control which events are forwarded to Woopra:
```toml
settings.edgee_page_event_enabled = true # Enable/disable page view tracking
settings.edgee_track_event_enabled = true # Enable/disable custom event tracking
settings.edgee_user_event_enabled = true # Enable/disable user identification
```


## Development

### Building from Source
Prerequisites:
- [Rust](https://www.rust-lang.org/tools/install)

Build command:
```bash
edgee component build
```

Test command:
```bash
make test
```

Test coverage command:
```bash
make test.coverage[.html]
```

### Contributing
Interested in contributing? Read our [contribution guidelines](./CONTRIBUTING.md)

### Security
Report security vulnerabilities to [security@edgee.cloud](mailto:security@edgee.cloud)
Loading