Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/2.3.2 #2872

Merged
merged 2 commits into from
Aug 7, 2024
Merged
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
71 changes: 44 additions & 27 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ env:

jobs:
elixir-deps:
name: Elixir dependencies
name: Elixir ${{ matrix.mix_env }} dependencies
runs-on: ubuntu-20.04
strategy:
matrix:
include:
- mix_env: dev
- mix_env: test
env:
MIX_ENV: ${{ matrix.mix_env }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -44,7 +51,7 @@ jobs:
with:
path: |
deps
_build/test
_build/${{ matrix.mix_env }}
priv/plts
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.otp-version }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}
- name: Install Dependencies
Expand Down Expand Up @@ -454,6 +461,16 @@ jobs:
]
runs-on: ubuntu-22.04
if: needs.check-regression-label.outputs.run_regression_test == 'true'
strategy:
matrix:
include:
- test: sap_system_split
cypress_spec: |
cypress/e2e/databases_overview.cy.js
cypress/e2e/sap_systems_overview.cy.js
- test: process_manager_rename
cypress_spec: |
cypress/e2e/host_details.cy.js
env:
MIX_ENV: dev
steps:
Expand Down Expand Up @@ -509,13 +526,13 @@ jobs:
uses: tj-actions/pg-restore@v6
with:
database_url: "postgresql://postgres:postgres@localhost:5433/postgres"
backup_file: "test/fixtures/regression/sap_system_split/trento_dev.sql"
backup_file: "test/fixtures/regression/${{ matrix.test }}/trento_dev.sql"
postgresql_version: "15"
- name: Postgres trento_eventstore_dev restore
uses: tj-actions/pg-restore@v6
with:
database_url: "postgresql://postgres:postgres@localhost:5433/postgres"
backup_file: "test/fixtures/regression/sap_system_split/trento_eventstore_dev.sql"
backup_file: "test/fixtures/regression/${{ matrix.test }}/trento_eventstore_dev.sql"
postgresql_version: "15"
- name: Run DB migrations
run: mix ecto.migrate
Expand All @@ -542,51 +559,51 @@ jobs:
cypress_photofinish_binary: $(whereis photofinish | cut -d" " -f2)
with:
working-directory: test/e2e
spec: |
cypress/e2e/databases_overview.cy.js
cypress/e2e/sap_systems_overview.cy.js
spec: ${{ matrix.cypress_spec }}
wait-on-timeout: 30
config: baseUrl=http://localhost:4000
- name: Upload cypress test screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: regression-e2e-screenshots
name: regression-${{ matrix.test }}-e2e-screenshots
path: test/e2e/cypress/screenshots/

main-branch-deps:
name: Rebuild main branch dependencies
target-branch-deps:
name: Rebuild target branch dependencies
runs-on: ubuntu-20.04
env:
BRANCH_NAME: ${{ github.event.pull_request.base.ref || github.ref_name }}
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
if: github.ref_name != 'main'
if: github.ref_name != '${{ env.BRANCH_NAME }}'
with:
access_token: ${{ github.token }}
- name: Checkout main branch
- name: Checkout target branch
uses: actions/checkout@v4
if: github.ref_name != 'main'
if: github.ref_name != '${{ env.BRANCH_NAME }}'
with:
ref: main
ref: ${{ env.BRANCH_NAME }}
- name: Set up Elixir
id: setup-elixir
uses: erlef/setup-beam@v1
if: github.ref_name != 'main'
if: github.ref_name != '${{ env.BRANCH_NAME }}'
with:
version-file: .tool-versions
version-type: strict
- name: Retrieve Cached Dependencies - main branch
- name: Retrieve Cached Dependencies - target branch
uses: actions/cache@v4
id: mix-cache-main
if: github.ref_name != 'main'
id: mix-cache-target
if: github.ref_name != '${{ env.BRANCH_NAME }}'
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.otp-version }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}
- name: Install missing dependencies
if: steps.mix-cache-main.outputs.cache-hit != 'true' && github.ref_name != 'main'
if: steps.mix-cache-target.outputs.cache-hit != 'true' && github.ref_name != '${{ env.BRANCH_NAME }}'
run: |
mkdir -p priv/plts
mix local.rebar --force
Expand All @@ -597,7 +614,7 @@ jobs:

