generated from PeopleForBikes/bna-mechanics-project-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implements an integration test workflow to validate any changes against the API. Drive-bys: - Regenerates the latest documentation. - Fixes Hurl tests. - Pins actions with SHA. - Adds a workflow ensuring the bnaclient is up to date. Signed-off-by: Rémy Greinhofer <[email protected]>
- Loading branch information
Showing
20 changed files
with
1,923 additions
and
360 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,36 @@ | ||
name: bnaclient | ||
|
||
defaults: | ||
run: | ||
working-directory: bnaclient | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: extractions/setup-just@dd310ad5a97d8e7b41793f8ef055398d51ad4de6 # v2 | ||
- name: Install cargo progenitor | ||
run: cargo install cargo-progenitor | ||
- name: Regenerate the specifications and the bnaclient | ||
run: just regenerate-all-no-cargo | ||
- name: Ensure there are no changes | ||
run: test -z "$(git status --porcelain)" || (git status; git diff; false) | ||
|
||
build: | ||
name: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
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
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
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
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,102 @@ | ||
name: integration | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DATABASE_URL: "postgresql://postgres:postgres@localhost:5432/postgres" | ||
|
||
services: | ||
postgres: | ||
image: ghcr.io/peopleforbikes/docker-postgis-bna:17-3.4-1 | ||
env: | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_DB: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
|
||
steps: | ||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
- uses: dtolnay/rust-toolchain@stable | ||
with: | ||
components: clippy, rustfmt | ||
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7 | ||
- name: Install HURL | ||
run: | | ||
HURL_VERSION=6.0.0 | ||
curl --location --remote-name https://github.com/Orange-OpenSource/hurl/releases/download/$HURL_VERSION/hurl_${HURL_VERSION}_amd64.deb | ||
sudo apt install ./hurl_${HURL_VERSION}_amd64.deb | ||
- name: Seed the database | ||
run: psql $DATABASE_URL < lambdas/tests/database-with-test-data.sql | ||
- name: Build the API server | ||
run: cargo build --release -p lambdas --bin axumed | ||
- name: Start the standalone API server | ||
run: > | ||
BNA_API_LOG_LEVEL=debug | ||
BNA_API_STANDALONE=1 | ||
cargo run --release -p lambdas --bin axumed & | ||
- run: sleep 5 | ||
- name: Run the public smoke-tests | ||
run: > | ||
hurl | ||
--test | ||
--variables-file lambdas/tests/localhost.vars | ||
lambdas/tests/smoke/public.hurl | ||
- name: Run the scenarios tests | ||
run: > | ||
hurl | ||
--test | ||
--variables-file lambdas/tests/localhost.vars | ||
lambdas/tests/scenario/pagination.hurl | ||
- name: Run the endpoint tests | ||
run: > | ||
hurl | ||
--test | ||
--variables-file lambdas/tests/localhost.vars | ||
lambdas/tests/endpoints/cities.hurl | ||
lambdas/tests/endpoints/pricing.hurl | ||
lambdas/tests/endpoints/ratings.hurl | ||
# - uses: astral-sh/setup-uv@887a942a15af3a7626099df99e897a18d9e5ab3a #v5.1.0 | ||
# with: | ||
# enable-cache: true | ||
# - name: Set up Python | ||
# run: uv python install | ||
# | ||
# Schemathesis causes the server to crash somehow. | ||
# ``` | ||
# Network Error | ||
# | ||
# Connection failed | ||
# | ||
# Connection aborted. Remote end closed connection without response | ||
# ``` | ||
# This will require more investigation to be run in the CI. | ||
# - name: Run Schemathesis | ||
# run: > | ||
# cd lambdas/tests && | ||
# RUST_BACKTRACE=1 | ||
# uv run st run | ||
# --base-url http://localhost:3000/ | ||
# --cassette-path cassette.yaml | ||
# -vvv | ||
# -x | ||
# --show-trace | ||
# --generation-allow-x00 false | ||
# --exclude-method 'POST' | ||
# --exclude-method 'PATCH' | ||
# ../../openapi-3.0.yaml |
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
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
Oops, something went wrong.