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

Switch to pnpm and ember dependency updates #782

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
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
32 changes: 21 additions & 11 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,47 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
day: "friday"
time: "12:00"
timezone: "Europe/Zurich"
commit-message:
prefix: chore
include: scope

- package-ecosystem: pip
directory: "/"
schedule:
interval: weekly
day: friday
time: "12:00"
timezone: "Europe/Zurich"
commit-message:
prefix: chore
include: scope
ignore:
- dependency-name: django
versions:
- ">=3.3"
commit-message:
prefix: chore
include: scope

- package-ecosystem: docker
directory: "/"
schedule:
interval: weekly
day: friday
time: "12:00"
timezone: "Europe/Zurich"
commit-message:
prefix: chore
include: scope
ignore:
- dependency-name: python
versions:
- ">=3.10"
commit-message:
prefix: chore
include: scope

- package-ecosystem: npm
directory: "/ember"
schedule:
Expand All @@ -40,11 +54,7 @@ updates:
prefix: chore
include: scope
ignore:
# mirror part of https://github.com/projectcaluma/ember-caluma/blob/main/.github/dependabot.yml
# mirror part of https://github.com/projectcaluma/ember-caluma/blob/main/.github/dependabot.yaml
- dependency-name: graphql
versions:
- ">= 16"
# https://github.com/ember-cli/ember-cli/issues/9307
- dependency-name: eslint
versions:
- ">= 8"
39 changes: 22 additions & 17 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
pull_request:
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

env:
ember-dir: ./ember
Expand All @@ -13,7 +13,7 @@ jobs:
api-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set UID
run: echo "UID=$(id --user)" > .env
- name: Build the containers
Expand All @@ -24,65 +24,70 @@ jobs:
run: docker compose exec -T api poetry run ./manage.py makemigrations --check --dry-run --no-input
- name: Run test suite
run: make api-test

caluma-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set UID
run: echo "UID=$(id --user)" > .env
- name: Build the containers
run: docker compose up -d --build caluma db
- name: Run test suite
run: make caluma-test

caluma-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
cache: 'poetry'
python-version: "3.9"
cache: "poetry"
- name: Install dependencies
run: poetry install --directory=api
- name: Run test suite
run: make caluma-lint

ember-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: wyvox/action-setup-pnpm@v3
with:
node-version: 16
node-version: 18
- name: Install dependencies
run: yarn install
run: pnpm install
working-directory: ${{env.ember-dir}}
- name: Lint the code
run: yarn lint
run: pnpm run lint
working-directory: ${{env.ember-dir}}
- name: Run tests
run: yarn test:ember
run: pnpm run test:ember
working-directory: ${{env.ember-dir}}

ember-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set UID
run: echo "UID=$(id --user)" > .env
- name: Build and start the container
run: docker compose up -d --build ember

commit-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: "3.9"
- name: Install gitlint
run: pip install gitlint
- name: Run gitlint
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ caluma-foreground: ## run caluma in foreground with dev server for debugging

.PHONY: ember-lint
ember-lint: ## lint the frontend
@docker compose run --rm ember yarn lint
@docker compose run --rm ember pnpm run lint

.PHONY: ember-lint-fix
ember-lint-fix: ## lint and fix the frontend
@docker compose run --rm ember yarn lint:js --fix
@docker compose run --rm ember pnpm run lint:js --fix

.PHONY: ember-test
ember-test: ## test the frontend
@docker compose run --rm ember yarn test:ember
@docker compose run --rm ember pnpm run test:ember
2 changes: 1 addition & 1 deletion ember/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

module.exports = {
extends: ["@adfinis-sygroup/eslint-config/ember-app"],
extends: ["@adfinis/eslint-config/ember-app"],

settings: { "import/internal-regex": "^mysagw/" },

Expand Down
10 changes: 6 additions & 4 deletions ember/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
FROM danlynn/ember-cli:3.28.5 as build
FROM danlynn/ember-cli:4.12.1 as build

ARG OIDC_HOST

COPY package.json yarn.lock /myapp/
COPY package.json pnpm-lock.yaml /myapp/

RUN yarn install
RUN npm install -g pnpm

RUN pnpm install

COPY . /myapp/

RUN yarn deploy production
RUN pnpm run deploy production

FROM nginx:alpine

Expand Down
6 changes: 3 additions & 3 deletions ember/app/abilities/-base.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class BaseAbility extends Ability {
(member) =>
member.authorized &&
!member.isInactive &&
this.isOwnIdentity(member.identity.get("idpId"))
this.isOwnIdentity(member.identity.get("idpId")),
);
}

