From ca6171ebd4a6135455cd8448c9c27c785a286c26 Mon Sep 17 00:00:00 2001 From: Ilya Stepenko <38462532+VampireAotD@users.noreply.github.com> Date: Tue, 23 Apr 2024 23:41:18 +0300 Subject: [PATCH] Updated workflows --- .../{backend-build.yml => backend-tests.yml} | 14 +- ...{frontend-build.yml => frontend-tests.yml} | 6 +- .github/workflows/lint.yml | 37 + .github/workflows/scripts.yml | 2 +- .github/workflows/static-analysis.yml | 35 + src/package.json | 24 +- src/resources/js/app.ts | 1 - .../create-anime-modal/CreateAnimeModal.vue | 4 +- .../js/features/anime/rating/AnimeRating.vue | 13 +- src/resources/js/pages/Anime/Show.vue | 2 +- .../js/shared/ui/input/text/TextInput.vue | 10 +- src/yarn.lock | 1969 ++++++++++------- 12 files changed, 1251 insertions(+), 866 deletions(-) rename .github/workflows/{backend-build.yml => backend-tests.yml} (81%) rename .github/workflows/{frontend-build.yml => frontend-tests.yml} (90%) create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/static-analysis.yml diff --git a/.github/workflows/backend-build.yml b/.github/workflows/backend-tests.yml similarity index 81% rename from .github/workflows/backend-build.yml rename to .github/workflows/backend-tests.yml index 080e5da6..e2db472e 100644 --- a/.github/workflows/backend-build.yml +++ b/.github/workflows/backend-tests.yml @@ -1,9 +1,9 @@ -name: Backend build +name: Backend tests on: [ push, pull_request ] jobs: - build: + tests: runs-on: ubuntu-latest defaults: @@ -30,7 +30,7 @@ jobs: - uses: actions/checkout@v4 - name: Cache Composer dependencies - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: src/vendor key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} @@ -45,13 +45,7 @@ jobs: - name: Install Composer dependencies run: composer install -qn --no-ansi --no-progress --no-scripts --prefer-dist - - name: Run Psalm - run: ./vendor/bin/psalm -c psalm.xml - - - name: Run PHPStan - run: ./vendor/bin/phpstan analyze --memory-limit=2G - - name: Run tests env: DB_HOST: 127.0.0.1 - run: php artisan test --coverage + run: php artisan test --coverage \ No newline at end of file diff --git a/.github/workflows/frontend-build.yml b/.github/workflows/frontend-tests.yml similarity index 90% rename from .github/workflows/frontend-build.yml rename to .github/workflows/frontend-tests.yml index dfdb4644..8f42c706 100644 --- a/.github/workflows/frontend-build.yml +++ b/.github/workflows/frontend-tests.yml @@ -1,9 +1,9 @@ -name: Frontend build +name: Frontend tests on: [ push, pull_request ] jobs: - build: + tests: runs-on: ubuntu-latest defaults: @@ -18,7 +18,7 @@ jobs: - uses: actions/checkout@v4 - name: Install Node ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: "yarn" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..b0f890d4 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,37 @@ +name: Frontend lint + +on: [ push, pull_request ] + +jobs: + lint: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src + + strategy: + matrix: + node-version: [ 20.x ] + + steps: + - uses: actions/checkout@v4 + + - name: Install Node ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: "yarn" + cache-dependency-path: ./src/yarn.lock + + - name: Install dependencies + run: | + yarn set version berry + yarn config set -H enableTelemetry false + yarn install --immutable + + - name: Run ESLint + run: yarn lint + + - name: Run Prettier + run: yarn prettier-check \ No newline at end of file diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml index be00ecd6..6e14a01a 100644 --- a/.github/workflows/scripts.yml +++ b/.github/workflows/scripts.yml @@ -3,7 +3,7 @@ name: ShellCheck on: [ push, pull_request ] jobs: - build: + check: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml new file mode 100644 index 00000000..38e62f6e --- /dev/null +++ b/.github/workflows/static-analysis.yml @@ -0,0 +1,35 @@ +name: Backend static analysis + +on: [ push, pull_request ] + +jobs: + analysis: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: src + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Cache Composer dependencies + uses: actions/cache@v4 + with: + path: src/vendor + key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }} + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + + - name: Install Composer dependencies + run: composer install + + - name: Run Psalm + run: ./vendor/bin/psalm -c psalm.xml + + - name: Run PHPStan + run: ./vendor/bin/phpstan analyze --memory-limit=2G \ No newline at end of file diff --git a/src/package.json b/src/package.json index c5e2e5ce..7fed4ba3 100644 --- a/src/package.json +++ b/src/package.json @@ -13,37 +13,37 @@ "devDependencies": { "@inertiajs/vue3": "^1.0", "@tailwindcss/forms": "^0.5", - "@typescript-eslint/eslint-plugin": "^7.1", - "@typescript-eslint/parser": "^7.1", + "@typescript-eslint/eslint-plugin": "^7.7", + "@typescript-eslint/parser": "^7.7", "@vitejs/plugin-vue": "^5.0", "@vue/eslint-config-prettier": "^9.0", - "@vue/eslint-config-typescript": "^12.0", + "@vue/eslint-config-typescript": "^13.0", "@vue/test-utils": "^2.4", "autoprefixer": "^10.4", "axios": "^1.6", - "eslint": "^8.56", + "eslint": "^8.57", "eslint-config-prettier": "^9.1", "eslint-plugin-prettier": "^5.1", - "eslint-plugin-vue": "^9.19", - "happy-dom": "^13.6", + "eslint-plugin-vue": "^9.25", + "happy-dom": "^14.7", "laravel-echo": "^1.16", "laravel-vite-plugin": "^1.0", "postcss": "^8.4", "prettier": "^3.2", "pusher-js": "^8.4.0-rc2", "tailwindcss": "^3.4", - "typescript": "^5.3", - "vite": "^5.1", - "vitest": "^1.3", + "typescript": "^5.4.5", + "vite": "^5.2", + "vitest": "^1.5", "vue": "^3.4", "vue-eslint-parser": "^9.4", - "vue-tsc": "^1.8", - "ziggy-js": "^2.0" + "vue-tsc": "^2.0.14", + "ziggy-js": "^2.1" }, "dependencies": { "@vueuse/core": "^10.9", "chart.js": "^4.4.1", - "primeicons": "^6.0.1", + "primeicons": "^7.0.0", "primevue": "^3.49" } } diff --git a/src/resources/js/app.ts b/src/resources/js/app.ts index 13f03ca6..6647bec2 100644 --- a/src/resources/js/app.ts +++ b/src/resources/js/app.ts @@ -11,7 +11,6 @@ import PrimeVue from 'primevue/config'; import Tailwind from 'primevue/passthrough/tailwind'; import ToastService from 'primevue/toastservice'; import Toast from 'primevue/toast'; -// @ts-expect-error Declaration of ZiggyVue import { ZiggyVue } from 'ziggy-js'; const appName = import.meta.env.VITE_APP_NAME || 'Anilibrary'; diff --git a/src/resources/js/features/anime/create-anime-modal/CreateAnimeModal.vue b/src/resources/js/features/anime/create-anime-modal/CreateAnimeModal.vue index 66e0e4fc..6f8cef6f 100644 --- a/src/resources/js/features/anime/create-anime-modal/CreateAnimeModal.vue +++ b/src/resources/js/features/anime/create-anime-modal/CreateAnimeModal.vue @@ -35,7 +35,7 @@ const addUrl = () => form.urls.push({ url: '' }); const removeUrl = (index: number) => form.urls.splice(index, 1); -const addSynonym = () => form.synonyms.push({ synonym: '' }); +const addSynonym = () => form.synonyms.push({ name: '' }); const removeSynonym = (index: number) => form.synonyms.splice(index, 1); @@ -213,7 +213,7 @@ const createAnime = () => {}; class="flex gap-2" > import Rating from 'primevue/rating'; -import { computed } from 'vue'; -type Props = { - modelValue: number; -}; - -const props = defineProps(); -const emit = defineEmits<{ 'update:modelValue': [value: number] }>(); - -const rating = computed({ - get: () => props.modelValue, - set: (value: number) => emit('update:modelValue', value), -}); +const rating = defineModel();