소스 검색

Resurrect actions - Part 1 (#663)

- Resurrect the crowdin actions
- Resurrect the web linter
- Give the mobile linter a try
Manav Rathi 1 년 전
부모
커밋
f07b9f85a3

+ 38 - 0
.github/workflows/auth-crowdin.yml

@@ -0,0 +1,38 @@
+name: "Sync Crowdin translations (auth)"
+
+on:
+    push:
+        # Run action when auth's intl_en.arb is changed
+        paths:
+            - "mobile/lib/l10n/arb/app_en.arb"
+        branches: [main]
+    schedule:
+        # Run every 24 hours - https://crontab.guru/#0_*/24_*_*_*
+        - cron: "0 */24 * * *"
+    workflow_dispatch: # Allow manually running the action
+
+jobs:
+    synchronize-with-crowdin:
+        runs-on: ubuntu-latest
+
+        steps:
+            - name: Checkout
+              uses: actions/checkout@v4
+
+            - name: Crowdin's action
+              uses: crowdin/github-action@v1
+              with:
+                  base_path: "auth/"
+                  upload_sources: true
+                  upload_translations: true
+                  download_translations: true
+                  localization_branch_name: crowdin-translations-auth
+                  create_pull_request: true
+                  skip_untranslated_strings: true
+                  pull_request_title: "New translations (auth)"
+                  pull_request_body: "New translations via [Crowdin GH Action](https://github.com/crowdin/github-action)"
+                  pull_request_base_branch_name: "main"
+                  project_id: 575169
+              env:
+                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+                  CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

+ 35 - 0
.github/workflows/auth-lint.yml

@@ -0,0 +1,35 @@
+name: "Lint (auth)"
+
+on:
+    # Run on every push (this also covers pull requests)
+    push:
+        paths:
+            # - But only if something changes inside auth
+            - "auth/**"
+            # - Or if the there is some change in workflow itself
+            - ".github/workflows/auth-lint.yml"
+
+jobs:
+    lint:
+        runs-on: ubuntu-latest
+        defaults:
+            run:
+                working-directory: auth
+        steps:
+            # Checkout our code, including submodules
+            - uses: actions/checkout@v4
+              with:
+                  submodules: recursive
+
+            # Install Flutter
+            - uses: subosito/flutter-action@v2
+              with:
+                  channel: "stable"
+                  flutter-version: "3.13.4"
+                  cache: true
+
+            # Install dependencies
+            - run: flutter pub get
+
+            # Lint
+            - run: flutter analyze --no-fatal-infos

+ 13 - 12
web/.github/workflows/l18n-crowdin.yml → .github/workflows/mobile-crowdin.yml

@@ -1,13 +1,15 @@
-name: Sync crowdin translation
+name: "Sync Crowdin translations (mobile)"
 
 on:
     push:
-        paths: # run action automatically when en-US/translation.json file is changed
-            - "apps/photos/public/locales/en-US/translation.json"
+        # Run action when mobiles's intl_en.arb is changed
+        paths:
+            - "mobile/lib/l10n/intl_en.arb"
         branches: [main]
     schedule:
-        - cron: "0 */24 * * *" # Every 24 hours - https://crontab.guru/#0_*/12_*_*_*
-    workflow_dispatch: # for manually running the action
+        # Run every 24 hours - https://crontab.guru/#0_*/24_*_*_*
+        - cron: "0 */24 * * *"
+    workflow_dispatch: # Allow manually running the action
 
 jobs:
     synchronize-with-crowdin:
@@ -15,23 +17,22 @@ jobs:
 
         steps:
             - name: Checkout
-              uses: actions/checkout@v3
-              with:
-                  ref: main
+              uses: actions/checkout@v4
 
-            - name: crowdin action
+            - name: Crowdin's action
               uses: crowdin/github-action@v1
               with:
+                  base_path: "mobile/"
                   upload_sources: true
                   upload_translations: true
                   download_translations: true
-                  localization_branch_name: l10n_translations
+                  localization_branch_name: crowdin-translations-mobile
                   create_pull_request: true
                   skip_untranslated_strings: true
-                  pull_request_title: "New Translations"
+                  pull_request_title: "New translations (mobile)"
                   pull_request_body: "New translations via [Crowdin GH Action](https://github.com/crowdin/github-action)"
                   pull_request_base_branch_name: "main"
+                  project_id: 574741
               env:
                   GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-                  CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
                   CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

+ 35 - 0
.github/workflows/mobile-lint.yml

@@ -0,0 +1,35 @@
+name: "Lint (mobile)"
+
+on:
+    # Run on every push (this also covers pull requests)
+    push:
+        paths:
+            # - But only if something changes inside mobile
+            - "mobile/**"
+            # - Or if the there is some change in workflow itself
+            - ".github/workflows/mobile-lint.yml"
+
+jobs:
+    lint:
+        runs-on: ubuntu-latest
+        defaults:
+            run:
+                working-directory: mobile
+        steps:
+            # Checkout our code, including submodules
+            - uses: actions/checkout@v4
+              with:
+                  submodules: recursive
+
+            # Install Flutter
+            - uses: subosito/flutter-action@v2
+              with:
+                  channel: "stable"
+                  flutter-version: "3.13.4"
+                  cache: true
+
+            # Install dependencies
+            - run: flutter pub get
+
+            # Lint
+            - run: flutter analyze --no-fatal-infos

+ 38 - 0
.github/workflows/web-crowdin.yml

@@ -0,0 +1,38 @@
+name: "Sync Crowdin translations (web)"
+
+on:
+    push:
+        # Run action when web's en-US/translation.json is changed
+        paths:
+            - "web/apps/photos/public/locales/en-US/translation.json"
+        branches: [main]
+    schedule:
+        # Run every 24 hours - https://crontab.guru/#0_*/24_*_*_*
+        - cron: "0 */24 * * *"
+    workflow_dispatch: # Allow manually running the action
+
+jobs:
+    synchronize-with-crowdin:
+        runs-on: ubuntu-latest
+
+        steps:
+            - name: Checkout
+              uses: actions/checkout@v4
+
+            - name: Crowdin's action
+              uses: crowdin/github-action@v1
+              with:
+                  base_path: "web/"
+                  upload_sources: true
+                  upload_translations: true
+                  download_translations: true
+                  localization_branch_name: crowdin-translations-web
+                  create_pull_request: true
+                  skip_untranslated_strings: true
+                  pull_request_title: "New translations (web)"
+                  pull_request_body: "New translations via [Crowdin GH Action](https://github.com/crowdin/github-action)"
+                  pull_request_base_branch_name: "main"
+                  project_id: 569613
+              env:
+                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+                  CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

+ 26 - 0
.github/workflows/web-lint.yml

@@ -0,0 +1,26 @@
+name: "Lint (web)"
+
+on:
+    # Run on every push (this also covers pull requests)
+    push:
+        paths:
+            # - But only if something changes inside web
+            - "web/**"
+            # - Or if the there is some change in workflow itself
+            - ".github/workflows/web-lint.yml"
+
+jobs:
+    lint:
+        runs-on: ubuntu-latest
+        defaults:
+            run:
+                working-directory: web
+        steps:
+            - uses: actions/checkout@v4
+            - uses: actions/setup-node@v4
+              with:
+                  node-version: 20
+                  cache: "yarn"
+                  cache-dependency-path: "web/yarn.lock"
+            - run: yarn install
+            - run: yarn lint

+ 0 - 35
auth/.github/workflows/l18n-crowdin.yml

@@ -1,35 +0,0 @@
-name: Sync crowdin translation
-
-on:
-  push:
-    paths: # run action automatically when app_en.arb file is changed
-      - 'lib/l10n/arb/app_en.arb'
-    branches: [ main ]
-  schedule:
-    - cron: '0 */12 * * *' # Every 12 hours - https://crontab.guru/#0_*/12_*_*_*
-  workflow_dispatch: # for manually running the action
-
-jobs:
-  synchronize-with-crowdin:
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v3
-
-      - name: crowdin action
-        uses: crowdin/github-action@v1
-        with:
-          upload_sources: true
-          upload_translations: true
-          download_translations: true
-          localization_branch_name: l10n_translations
-          create_pull_request: true
-          skip_untranslated_strings: true
-          pull_request_title: 'New Translations'
-          pull_request_body: 'New translations via [Crowdin GH Action](https://github.com/crowdin/github-action)'
-          pull_request_base_branch_name: 'main'
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
-          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

+ 0 - 20
auth/coverage_badge.svg

@@ -1,20 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="102" height="20">
-    <linearGradient id="b" x2="0" y2="100%">
-        <stop offset="0" stop-color="#bbb" stop-opacity=".1" />
-        <stop offset="1" stop-opacity=".1" />
-    </linearGradient>
-    <clipPath id="a">
-        <rect width="102" height="20" rx="3" fill="#fff" />
-    </clipPath>
-    <g clip-path="url(#a)">
-        <path fill="#555" d="M0 0h59v20H0z" />
-        <path fill="#44cc11" d="M59 0h43v20H59z" />
-        <path fill="url(#b)" d="M0 0h102v20H0z" />
-    </g>
-    <g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="110">
-        <text x="305" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="490">coverage</text>
-        <text x="305" y="140" transform="scale(.1)" textLength="490">coverage</text>
-        <text x="795" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="330">100%</text>
-        <text x="795" y="140" transform="scale(.1)" textLength="330">100%</text>
-    </g>
-</svg>

+ 1 - 2
auth/crowdin.yml

@@ -1,6 +1,5 @@
-project_id_env: CROWDIN_PROJECT_ID
 api_token_env: CROWDIN_PERSONAL_TOKEN
 
 files:
   - source: /lib/l10n/arb/app_en.arb
-    translation: /lib/l10n/arb/app_%two_letters_code%.arb
+    translation: /lib/l10n/arb/app_%two_letters_code%.arb

+ 0 - 33
mobile/.github/workflows/code_quality.yml

@@ -1,33 +0,0 @@
-name: Check Linter Rules
-on:
-  pull_request:
-    types: [review_requested]
-    branches:
-      - master
-jobs:
-  test:
-    name: Check the source code
-    runs-on: ubuntu-latest
-    steps:
-      - uses: actions/checkout@v3
-      - uses: actions/cache@v2
-        with:
-          path: ${{ runner.tool_cache }}/flutter
-          key: flutter-3.0.0-stable
-      # Setup the flutter environment.
-      - uses: subosito/flutter-action@v2.3.0
-        with:
-          channel: 'stable'
-          flutter-version: '3.0.0'
-
-      # Fetch sub modules
-      - run: git submodule update --init --recursive
-
-      # Get flutter dependencies.
-      - name: Install packages
-        run: flutter pub get
-
-      - name: Run Linter
-        run: flutter analyze --no-fatal-infos
-      - name: Run Test
-        run: flutter test

+ 0 - 36
mobile/.github/workflows/crowdin.yml

@@ -1,36 +0,0 @@
-name: Sync crowdin translation
-
-on:
-  workflow_dispatch:
-  push:
-    paths:
-      - 'lib/l10n/intl_en.arb'
-    branches: [ main ]
-  schedule:
-    - cron: '0 */12 * * *' # Every 12 hours - https://crontab.guru/#0_*/12_*_*_*
-
-jobs:
-  synchronize-with-crowdin:
-    runs-on: ubuntu-latest
-
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v3
-
-      - name: crowdin action
-        uses: crowdin/github-action@v1
-        with:
-          upload_sources: true
-          upload_translations: true
-          download_translations: true
-          localization_branch_name: l10n_translations
-          create_pull_request: true
-          skip_untranslated_strings: true
-          pull_request_title: 'New  Translations'
-          pull_request_body: 'New translations via [Crowdin GH Action](https://github.com/crowdin/github-action)'
-          pull_request_base_branch_name: 'main'
-          pull_request_reviewers: ashilkn,vishnukvmd,ua741
-        env:
-          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-          CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
-          CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}

