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

Dependency update #121

Merged
merged 3 commits into from
Oct 25, 2023
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
8 changes: 4 additions & 4 deletions .github/workflows/actions/merge-ff-only/action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: 'Merge Fast Forward'
description: 'Merge two branches with --ff-only'
name: "Merge Fast Forward"
description: "Merge two branches with --ff-only"
inputs:
base-ref:
description: 'base branch for merging'
description: "base branch for merging"
required: true
target-ref:
description: 'target branch for merging'
description: "target branch for merging"
required: true
runs:
using: "composite"
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/bom.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: SBOM

on:
push:
branches: [main]

workflow_dispatch:

jobs:
bom:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18]

steps:
- name: Checkout 🛎️
uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.version }}
cache: "npm"

- name: Install @cyclonedx/cyclonedx-npm
run: npm install @cyclonedx/cyclonedx-npm --no-save

- name: Generate BOM
run: npm exec -- cyclonedx-npm --output-format XML --output-file bom.xml

- name: Push BOM to Dependency Track
env:
PROJECT_NAME: bkd-evento-portal
run: |
curl --verbose -s --location --request POST ${{vars.DEPENDENCY_TRACK_URL}}/api/v1/bom \
--header "X-Api-Key: ${{secrets.DEPENDENCY_TRACK_API_KEY}}" \
--header "Content-Type: multipart/form-data" \
--form "autoCreate=true" \
--form "projectName=$PROJECT_NAME" \
--form "projectVersion=latest" \
--form "[email protected]"
10 changes: 5 additions & 5 deletions .github/workflows/container-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ jobs:
if: github.ref_name == 'test'
uses: ./.github/workflows/actions/merge-ff-only
with:
target-ref: 'test'
base-ref: 'main'
target-ref: "test"
base-ref: "main"

- name: merge into production
if: github.ref_name == 'production'
uses: ./.github/workflows/actions/merge-ff-only
with:
target-ref: 'production'
base-ref: 'test'
target-ref: "production"
base-ref: "test"

container-prerequisites:
runs-on: ubuntu-latest
Expand All @@ -51,7 +51,7 @@ jobs:

# If the current commit has no version tag, an image needs to be
# built, tagged and pushed to the registry
# If the build runs on test but test has already been built
# If the build runs on test but test has already been built
# with the latest tag, nothing happens
container-build-and-push-image:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hotfix-container-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

# If the current commit has no version tag, an image needs to be
# built, tagged and pushed to the registry
# If the build runs on test but test has already been built
# If the build runs on test but test has already been built
# with the latest tag, nothing happens
container-build-and-push-image:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Lint & Test ✨](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/test.yml)
[![Build & Deploy ZIP 📦](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/zip.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/zip.yml)
[![Build & Push Docker Image 🚀](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/docker.yml/badge.svg)](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/docker.yml)
[![SBOM](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/bom.yml/badge.svg?branch=main)](https://github.com/bkd-mba-fbi/evento-portal/actions/workflows/bom.yml)

The _Evento Portal_ is used to integrate various applications for school administration in a single web portal with a common look and feel.

Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/locale.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ describe("Locale", () => {
locale: "de-CH",
roles: ["LessonTeacherRole", "TeacherRole"],
permissions: [],
})
}),
);

it("uses de-CH", () => {
Expand All @@ -31,7 +31,7 @@ describe("Locale", () => {
locale: "fr-CH",
roles: ["LessonTeacherRole", "TeacherRole"],
permissions: [],
})
}),
);

