-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create fastly-edge-assignments integration tests (#75)
* Create fastly-edge-assignments integration tests. * refactor * add test for CORS headers * rm fastly-edge-assignments/Makefile * Update .github/workflows/fastly-edge-assignments.yml Co-authored-by: Oleksii Shmalko <[email protected]> * Revert "rm fastly-edge-assignments/Makefile" This reverts commit 9131130. --------- Co-authored-by: Oleksii Shmalko <[email protected]>
- Loading branch information
1 parent
4399595
commit d8dd6e5
Showing
5 changed files
with
180 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: Fastly Edge Assignments | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
cargo_build_and_test: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: fastly-edge-assignments | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
# Cache Rust toolchain and dependencies | ||
- uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db/ | ||
~/.rustup/ | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-cargo- | ||
- name: Setup Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
target: wasm32-wasi | ||
|
||
# Install tools only if not cached | ||
- name: Install Tools | ||
run: | | ||
if ! command -v cargo-nextest &> /dev/null; then | ||
cargo install cargo-nextest | ||
fi | ||
if ! command -v fastly &> /dev/null; then | ||
wget https://github.com/fastly/cli/releases/download/v10.17.0/fastly_10.17.0_linux_amd64.deb | ||
sudo apt install ./fastly_10.17.0_linux_amd64.deb | ||
fi | ||
if ! command -v viceroy &> /dev/null; then | ||
cargo install viceroy | ||
fi | ||
# Build WASM target | ||
- run: make build | ||
|
||
# Run unit and integration tests | ||
- run: make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
[build] | ||
target = "wasm32-wasi" | ||
|
||
[target.wasm32-wasi] | ||
runner = "viceroy run -C fastly.toml -- " | ||
|
||
[patch.crates-io] | ||
# Local override for development. | ||
eppo_core = { path = '../eppo_core' } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
SHELL := bash | ||
.ONESHELL: | ||
.SHELLFLAGS := -eu -o pipefail -c | ||
.DELETE_ON_ERROR: | ||
MAKEFLAGS += --warn-undefined-variables | ||
MAKEFLAGS += --no-builtin-rules | ||
|
||
WASM_TARGET=wasm32-wasi | ||
BUILD_DIR=target/$(WASM_TARGET)/release | ||
WASM_FILE=$(BUILD_DIR)/$(FASTLY_PACKAGE).wasm | ||
|
||
# Help target for easy documentation | ||
.PHONY: help | ||
help: | ||
@echo "Available targets:" | ||
@echo " build - Build the WASM target" | ||
@echo " test - Run unit and integration tests" | ||
@echo " clean - Clean all build artifacts" | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf bin pkg | ||
|
||
.PHONY: build | ||
build: | ||
rustup target add $(WASM_TARGET) | ||
fastly compute build | ||
|
||
.PHONY: test | ||
test: | ||
cargo nextest run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,33 @@ | ||
# Eppo Assignments on Fastly Compute@Edge | ||
|
||
TODO: Add a description | ||
|
||
## Development | ||
|
||
Install Rust toolchain: | ||
|
||
`curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh` | ||
|
||
Install Fastly CLI: | ||
|
||
`brew install fastly/tap/fastly` | ||
|
||
https://www.fastly.com/documentation/reference/tools/cli/ | ||
|
||
Install Viceroy: | ||
|
||
`cargo install viceroy` | ||
|
||
Build with Fastly: | ||
|
||
`make build` | ||
|
||
## Testing | ||
|
||
Install nextest: | ||
|
||
`cargo binstall cargo-nextest --secure` | ||
|
||
Run tests: | ||
|
||
`make test` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters