Skip to content
Draft
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 .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
!/apps/
!/libs/
!/tools/
!/astarte-dashboard/

# Standard Elixir gitignore to be applied to all apps
**/_build/
Expand Down
3 changes: 2 additions & 1 deletion .dprint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
},
"excludes": [
"**/node_modules",
"**/*-lock.json"
"**/*-lock.json",
"astarte-dashboard/**"
],
"plugins": [
"https://plugins.dprint.dev/typescript-0.95.13.wasm",
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/astarte-dashboard-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Platform build compatibility
on:
push:
branches:
- master
- "release-*"
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-compatibility.yml"
create:
pull_request:
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-compatibility.yml"

jobs:
build:
name: Node ${{ matrix.node_version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: ./astarte-dashboard
strategy:
matrix:
os:
- ubuntu-latest
node_version:
- 22
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node_version }}
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
**/node_modules
key: ${{ matrix.os }}-${{ matrix.node_version }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci --production
- name: Check App compilation
run: npm run build
env:
CI: false
36 changes: 36 additions & 0 deletions .github/workflows/astarte-dashboard-docker-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test Container Builds
on:
push:
branches:
- "master"
- "release-*"
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-docker-build.yml"
create:
pull_request:
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-docker-build.yml"

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
docker:
name: Test Container Build (astarte-dashboard)
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./astarte-dashboard
file: ./astarte-dashboard/Dockerfile
push: false
53 changes: 53 additions & 0 deletions .github/workflows/astarte-dashboard-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Functionality tests
on:
push:
branches:
- master
- "release-*"
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-tests.yml"
create:
pull_request:
paths:
- "astarte-dashboard/**"
- ".github/workflows/astarte-dashboard-tests.yml"

jobs:
build:
name: Run code quality and funcionality tests
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./astarte-dashboard
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup node.js
uses: actions/setup-node@v4
with:
node-version-file: "astarte-dashboard/.tool-versions"
- name: Get Node.js Version
id: node-version
run: |
echo "version=$(node --version)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
astarte-dashboard/node_modules
key: ${{ runner.os }}-${{ steps.node-version.outputs.version }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
run: npm ci
- name: Check formatting
run: npm run check-format
- name: Check linting
run: npm run check-lint
- name: Check Typescript
run: npm run check-types
- name: Run unit tests
run: npm run test
- name: Start dev server
run: npm run start & npx wait-on http://localhost:8080
- name: Run Cypress tests
run: npm run cypress:test
24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,27 @@ examples/*/.idea/

# Ignore .DS_Store files
.DS_Store

# Astarte Dashboard

# dependencies
astarte-dashboard/node_modules/
astarte-dashboard/.pnp
astarte-dashboard/.pnp.js

# testing
astarte-dashboard/coverage/

# production
astarte-dashboard/dist/
astarte-dashboard/build/

# misc
astarte-dashboard/.env.local
astarte-dashboard/.env.development.local
astarte-dashboard/.env.test.local
astarte-dashboard/.env.production.local

astarte-dashboard/npm-debug.log*
astarte-dashboard/yarn-debug.log*
astarte-dashboard/yarn-error.log*
3 changes: 3 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ ba = "ba"

[default.extend-identifiers]
OTPs = "OTPs"

[files]
extend-exclude = ["astarte-dashboard/**"]
48 changes: 48 additions & 0 deletions astarte-dashboard/.claude/skills/astarte-forward-port/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
name: astarte-forward-port
description: Standardized workflow to cascade bug fixes and changes from older release branches to newer release branches and eventually into master.
---

# Astarte Dashboard Forward-Porting Workflow

## Role

This workflow must be followed to ensure that fixes and changes landed in older `release-X.Y` branches are correctly "forward-ported" (cascaded) to all newer active release branches, and finally into the `master` branch.
The workflow must also be followed when creating a new release on an older `release-X.Y` branch, so that the CHANGELOG.md file in newer release branches includes the section of the released version and presents a coherent release history.

## Understanding the Branch Hierarchy

- **Base Branches**: Fixes target the oldest affected active release branch (e.g., `release-1.1`).
- **Target Branches**: Newer release branches (e.g., `release-1.2`) and finally `master`.
- **Progression Flow**: A fix applied to `release-1.1` must be forward-ported to `release-1.2`. Once merged there, it must be forward-ported from `release-1.2` to `master` (when no `release-1.3` or newer version branches exist).

## Process: How to Forward-Port

When requested to forward port changes from `release-X.Y` to the next branch in the hierarchy (either `release-A.B` or `master`), follow these steps:

1. **Identify the Target Branch**:

- Find the next minor release branch available on the `origin` repository (e.g., if you are porting from `release-1.1`, check if `release-1.2` exists).
- If no newer release branch exists, the ultimate target branch is `master`.

2. **Create the Forward-Port Branch**:

- Check out the _Target Branch_ from the main repository (e.g., `git checkout origin/release-1.2` or `git checkout origin/master`).
- Create a new temporary branch on your personal fork for the forward-port: e.g. `forward-port-release-X.Y-into-<target-branch>`.

3. **Merge the Changes**:

- Fetch the latest changes from the _Source Branch_ (the older branch).
- Perform a merge using the `--no-ff` flag to explicitly record the merge commit:
`git merge --no-ff origin/release-X.Y`
- **Handling Conflicts**: If there are merge conflicts, resolve them carefully, keeping in mind the logic from the newer branch while incorporating the fix from the older branch. Commit the conflict resolution.

4. **Open the Pull Request**:

- Push your newly created forward-port branch to your personal fork.
- Use `gh pr create` to open a Pull Request against the _Target Branch_ on the main repository.
- **Title Naming Convention**: Use the format `Forward port release X.Y into <target-branch>` (e.g., "Forward port release 1.1 into release 1.2" or "Forward port release 1.2 into master").

5. **Continue the Cascade (Iterative Loop)**:
- Once your PR is reviewed and merged into the target branch, the process is not necessarily over.
- If the target branch was a release branch (e.g., `release-1.2`), you MUST repeat steps 1-4 to forward port `release-1.2` into the next branch (e.g., `release-1.3`), and so on, until the changes finally land in `master`.
66 changes: 66 additions & 0 deletions astarte-dashboard/.claude/skills/astarte-release/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: astarte-release
description: Standardized workflow to prepare, tag, and publish a new release for Astarte Dashboard
---

# Astarte Dashboard Release Workflow

This workflow describes Astarte project's release strategy and it must be followed when a release is to be prepared or published.

## Astarte Branching & Release Strategy

- **Base branches**: `master` is the main development branch. Release branches are named `release-X.Y` (e.g., `release-1.2`, `release-1.3`).
- **Versioning**: Strict Semantic Versioning with a `v` prefix for tags (e.g., `v1.2.0`, `v1.3.0-rc.1`, `v1.2.1-alpha.0`).
- **Files to update**: `package.json`, `package-lock.json`, and `CHANGELOG.md`.
- **Changelog format**: Follows "Keep a Changelog". Updates are staged in an `[Unreleased]` section.

## Process: Part 1 - Prepare the Release

When a new release is to be prepared (e.g., v1.3.0):

1. **Determine the target release branch**:

- The target branch should be `release-X.Y` based on the version being released, e.g. `release-1.3` for a `v1.3.2` release.
- Verify if the `release-X.Y` branch exists on the main repository.
- If it does not exist, create the branch on the main repo, branching it off the `master` branch.

2. **Create a preparation branch**:

- Create a new branch on your personal fork (e.g., `prepare-release-v1.3.0`) branching off the target release branch.

3. **Update Versions**:

- Update the `version` field in `package.json` to the new version (without the `v` prefix), and the `version` fields in `package-lock.json` (e.g. manually or by running `npm install`).

4. **Update CHANGELOG.md**:

- Locate the `## [Unreleased]` section.
- Rename the `## [Unreleased]` header with the upcoming release tag and current date, e.g. `## [X.Y.Z(-prerelease)] - YYYY-MM-DD`.
- If there are no unreleased changes, create a new section for the new version with empty appropriate headers (Added, Changed, Fixed, etc.) or whatever is appropriate based on Keep a Changelog.
- Add a new, empty `## [Unreleased]` section at the top of the changelog for future changes.

5. **Commit & Pull Request**:
- Commit the changes with the message: `chore(release): prepare vX.Y.Z`.
- Push the preparation branch to your personal fork.
- Use `gh pr create` to open a Pull Request against the target `release-X.Y` branch on the main repository.
- Ensure you use a descriptive PR title like `chore(release): prepare vX.Y.Z`.

## Process: Part 2 - Tag and Publish the Release

The release must be tagged and published AFTER the preparation PR is merged:

1. **Verify merge**:

- Ensure the preparation PR is merged into the `release-X.Y` branch.
- Fetch the latest changes from the main repository and checkout the `release-X.Y` branch.

2. **Tag the release**:

- Tag the merge commit with the release tag, using a signed and annotated tag (e.g., `git tag -as v1.3.0 -m "Astarte Dashboard v1.3.0 release"`).
- Push the tag to the main repository.

3. **Create GitHub Release**:
- Extract the release notes for this specific version from `CHANGELOG.md`.
- Use the `gh release create` command to create a GitHub release targeting the tag.
- **Important**: The title should be the tag name (e.g., `v1.3.0`). The body should contain the changes reported in the `CHANGELOG.md` for this release, following the existing pattern from previous releases.
- **Prerelease flag**: If the release tag contains `-alpha`, `-beta`, or `-rc` (e.g. `v1.3.0-rc.1`), you MUST append the `--prerelease` flag to the `gh release create` command. Set the release as the latest one with the `--latest` flag only when releasing the highest stable (not prelease) version according to semantic versioning scheme.
2 changes: 2 additions & 0 deletions astarte-dashboard/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.git
node_modules
1 change: 1 addition & 0 deletions astarte-dashboard/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
VITE_APP_VERSION=$npm_package_version
50 changes: 50 additions & 0 deletions astarte-dashboard/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"extends": ["react-app", "plugin:cypress/recommended", "prettier"],
"settings": {
"import/resolver": {
"node": {
"extensions": [".js", ".jsx", ".ts", ".tsx"],
"paths": "src"
}
}
},
"rules": {
"camelcase": 1,
"curly": ["error", "all"],
"import/extensions": [
"error",
"ignorePackages",
{
"js": "never",
"jsx": "never",
"ts": "never",
"tsx": "never"
}
],
"import/no-extraneous-dependencies": ["error", { "devDependencies": true }],
"import/prefer-default-export": "off",
"jsx-a11y/click-events-have-key-events": "off",
"jsx-a11y/label-has-associated-control": "off",
"jsx-a11y/no-static-element-interactions": "off",
"no-case-declarations": "off",
"no-param-reassign": ["error", { "props": true, "ignorePropertyModificationsFor": ["state"] }],
"react/jsx-filename-extension": [
2,
{
"extensions": [".js", ".jsx", ".ts", ".tsx"]
}
],
"react/jsx-props-no-spreading": "off",
"react/no-array-index-key": "off",
"react/prop-types": "off",
"react/require-default-props": "off",
"no-use-before-define": "off",
"@typescript-eslint/no-empty-function": "off",
"@typescript-eslint/no-use-before-define": [
2,
{
"functions": false
}
]
}
}
29 changes: 29 additions & 0 deletions astarte-dashboard/.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
variables:
PROJECT_NAME: "astarte-dashboard"

stages:
- build
- deploy

next:build:
image: node:22.14.0
stage: build
script:
- apt-get -y update
- apt-get -y install netbase build-essential autoconf libffi-dev
- npm ci --production
- npm run deploy

docker:snapshot-container:
image: docker:stable
before_script:
- docker info
- docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN $DOCKER_REGISTRY
services:
- docker:stable-dind
stage: deploy
only:
- master@Astarte-NG/astarte-dashboard
script:
- docker build -t $DOCKER_REGISTRY/astarte-ng/astarte-dashboard:snapshot .
- docker push $DOCKER_REGISTRY/astarte-ng/astarte-dashboard:snapshot
5 changes: 5 additions & 0 deletions astarte-dashboard/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"printWidth": 100,
"singleQuote": true,
"trailingComma": "all"
}
Loading
Loading