+ 0 - 1
mobile/crowdin.yml

@@ -1,4 +1,3 @@
-project_id_env: CROWDIN_PROJECT_ID
 api_token_env: CROWDIN_PERSONAL_TOKEN
 preserve_hierarchy: true
 

+ 0 - 13
web/.github/workflows/pr.yml

@@ -1,13 +0,0 @@
-name: Lint
-
-on:
-    # Run on every push (this also covers pull requests)
-    push:
-
-jobs:
-    lint:
-        runs-on: ubuntu-latest
-        steps:
-            - uses: actions/checkout@v4
-            - run: yarn install
-            - run: yarn lint

+ 4 - 1
web/apps/auth/src/components/AuthFooter.tsx

@@ -12,7 +12,10 @@ export const AuthFooter = () => {
             }}
         >
             <p>{t("AUTH_DOWNLOAD_MOBILE_APP")}</p>
-            <a href="https://github.com/ente-io/ente/tree/main/auth#-download" download>
+            <a
+                href="https://github.com/ente-io/ente/tree/main/auth#-download"
+                download
+            >
                 <Button color="accent">{t("DOWNLOAD")}</Button>
             </a>
         </div>

+ 0 - 1
web/crowdin.yml

@@ -1,4 +1,3 @@
-project_id_env: CROWDIN_PROJECT_ID
 api_token_env: CROWDIN_PERSONAL_TOKEN
 
 files: