chore: Add to e2e (#12)

This commit is contained in:
Anatolios Laskaris 2023-03-20 08:54:20 +02:00 committed by GitHub
parent 86743b28c1
commit ceb9eb5468
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 214 additions and 30 deletions

2
.cargo/config.toml Normal file
View File

@ -0,0 +1,2 @@
[registries]
fluence = { index = "git://crates.fluence.dev/index" }

View File

@ -1,4 +1,4 @@
name: ci
name: "ci"
on:
pull_request:
@ -14,30 +14,7 @@ concurrency:
jobs:
tests:
name: "cargo test"
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install marine
uses: baptiste0928/cargo-install@v1.3.0
name: "Run tests"
uses: ./.github/workflows/tests.yml
with:
crate: marine
- name: Build
run: ./build.sh
- name: Run cargo test
run: cargo test --release --all-features
- name: Run cargo fmt
run: cargo fmt --all -- --check
# - name: Run cargo clippy
# run: cargo clippy --all --all-features
ref: ${{ github.ref }}

77
.github/workflows/e2e.yml vendored Normal file
View File

@ -0,0 +1,77 @@
name: "e2e"
on:
pull_request:
paths-ignore:
- "**.md"
push:
branches:
- "master"
concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
cancel-in-progress: true
jobs:
snapshot:
name: "sqlite-wasm"
uses: ./.github/workflows/snapshot.yml
with:
ref: ${{ github.ref }}
registry:
needs:
- snapshot
uses: fluencelabs/registry/.github/workflows/tests.yml@main
with:
cargo-dependencies: |
[
{
"package": "marine-sqlite-connector",
"version": "=${{ needs.snapshot.outputs.version }}",
"registry": "fluence"
}
]
spell:
needs:
- snapshot
uses: fluencelabs/spell/.github/workflows/snapshot.yml@main
with:
cargo-dependencies: |
[
{
"package": "marine-sqlite-connector",
"version": "=${{ needs.snapshot.outputs.version }}",
"registry": "fluence"
}
]
rust-peer:
needs:
- spell
uses: fluencelabs/rust-peer/.github/workflows/snapshot.yml@master
with:
image-name: "docker.fluence.dev/sqlite-wasm-connector"
cargo-dependencies: |
[
{
"package": "fluence-spell-dtos",
"version": "=${{ needs.spell.outputs.cargo-version }}",
"registry": "fluence"
},
{
"package": "fluence-spell-distro",
"version": "=${{ needs.spell.outputs.cargo-version }}",
"registry": "fluence"
}
]
spell-aqua-tests:
name: "spell"
needs:
- rust-peer
uses: fluencelabs/spell/.github/workflows/tests.yml@main
with:
rust-peer-image: "${{ needs.rust-peer.outputs.rust-peer-image }}"

74
.github/workflows/snapshot.yml vendored Normal file
View File

@ -0,0 +1,74 @@
name: Publish snapshots
on:
workflow_call:
inputs:
ref:
description: "GitHub ref to checkout to"
type: string
default: "master"
outputs:
version:
description: "snapshot version"
value: ${{ jobs.snapshot.outputs.version }}
jobs:
snapshot:
name: "Publish snapshot"
runs-on: ubuntu-latest
timeout-minutes: 60
outputs:
version: "${{ steps.snapshot.outputs.version }}"
permissions:
contents: read
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/sqlite-wasm-connector
ref: ${{ inputs.ref }}
- name: Import secrets
uses: hashicorp/vault-action@v2.5.0
with:
url: https://vault.fluence.dev
path: jwt/github
role: ci
method: jwt
jwtGithubAudience: "https://github.com/fluencelabs"
jwtTtl: 300
exportToken: false
secrets: |
kv/cargo-registry/users/ci token | CARGO_REGISTRIES_FLUENCE_TOKEN
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install marine
uses: baptiste0928/cargo-install@v1.3.0
with:
crate: marine
- name: Download sqlite-wasm
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: sqlite-wasm
path: artifacts/
- name: Build
run: ./build.sh
- name: Generate snapshot version
id: version
uses: fluencelabs/github-actions/generate-snapshot-id@main
- name: Publish snapshot
id: snapshot
uses: fluencelabs/github-actions/cargo-publish-snapshot@main
with:
id: ${{ steps.version.outputs.id }}

49
.github/workflows/tests.yml vendored Normal file
View File

@ -0,0 +1,49 @@
name: Run tests
on:
workflow_call:
inputs:
ref:
description: "git ref to checkout to"
type: string
default: "master"
jobs:
tests:
name: "cargo test"
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
repository: fluencelabs/sqlite-wasm-connector
ref: ${{ inputs.ref }}
- name: Setup Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install marine
uses: baptiste0928/cargo-install@v1.3.0
with:
crate: marine
- name: Download sqlite-wasm
continue-on-error: true
uses: actions/download-artifact@v3
with:
name: sqlite-wasm
path: artifacts/
- name: Build
run: ./build.sh
- name: Run cargo test
run: cargo test --release --all-features
- name: Run cargo fmt
run: cargo fmt --all -- --check
# - name: Run cargo clippy
# run: cargo clippy --all --all-features

View File

@ -37,7 +37,7 @@ path = "src/test.rs"
[dependencies]
marine-rs-sdk = "0.7.0"
bytesize = "1.2.0"
bytesize = "1.1.0"
[dev-dependencies]
marine-rs-sdk-test = "0.2.0"

View File

@ -1,4 +1,7 @@
#!/usr/bin/env bash
SQLITE_WASM_VERSION="v0.18.0_w"
set -o errexit -o nounset -o pipefail
# set current working directory to script directory to run script from everywhere
@ -13,4 +16,6 @@ mkdir -p artifacts
cp target/wasm32-wasi/release/test.wasm artifacts/
# download SQLite 3 to use in tests
curl -L https://github.com/fluencelabs/sqlite/releases/download/v0.18.0_w/sqlite3.wasm -o artifacts/sqlite3.wasm
if [[ ! -f artifacts/sqlite3.wasm ]]; then
curl -L https://github.com/fluencelabs/sqlite/releases/download/${SQLITE_WASM_VERSION}/sqlite3.wasm -o artifacts/sqlite3.wasm
fi