Skip to content
Closed
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
4 changes: 4 additions & 0 deletions .devcontainer/gherkin-test/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "ghcr.io/philips-software/amp-devcontainer-gherkin:${localEnv:IMAGE_VERSION}",
"workspaceFolder": "/workspaces/amp-devcontainer/test/gherkin/workspace"
}
36 changes: 36 additions & 0 deletions .devcontainer/gherkin/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
FROM ubuntu:24.04@sha256:b59d21599a2b151e23eea5f6602f4af4d7d31c4e236d22bf0b62b86d2e386b8f

ARG BATS_VERSION=1.11.0
ARG NODE_MAJOR=20

ARG DEBIAN_FRONTEND=noninteractive

HEALTHCHECK NONE

SHELL ["/bin/bash", "-o", "pipefail", "-c"]

# Install the base system with all tool dependencies
# hadolint ignore=DL3008
RUN --mount=type=bind,source=.devcontainer/gherkin/apt-requirements-base.json,target=/tmp/apt-requirements-base.json \
--mount=type=cache,target=/var/cache/apt,sharing=locked \
--mount=type=cache,target=/var/lib/apt,sharing=locked \
--mount=type=cache,target=/var/log,sharing=locked \
apt-get update && apt-get install -y --no-install-recommends jq \
&& jq -r 'to_entries | .[] | .key + "=" + .value' /tmp/apt-requirements-base.json | \
xargs apt-get install -y --no-install-recommends \
# Include the Cisco Umbrella PKI Root
&& wget -qO /usr/local/share/ca-certificates/Cisco_Umbrella_Root_CA.crt https://www.cisco.com/security/pki/certs/ciscoumbrellaroot.pem \
&& update-ca-certificates \
&& wget -qO - https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /usr/share/keyrings/nodesource-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/nodesource-keyring.gpg] https://deb.nodesource.com/node_${NODE_MAJOR}.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list > /dev/null \
&& apt-get update && apt-get install -y --no-install-recommends nodejs \
&& npm install -g [email protected] \
&& cp /etc/skel/.bashrc /root/.bashrc