Expand All @@ -55,8 +55,8 @@ export default class BaseAbility extends Ability {
return Boolean(
calumaCase.accesses.findBy(
"identity.idpId",
this.session.data.authenticated.userinfo.sub
)
this.session.data.authenticated.userinfo.sub,
),
);
}
}
2 changes: 1 addition & 1 deletion ember/app/abilities/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class CaseAbility extends BaseAbility {
*/
return (
ENV.APP.caluma.redoableTaskSlugs.includes(
this.model.redoWorkItem?.task.slug
this.model.redoWorkItem?.task.slug,
) &&
this.isStaffOrAdmin &&
(this.model.canRedoWorkItem ||
Expand Down
4 changes: 2 additions & 2 deletions ember/app/adapters/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ export default class ApplicationAdapter extends OIDCJSONAPIAdapter {
urlForCreateRecord(modelName, snapshot) {
return this._appendInclude(
super.urlForCreateRecord(modelName, snapshot),
snapshot.adapterOptions
snapshot.adapterOptions,
);
}

urlForUpdateRecord(id, modelName, snapshot) {
return this._appendInclude(
super.urlForUpdateRecord(id, modelName, snapshot),
snapshot.adapterOptions
snapshot.adapterOptions,
);
}

Expand Down
16 changes: 8 additions & 8 deletions ember/app/caluma-query/models/case.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default class CustomCaseModel extends CaseModel {
get hasEditableWorkItem() {
return this.workItems
.filter((workItem) =>
ENV.APP.caluma.documentEditableTaskSlugs.includes(workItem.task.slug)
ENV.APP.caluma.documentEditableTaskSlugs.includes(workItem.task.slug),
)
.isAny("status", "READY");
}
Expand All @@ -42,7 +42,7 @@ export default class CustomCaseModel extends CaseModel {
(workItem) =>
(workItem.task.slug === ENV.APP.caluma.submitTaskSlug ||
workItem.task.slug === ENV.APP.caluma.reviseTaskSlug) &&
workItem.status === "READY"
workItem.status === "READY",
);
}

Expand All @@ -51,22 +51,22 @@ export default class CustomCaseModel extends CaseModel {
return this.workItems.find(
(workItem) =>
workItem.status === "COMPLETED" &&
workItem.task.slug === "decision-and-credit"
workItem.task.slug === "decision-and-credit",
);
}

return this.workItems.find(
(workItem) =>
(workItem.status === "COMPLETED" || workItem.status === "SKIPPED") &&
ENV.APP.caluma.redoableTaskSlugs.includes(workItem.task.slug)
ENV.APP.caluma.redoableTaskSlugs.includes(workItem.task.slug),
);
}

get canRedoWorkItem() {
return this.workItems.find(
(workItem) =>
workItem.status === "READY" &&
ENV.APP.caluma.canRedoTaskSlug.includes(workItem.task.slug)
ENV.APP.caluma.canRedoTaskSlug.includes(workItem.task.slug),
);
}

Expand All @@ -77,14 +77,14 @@ export default class CustomCaseModel extends CaseModel {
get documentNumber() {
return this.document.answers.edges.findBy(
"node.question.slug",
"dossier-nr"
"dossier-nr",
)?.node.StringAnswerValue;
}

get distributionPlan() {
const answer = this.document.answers.edges.findBy(
"node.question.slug",
"verteilplan-nr"
"verteilplan-nr",
)?.node;

if (!answer) {
Expand All @@ -93,7 +93,7 @@ export default class CustomCaseModel extends CaseModel {

return answer.question.options.edges.findBy(
"node.slug",
answer.StringAnswerValue
answer.StringAnswerValue,
).node.label;
}

Expand Down
4 changes: 2 additions & 2 deletions ember/app/caluma-query/models/work-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class CustomWorkItemModel extends WorkItemModel {

get isAssignedToCurrentUser() {
return this.assignedUsers.includes(
this.session.data.authenticated.userinfo.sub
this.session.data.authenticated.userinfo.sub,
);
}

Expand Down Expand Up @@ -90,7 +90,7 @@ export default class CustomWorkItemModel extends WorkItemModel {

async assignToMe() {
return await this.assignToUser(
this.session.data.authenticated.userinfo.sub
this.session.data.authenticated.userinfo.sub,
);
}

Expand Down
2 changes: 1 addition & 1 deletion ember/app/models/additional-email.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { attr, belongsTo } from "@ember-data/model";
import { LocalizedModel, localizedAttr } from "ember-localized-model";

export default class AdditionalEmailModel extends LocalizedModel {
@belongsTo("identity") identity;
@belongsTo("identity", { inverse: "additionalEmails", async: true }) identity;
@attr email;
@localizedAttr description;
}
2 changes: 1 addition & 1 deletion ember/app/models/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { LocalizedModel, localizedAttr } from "ember-localized-model";
export default class AddressModel extends LocalizedModel {
@service intl;

@belongsTo("identity") identity;
@belongsTo("identity", { inverse: "address", async: true }) identity;
@attr addressAddition1;
@attr addressAddition2;
@attr addressAddition3;
Expand Down
2 changes: 1 addition & 1 deletion ember/app/models/case-access.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Model, { attr, belongsTo } from "@ember-data/model";
export default class CaseAccessModel extends Model {
@attr caseId;
@attr email;
@belongsTo("identity", { async: false }) identity;
@belongsTo("identity", { inverse: null, async: false }) identity;

get name() {
return (
Expand Down
2 changes: 1 addition & 1 deletion ember/app/models/identity.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default class IdentityModel extends LocalizedModel {
additionalEmails;
@hasMany("phone-number", { inverse: "identity", async: true }) phoneNumbers;
@hasMany("address", { inverse: "identity", async: true }) address;
@hasMany("interest", { async: true }) interests;
@hasMany("interest", { inverse: null, async: true }) interests;

@hasMany("membership", { inverse: "identity", async: true }) memberships;
@hasMany("membership", { inverse: "organisation", async: true }) members;
Expand Down
2 changes: 1 addition & 1 deletion ember/app/models/membership.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export { membershipInactive };
export default class MembershipModel extends LocalizedModel {
@belongsTo("identity", { inverse: "memberships", async: true }) identity;
@belongsTo("identity", { inverse: "members", async: true }) organisation;
@belongsTo("membership-role", { async: true }) role;
@belongsTo("membership-role", { inverse: null, async: true }) role;
@attr authorized;
@attr timeSlot;
@attr nextElection;
Expand Down
Loading
Loading