it("uses fr-CH", () => {
Expand Down
11 changes: 7 additions & 4 deletions cypress/e2e/navigationMenu.cy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
describe("Navigation Menu", () => {
describe("with 'LessonTeacherRole' & 'TeacherRole' roles", () => {
beforeEach(() =>
cy.login({ roles: ["LessonTeacherRole", "TeacherRole"], permissions: [] })
cy.login({
roles: ["LessonTeacherRole", "TeacherRole"],
permissions: [],
}),
);

describe("desktop", () => {
Expand All @@ -18,7 +21,7 @@ describe("Navigation Menu", () => {
.find("a")
.should(($links) => {
expect(
$links.toArray().map((link) => link.textContent?.trim())
$links.toArray().map((link) => link.textContent?.trim()),
).to.deep.eq(["Unterricht", "Absenzen", "Angebote"]);
});
});
Expand Down Expand Up @@ -46,7 +49,7 @@ describe("Navigation Menu", () => {
.find("a[role='menuitem']")
.should(($links) => {
expect(
$links.toArray().map((link) => link.textContent?.trim())
$links.toArray().map((link) => link.textContent?.trim()),
).to.deep.eq([
"Präsenzkontrolle",
"Aktuelle Fächer",
Expand Down Expand Up @@ -376,7 +379,7 @@ describe("Navigation Menu", () => {

function expectGroupItems(
group: string,
expectedItems: ReadonlyArray<string>
expectedItems: ReadonlyArray<string>,
) {
return cy.contains("li.group > button", group).should((groupToggle) => {
const items = groupToggle
Expand Down
18 changes: 9 additions & 9 deletions cypress/e2e/navigationRouting.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/dashboard"
"apps/webapp-schulverwaltung/index.html#/dashboard",
);
});

Expand Down Expand Up @@ -106,7 +106,7 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/presence-control"
"apps/webapp-schulverwaltung/index.html#/presence-control",
);

// Does not redirect to home
Expand Down Expand Up @@ -163,7 +163,7 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/dashboard"
"apps/webapp-schulverwaltung/index.html#/dashboard",
);

// Does not redirect to home
Expand All @@ -187,7 +187,7 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/dashboard"
"apps/webapp-schulverwaltung/index.html#/dashboard",
);

// Updates URL to ?module=home
Expand Down Expand Up @@ -237,13 +237,13 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/presence-control"
"apps/webapp-schulverwaltung/index.html#/presence-control",
);
});

it("visits profile (a specific sub app path of an item)", () => {
cy.visit(
"index.html?locale=de-CH&module=presenceControl#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257"
"index.html?locale=de-CH&module=presenceControl#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257",
);
cy.get("bkd-nav").as("desktopMenu").should("be.visible");

Expand All @@ -258,7 +258,7 @@ describe("Navigation & Routing", () => {
.should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257"
"apps/webapp-schulverwaltung/index.html#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257",
)
.its("0.contentDocument.body")
.should("contain", "Profil wurde nicht gefunden");
Expand All @@ -268,7 +268,7 @@ describe("Navigation & Routing", () => {
const url = new URL(window.location.href);
expect(url.searchParams.get("module")).to.eq("presenceControl");
expect(url.hash).to.eq(
"#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257"
"#/presence-control/student/5389/absences?returnparams=date%3D2023-07-03%26viewMode%3Dgrid%26lesson%3D291257",
);
});
});
Expand All @@ -284,7 +284,7 @@ describe("Navigation & Routing", () => {
cy.get("iframe").should(
"have.attr",
"src",
"apps/webapp-schulverwaltung/index.html#/presence-control"
"apps/webapp-schulverwaltung/index.html#/presence-control",
);
cy.get("button[aria-label='Menü']").as("toggle").should("be.visible");

Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/serviceNavigation.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ describe("Service Navigation", () => {
.find("a")
.should((links) =>
expect(
links.toArray().map((link) => link.textContent?.trim())
links.toArray().map((link) => link.textContent?.trim()),
).to.deep.eq([
"Mein Profil",
"Einstellungen",
"Video-Tutorials",
"Logout",
])
]),
);
});

Expand Down Expand Up @@ -118,8 +118,8 @@ describe("Service Navigation", () => {
.find("a")
.should((links) =>
expect(
links.toArray().map((link) => link.textContent.trim())
).to.deep.eq(["de", "fr"])
links.toArray().map((link) => link.textContent.trim()),
).to.deep.eq(["de", "fr"]),
);
});
});
Expand Down Expand Up @@ -147,15 +147,15 @@ describe("Service Navigation", () => {
.find("a")
.should((links) =>
expect(
links.toArray().map((link) => link.textContent?.trim())
links.toArray().map((link) => link.textContent?.trim()),
).to.deep.eq([
"Mein Profil",
"Einstellungen",
"Video-Tutorials",
"Logout",
"de",
"fr",
])
]),
);
});
});
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/substitutions.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("Substitutions", () => {
Substitution: "Billy Preston",
SubstitutionId: 20,
},
]
],
);
}

Expand All @@ -58,7 +58,7 @@ describe("Substitutions", () => {
.spy((req) => {
req.redirect(`${Cypress.config("baseUrl")}/index.html`, 301);
})
.as("startRequest")
.as("startRequest"),
);

cy.intercept(
Expand All @@ -68,7 +68,7 @@ describe("Substitutions", () => {
.spy((req) => {
req.redirect(`${Cypress.config("baseUrl")}/index.html`, 301);
})
.as("stopRequest")
.as("stopRequest"),
);

cy.clock(now);
Expand Down
16 changes: 8 additions & 8 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,27 +67,27 @@ Cypress.Commands.add(
oAuthClientId: "cypress",
},
};
`
`,
);

cy.intercept(
"GET",
"https://eventotest.api/restApi/UserSettings/?expand=AccessInfo",
{ AccessInfo: { Roles: roles, Permissions: permissions } }
{ AccessInfo: { Roles: roles, Permissions: permissions } },
).as("fetchAccessInfo");

cy.intercept(
"GET",
"https://eventotest.api/restApi/Configurations/SchoolAppNavigation",
{ instanceName: "Test" }
{ instanceName: "Test" },
);

cy.intercept(
"GET",
"https://eventotest.api/restApi/TeacherSubstitutions/current",
[]
[],
);
}
},
);

/**
Expand All @@ -102,7 +102,7 @@ function createToken(
locale: string;
roles: ReadonlyArray<string>;
additionalTokenPayload: Record<string, unknown>;
}> = {}
}> = {},
) {
const header = {
typ: "JWT",
Expand Down Expand Up @@ -131,7 +131,7 @@ function createToken(
};

return `${btoa(JSON.stringify(header))}.${btoa(
JSON.stringify(body)
JSON.stringify(body),
)}.signature`;
}

Expand Down Expand Up @@ -164,5 +164,5 @@ Cypress.Commands.add(
expect(value).to.be.oneOf(["false", "", undefined]);
}
return subject;
})
}),
);
2 changes: 1 addition & 1 deletion cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare global {
roles: ReadonlyArray<string>;
permissions: ReadonlyArray<string>;
additionalTokenPayload: Record<string, unknown>;
}>
}>,
): Chainable<void>;

/**
Expand Down
4 changes: 2 additions & 2 deletions doc/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ This chapter desciprtes how you can deploy new releases with github actions. The
3. Click on the `Run workflow` button, a tooltip will open. It contains a dropdown button, from which you can choose a branch.

4. Always choose the branch you want to deploy a new version from. If you want to merge `main` into `test` and release a new test image, choose `test`. If you want to deploy production, choose `production`

![Release Workflow](assets/images/release_step_3_4.png)

### Hotfix Release Cycle

2. On the left list select the Workflow `HotFix Build and Push 🔥🚒`
2. On the left list select the Workflow `HotFix Build and Push 🔥🚒`

![Release Workflow](assets/images/hotfix_step_2.png)

Expand Down
Loading