api-bc-check:
name: API bc check
needs: [elixir-deps, main-branch-deps]
needs: [elixir-deps, target-branch-deps]
runs-on: ubuntu-20.04
strategy:
matrix:
Expand Down Expand Up @@ -630,28 +647,28 @@ jobs:
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/current-spec.json

- name: Checkout main branch
- name: Checkout target branch
uses: actions/checkout@v4
with:
ref: main
- name: Retrieve Cached Dependencies - main branch
ref: ${{ github.event.pull_request.base.ref || github.ref_name }}
- name: Retrieve Cached Dependencies - target branch
uses: actions/cache@v4
id: mix-cache-main
id: mix-cache-target
with:
path: |
deps
_build/test
priv/plts
key: ${{ runner.os }}-${{ steps.setup-elixir.outputs.otp-version }}-${{ steps.setup-elixir.outputs.elixir-version }}-${{ hashFiles('mix.lock') }}
- name: Generate main openapi.json
- name: Generate target openapi.json
run: |
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/main-spec.json
mix openapi.spec.json --start-app=false --spec TrentoWeb.OpenApi.${{ matrix.version }}.ApiSpec /tmp/specs/target-spec.json
- name: Locate generated specs
run: mv /tmp/specs .
- name: Find difference between OpenAPI specifications
run: |
docker run -v "$(pwd)/specs:/specs" --rm openapitools/openapi-diff:2.0.1 \
/specs/main-spec.json \
/specs/target-spec.json \
/specs/current-spec.json \
--fail-on-incompatible \
--markdown /specs/changes.md \
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [2.3.2](https://github.com/trento-project/web/tree/2.3.2) (2024-07-24)

[Full Changelog](https://github.com/trento-project/web/compare/2.3.1...2.3.2)

**Fixed bugs:**

- Fix process manager rename [\#2814](https://github.com/trento-project/web/pull/2814) ([arbulu89](https://github.com/arbulu89))

## [2.3.1](https://github.com/trento-project/web/tree/2.3.1) (2024-06-10)

[Full Changelog](https://github.com/trento-project/web/compare/2.3.0...2.3.1)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
defmodule Trento.DeregistrationProcessManager do
@moduledoc """
Legacy DeregistrationProcessManager module
"""

def superseded_by,
do: Trento.Infrastructure.Commanded.ProcessManagers.DeregistrationProcessManager
end
15 changes: 11 additions & 4 deletions lib/trento/support/jsonb_serializer.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ defmodule Trento.Support.JsonbSerializer do
the event is wrapped in an `IntermediateEvent` struct.
The upcaster protocol is implemented for `IntermediateEvent` and it will take care of calling the `new!/1` function
after the upcasting is done.
If a process manager supports superseding because it was renamed (i.e. it has a `superseded_by/0` function),
the snapshotted process manager is superseded by the new module.
"""
def deserialize(term, config) do
case Keyword.get(config, :type) do
Expand All @@ -35,10 +37,15 @@ defmodule Trento.Support.JsonbSerializer do
module = String.to_existing_atom(type)
Code.ensure_loaded?(module)

if Kernel.function_exported?(module, :upcast, 2) do
%IntermediateEvent{module: module, term: term}
else
module.new!(term)
cond do
Kernel.function_exported?(module, :upcast, 2) ->
%IntermediateEvent{module: module, term: term}

Kernel.function_exported?(module, :superseded_by, 0) ->
module.superseded_by().new!(term)

true ->
module.new!(term)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Trento.MixProject do
use Mix.Project

@source_url "https://github.com/trento-project/web"
@version "2.3.1"
@version "2.3.2"

def project do
[
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trento-e2e-tests",
"version": "2.3.1",
"version": "2.3.2",
"description": "E2E testing for Trento",
"scripts": {
"cypress:open": "cypress open",
Expand Down
Loading
Loading