From 29a0cdba3b9669d4c3bd0ba4beb0fe91525ce349 Mon Sep 17 00:00:00 2001 From: Patrick Pacher <patrick.pacher@gmail.com> Date: Fri, 29 Mar 2024 09:50:47 +0100 Subject: [PATCH] Add github actions workflow for angular --- .github/dependabot.yml | 10 ++ .github/workflows/angular.yml | 61 +++++++ .github/workflows/go.yml | 12 +- .github/workflows/tauri.yml | 38 +++++ Earthfile | 9 +- desktop/angular/.eslintrc.json | 3 + desktop/angular/package.json | 1 - .../angular/src/app/pages/support/pages.ts | 14 +- desktop/angular/tslint.json | 153 ------------------ 9 files changed, 131 insertions(+), 170 deletions(-) create mode 100644 .github/workflows/angular.yml create mode 100644 .github/workflows/tauri.yml delete mode 100644 desktop/angular/tslint.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml index f6150ead..6ac2829d 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -9,3 +9,13 @@ updates: directory: "/" schedule: interval: "daily" + + - package-ecosystem: "npm" + directory: "/desktop/angular" + schedule: + interval: "daily" + + - package-ecosystem: "cargo" + directory: "/desktop/tauri" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml new file mode 100644 index 00000000..eef0b8fa --- /dev/null +++ b/.github/workflows/angular.yml @@ -0,0 +1,61 @@ +name: Angular + +on: + push: + paths: + - 'desktop/angular/**' + branches: + - master + - develop + - migration/mono-repo + + pull_request: + paths: + - 'desktop/angular/**' + branches: + - master + - develop + - migration/mono-repo + +jobs: + lint: + name: Linter + runs-on: ubuntu-latest + defaults: + run: + working-directory: desktop/angular + + steps: + - name: Check out code + uses: actions/checkout@v4 + + - uses: actions/setup-node@v3 + with: + node-version: 18 + + - run: npm install + + - uses: sibiraj-s/action-eslint@v3 + with: + annotations: true + extensions: 'ts,html' + working-directory: desktop/angular + + test: + name: Build + runs-on: ubuntu-latest + steps: + - uses: earthly/actions-setup@v1 + with: + version: v0.8.0 + - uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build angular projects + run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +build-angular diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 8362ac6d..2aaa9639 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -45,5 +45,13 @@ jobs: with: version: v0.8.0 - uses: actions/checkout@v4 - - name: Run tests - run: earthly --ci +test-go --TESTFLAGS="-short" + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build angular projects + run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +test-go --TESTFLAGS="-short" diff --git a/.github/workflows/tauri.yml b/.github/workflows/tauri.yml new file mode 100644 index 00000000..0ffc5c7a --- /dev/null +++ b/.github/workflows/tauri.yml @@ -0,0 +1,38 @@ +name: Tauri + +on: + push: + paths: + - 'desktop/tauri/**' + branches: + - master + - develop + - migration/mono-repo + + pull_request: + paths: + - 'desktop/tauri/**' + branches: + - master + - develop + - migration/mono-repo + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - uses: earthly/actions-setup@v1 + with: + version: v0.8.0 + - uses: actions/checkout@v4 + + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build angular projects + run: earthly --ci --remote-cache=ghcr.io/safing/build-cache --push +tauri-release diff --git a/Earthfile b/Earthfile index 12b4aeb8..4df0dbfc 100644 --- a/Earthfile +++ b/Earthfile @@ -66,11 +66,11 @@ go-base: LET version = $(git tag --points-at) IF [ "${version}" = "" ] - SET version = $(git describe --tags --abbrev=0 || echo "dev build") + SET version = $(git describe --tags --abbrev=0 || echo "dev_build") END ENV VERSION="${version}" - LET source = $( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown source" ) + LET source = $( ( git remote -v | cut -f2 | cut -d" " -f1 | head -n 1 ) || echo "unknown_source" ) ENV SOURCE="${source}" # updates all go dependencies and runs go mod tidy, saving go.mod and go.sum locally. @@ -222,6 +222,11 @@ angular-project: SAVE ARTIFACT "./${project}.zip" AS LOCAL ${outputDir}/${project}.zip SAVE ARTIFACT "./dist" AS LOCAL ${outputDir}/${project} +# Builds all angular projects +build-angular: + BUILD +angular-project --project=portmaster --dist=./dist --configuration=development --baseHref=/ui/modules/portmaster/ + BUILD +angular-project --project=tauri-builtin --dist=./dist/tauri-builtin --configuration=development --baseHref=/ + # Build the angular projects (portmaster-UI and tauri-builtin) in production mode angular-release: BUILD +angular-project --project=portmaster --dist=./dist --configuration=production --baseHref=/ui/modules/portmaster/ diff --git a/desktop/angular/.eslintrc.json b/desktop/angular/.eslintrc.json index 4a0b4c0e..8bcdf9d2 100644 --- a/desktop/angular/.eslintrc.json +++ b/desktop/angular/.eslintrc.json @@ -3,6 +3,9 @@ "ignorePatterns": [ "projects/**/*" ], + "parserOptions": { + "tsconfigRootDir": "desktop/angular" + }, "overrides": [ { "files": [ diff --git a/desktop/angular/package.json b/desktop/angular/package.json index 21207615..c1c058c8 100644 --- a/desktop/angular/package.json +++ b/desktop/angular/package.json @@ -96,7 +96,6 @@ "protractor": "~7.0.0", "tailwindcss": "^3.3.2", "ts-node": "^10.9.1", - "tslint": "~6.1.0", "typescript": "4.9", "webpack-bundle-analyzer": "^4.8.0", "webpack-ext-reloader": "^1.1.9", diff --git a/desktop/angular/src/app/pages/support/pages.ts b/desktop/angular/src/app/pages/support/pages.ts index 83cdcc67..af0f650c 100644 --- a/desktop/angular/src/app/pages/support/pages.ts +++ b/desktop/angular/src/app/pages/support/pages.ts @@ -117,12 +117,7 @@ export const supportTypes: PageSections[] = [ includeDebugData: true, privateTicket: true, ghIssuePreset: "report-bug.md", - repositories: [ - { repo: 'portmaster', name: 'Portmaster Core' }, - { repo: 'portmaster-ui', name: 'User Interface' }, - { repo: 'portmaster-packaging', name: 'Packaging & Installers' }, - { repo: 'spn', name: 'SPN' }, - ] + repositories: [] }, { id: "give-feedback", @@ -140,12 +135,7 @@ export const supportTypes: PageSections[] = [ includeDebugData: false, privateTicket: true, ghIssuePreset: "suggest-feature.md", - repositories: [ - { repo: 'portmaster', name: 'Portmaster Core' }, - { repo: 'portmaster-ui', name: 'User Interface' }, - { repo: 'portmaster-packaging', name: 'Packaging & Installers' }, - { repo: 'spn', name: 'SPN' }, - ] + repositories: [] }, { id: "compatibility-report", diff --git a/desktop/angular/tslint.json b/desktop/angular/tslint.json deleted file mode 100644 index eba6f798..00000000 --- a/desktop/angular/tslint.json +++ /dev/null @@ -1,153 +0,0 @@ -{ - "extends": "tslint:recommended", - "rules": { - "align": { - "options": [ - "parameters", - "statements" - ] - }, - "array-type": false, - "arrow-return-shorthand": true, - "curly": true, - "deprecation": { - "severity": "warning" - }, - "component-class-suffix": true, - "contextual-lifecycle": true, - "directive-class-suffix": true, - "directive-selector": [ - true, - "attribute", - "app", - "camelCase" - ], - "component-selector": [ - true, - "element", - "app", - "kebab-case" - ], - "eofline": true, - "import-blacklist": [ - true, - "rxjs/Rx" - ], - "import-spacing": true, - "indent": { - "options": [ - "spaces" - ] - }, - "max-classes-per-file": false, - "max-line-length": [ - true, - 140 - ], - "member-ordering": [ - true, - { - "order": [ - "static-field", - "instance-field", - "static-method", - "instance-method" - ] - } - ], - "no-any": true, - "no-console": [ - true, - "debug", - "info", - "time", - "timeEnd", - "trace" - ], - "no-empty": false, - "no-inferrable-types": [ - true, - "ignore-params" - ], - "no-non-null-assertion": true, - "no-redundant-jsdoc": true, - "no-switch-case-fall-through": true, - "no-var-requires": false, - "object-literal-key-quotes": [ - true, - "as-needed" - ], - "quotemark": [ - true, - "single" - ], - "semicolon": { - "options": [ - "always" - ] - }, - "space-before-function-paren": { - "options": { - "anonymous": "never", - "asyncArrow": "always", - "constructor": "never", - "method": "never", - "named": "never" - } - }, - "typedef": [ - true, - "call-signature" - ], - "typedef-whitespace": { - "options": [ - { - "call-signature": "nospace", - "index-signature": "nospace", - "parameter": "nospace", - "property-declaration": "nospace", - "variable-declaration": "nospace" - }, - { - "call-signature": "onespace", - "index-signature": "onespace", - "parameter": "onespace", - "property-declaration": "onespace", - "variable-declaration": "onespace" - } - ] - }, - "variable-name": { - "options": [ - "ban-keywords", - "check-format", - "allow-pascal-case" - ] - }, - "whitespace": { - "options": [ - "check-branch", - "check-decl", - "check-operator", - "check-separator", - "check-type", - "check-typecast" - ] - }, - "no-conflicting-lifecycle": true, - "no-host-metadata-property": true, - "no-input-rename": true, - "no-inputs-metadata-property": true, - "no-output-native": true, - "no-output-on-prefix": true, - "no-output-rename": true, - "no-outputs-metadata-property": true, - "template-banana-in-box": true, - "template-no-negated-async": true, - "use-lifecycle-interface": true, - "use-pipe-transform-interface": true - }, - "rulesDirectory": [ - "codelyzer" - ] -} \ No newline at end of file