# Install bats
RUN batstmp="$(mktemp -d /tmp/bats-core-${BATS_VERSION}.XXXX)" \
&& wget -qO - "https://github.com/bats-core/bats-core/archive/refs/tags/v${BATS_VERSION}.tar.gz" | tar xz -C "${batstmp}" \
&& bash "${batstmp}/bats-core-${BATS_VERSION}/install.sh" /usr/local \
&& rm -rf "${batstmp}" \
&& git -C /usr/local clone -b v0.3.0 https://github.com/bats-core/bats-support.git \
&& git -C /usr/local clone -b v2.1.0 https://github.com/bats-core/bats-assert.git
7 changes: 7 additions & 0 deletions .devcontainer/gherkin/apt-requirements-base.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"bash-completion": "1:2.11-8",
"ca-certificates": "20240203",
"git": "1:2.43.0-1ubuntu7.2",
"gnupg2": "2.4.4-2ubuntu17.2",
"wget": "1.21.4-1ubuntu4.1"
}
14 changes: 14 additions & 0 deletions .devcontainer/gherkin/devcontainer-metadata-vscode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"remoteEnv": {
"LOCAL_WORKSPACE_FOLDER": "${localWorkspaceFolder}"
},
"customizations": {
"vscode": {
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]"
]
}
}
}
26 changes: 26 additions & 0 deletions .devcontainer/gherkin/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"build": {
"dockerfile": "Dockerfile",
"context": "../.."
},
"remoteEnv": {
"CONTAINER_FLAVOR": "gherkin"
},
"customizations": {
"vscode": {
"settings": {
"files.insertFinalNewline": true,
"files.trimTrailingWhitespace": true
},
"extensions": [
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]",
"[email protected]"
]
}
}
}
2 changes: 1 addition & 1 deletion .github/workflows/pr-image-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: ["cpp", "rust"]
flavor: [cpp, gherkin, rust]
permissions:
packages: write
steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
update-release-notes:
strategy:
matrix:
flavor: [cpp, rust]
flavor: [cpp, gherkin, rust]
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: ["cpp", "rust"]
flavor: [cpp, gherkin, rust]
# Using our own container is required since we need all package sources
# set-up correctly.
container: ghcr.io/philips-software/amp-devcontainer-${{ matrix.flavor }}:edge
Expand Down Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: ["cpp", "rust"]
flavor: [cpp, gherkin, rust]
permissions:
contents: write
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vulnerability-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
flavor: ["cpp", "rust"]
flavor: [cpp, gherkin, rust]
permissions:
security-events: write
steps:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/wc-build-push-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
build-push:
strategy:
matrix:
flavor: [cpp, rust]
flavor: [cpp, gherkin, rust]
uses: ./.github/workflows/wc-build-push.yml
permissions:
actions: read
Expand Down Expand Up @@ -61,7 +61,7 @@ jobs:
integration-test:
strategy:
matrix:
flavor: [cpp, rust]
flavor: [cpp, gherkin, rust]
runner: ["ubuntu-latest", "ubuntu-24.04-arm"]
needs: build-push
uses: ./.github/workflows/wc-integration-test.yml
Expand Down
29 changes: 14 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ This repository contains [devcontainers](https://docs.github.com/en/codespaces/s

- **Batteries Included** 🔋: Pre-configured tools for local development and continuous integration.
- **Multi-platform Support** ⚙️: Compatible with x64 and arm64 hardware on Windows, Linux, and macOS.
- **Image Flavors** 🍨: Dedicated containers for C++ and Rust development.
- **Image Flavors** 🍨: Dedicated containers for C++, Gherkin and Rust development.
- **IDE Integration** 💻: Fully compatible with GitHub Codespaces and VS Code.
- **Semantic Versioning** 🔢: Clear versioning strategy for container images.
- **Secure** 🔒: Emphasis on supply-chain security and compatible with Dependabot.
Expand All @@ -51,9 +51,10 @@ This repository is under active development; see [pulse](https://github.com/phil
The following devcontainers are published towards the [GitHub Container Registry](https://ghcr.io/):

- [amp-devcontainer-cpp](https://github.com/orgs/philips-software/packages/container/package/amp-devcontainer-cpp); the C++ container
- [amp-devcontainer-gherkin](https://github.com/orgs/philips-software/packages/container/package/amp-devcontainer-gherkin); the Gherkin container
- [amp-devcontainer-rust](https://github.com/orgs/philips-software/packages/container/package/amp-devcontainer-rust); the Rust container

Both containers include a full [Visual Studio Code](https://code.visualstudio.com/) configuration that is compatible with [GitHub Codespaces](https://github.com/features/codespaces).
All containers include a full [Visual Studio Code](https://code.visualstudio.com/) configuration that is compatible with [GitHub Codespaces](https://github.com/features/codespaces).

A summary of the included tools can be found below. For the full list of all included tools and tool versions see the [Dependency Graph](https://github.com/philips-software/amp-devcontainer/network/dependencies), the SBOM published with a [release](https://github.com/philips-software/amp-devcontainer/releases), or the SBOM attached to the image.

Expand All @@ -65,6 +66,10 @@ Next to the compilers there is support for package management (using [CPM.cmake]

The default build system is set up to use CMake, Ninja and CCache.

#### amp-devcontainer-gherkin

The amp-devcontainer-cpp built from this repository contains tools for authoring Gherkin feature files.

#### amp-devcontainer-rust

The amp-devcontainer-rust built from this repository contains the Rust ecosystem and additional tools to facilitate, embedded, Rust development.
Expand Down Expand Up @@ -132,6 +137,12 @@ The attestations can be checked with the following command, verifying that the i
gh attestation verify --repo philips-software/amp-devcontainer oci://ghcr.io/philips-software/amp-devcontainer-cpp
```

> amp-devcontainer-gherkin

```sh
gh attestation verify --repo philips-software/amp-devcontainer oci://ghcr.io/philips-software/amp-devcontainer-gherkin
```

> amp-devcontainer-rust

```sh
Expand All @@ -146,23 +157,11 @@ The resulting containers can be used in a `.devcontainer.json` file or in a `.de
> While the following examples use the `latest` tag, it is recommended to pin to a specific version. Or better yet, a specific SHA.
> See the [releases](https://github.com/philips-software/amp-devcontainer/releases) for the SHA corresponding to a specific release.

#### amp-devcontainer-cpp

> .devcontainer/devcontainer.json or .devcontainer.json

```json
{
"image": "ghcr.io/philips-software/amp-devcontainer-cpp:latest"
}
```

#### amp-devcontainer-rust

> .devcontainer/devcontainer.json or .devcontainer.json

```json
{
"image": "ghcr.io/philips-software/amp-devcontainer-rust:latest"
"image": "ghcr.io/philips-software/amp-devcontainer-<flavor>:latest"
}
```

Expand Down
18 changes: 18 additions & 0 deletions test/gherkin/integration-tests.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bats

bats_require_minimum_version 1.5.0

setup() {
load '/usr/local/bats-support/load'
load '/usr/local/bats-assert/load'

pushd ${BATS_TEST_DIRNAME}/workspace
}

teardown() {
popd
}

@test "gherkin tests should start" {
ls -la
}
60 changes: 60 additions & 0 deletions test/gherkin/workspace/test-scenario.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
Feature: Shopping Cart Functionality
As an online shopper
I want to manage items in my shopping cart
So that I can purchase the products I need

Background:
Given the online store is operational
And I am logged in as a registered user
And my shopping cart is empty

Rule: Users must be logged in to add items to cart
Example: Adding an item to cart as a logged-in user
When I browse to the "Electronics" category
And I select the "Smartphone" product
Then I should see the product details
And the "Add to Cart" button should be enabled
When I click the "Add to Cart" button
Then 1 item should be added to my cart
And I should see a confirmation message

Rule: Cart total must be calculated correctly
Scenario Outline: Verifying cart calculations with different quantities
Given I have added a "<product>" with price $<price> to my cart
When I update the quantity to <quantity>
Then the item subtotal should be $<subtotal>
And the cart total should include the subtotal

Examples:
| product | price | quantity | subtotal |
| Headphones | 50.00 | 2 | 100.00 |
| Charger | 25.00 | 3 | 75.00 |
| Case | 15.99 | 1 | 15.99 |

Rule: Users can adjust quantities of items in cart
Scenario: Increasing item quantity
Given I have added a "Tablet" with price $199.99 to my cart
When I increase the quantity to 2
Then the cart should contain 2 "Tablet" items
And the item subtotal should be $399.98

Scenario: Removing an item from the cart
Given I have added a "Laptop" with price $899.99 to my cart
When I click the "Remove" button for this item
Then the item should be removed from my cart
And my cart should be empty
But the item should be available for future purchase

Rule: Checkout process requires valid payment information
@critical @payment
Scenario: Proceeding to checkout with valid payment details
Given I have added a "Monitor" with price $249.99 to my cart
And I have proceeded to the checkout page
When I enter valid shipping information
And I enter valid payment details
| Card Type | Card Number | Expiry Date | CVV |
| Visa | 4111111111111111 | 12/25 | 123 |
And I confirm the order
Then I should see an order confirmation
And I should receive an email receipt
* My cart should be empty after purchase
Loading