From c6a2d72482cc4b1acfa0a2b84098791ed9cd006b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 13 Sep 2024 16:56:30 +0200 Subject: [PATCH] Update github workflows after repo split --- .github/workflows/added_dates.yml | 15 +++++--- .github/workflows/auto_messages_pot.yml | 48 ------------------------- .github/workflows/autoblack.yml | 28 --------------- .github/workflows/main.yml | 17 +++++++-- .github/workflows/test_toml.yaml | 1 + .github/workflows/tests_make_readme.yml | 22 ------------ 6 files changed, 26 insertions(+), 105 deletions(-) delete mode 100644 .github/workflows/auto_messages_pot.yml delete mode 100644 .github/workflows/autoblack.yml delete mode 100644 .github/workflows/tests_make_readme.yml diff --git a/.github/workflows/added_dates.yml b/.github/workflows/added_dates.yml index e5a2a06e97..d30b209001 100644 --- a/.github/workflows/added_dates.yml +++ b/.github/workflows/added_dates.yml @@ -11,19 +11,26 @@ jobs: steps: - uses: actions/checkout@v4 with: - fetch-depth: 0 token: ${{ secrets.YUNOHOST_BOT_TOKEN }} + - uses: actions/checkout@v4 + with: + repository: YunoHost/apps-tools + path: tools + fetch-depth: 0 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: 3.11 - - name: Install toml python lib + + - name: Install Python dependencies run: | - pip3 install toml tomlkit gitpython + pip3 install -r tools/requirements.txt + - name: Add added dates to catalog files run: | - ./tools/save_added_date.py -l . + ./tools/save_added_date.py --apps-dir . - uses: uncenter/setup-taplo@v1 - run: taplo fmt diff --git a/.github/workflows/auto_messages_pot.yml b/.github/workflows/auto_messages_pot.yml deleted file mode 100644 index 6640e8e3e2..0000000000 --- a/.github/workflows/auto_messages_pot.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Auto updates messages.pot for readme_generator -on: - push: - branches: - - master - -jobs: - pybabel: - name: Auto updates messages.pot for readme_generator - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python 3.11 - uses: actions/setup-python@v5 - with: - python-version: 3.11 - - - name: Install dependencies - run: | - cd tools/readme_generator/ - pip install -r requirements.txt - - - name: Save old messges.pot for diffing later - run: | - cd tools/readme_generator/ - cp messages.pot messages.pot.old - - - name: Try to generate messages.pot - run: | - cd tools/readme_generator/ - pybabel extract --ignore-dirs venv -F babel.cfg -o messages.pot . - - - name: Check if files changed - run: | - HAS_DIFF=$(python .github/diff_pot_files.py tools/readme_generator/messages.pot.old tools/readme_generator/messages.pot) - echo "HAS_DIFF=$HAS_DIFF" >> $GITHUB_ENV - - - name: Create Pull Request - if: ${{ env.HAS_DIFF == 'true' }} - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: "Update messages.pot for readme_generator" - commit-message: "chore(readme_generator): update messages.pot" - body: | - This pull request has been generated using the command `pybabel extract --ignore-dirs venv -F babel.cfg -o messages.pot .` - base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch - branch: actions/auto_messages_pot diff --git a/.github/workflows/autoblack.yml b/.github/workflows/autoblack.yml deleted file mode 100644 index 25c8e8b3f5..0000000000 --- a/.github/workflows/autoblack.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Check / auto apply Black -on: - push: - branches: - - master -jobs: - black: - name: Check / auto apply black - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Check files using the black formatter - uses: psf/black@stable - id: black - with: - options: "." - continue-on-error: true - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - token: ${{ secrets.GITHUB_TOKEN }} - title: "Format Python code with Black" - commit-message: ":art: Format Python code with Black" - body: | - This pull request uses the [psf/black](https://github.com/psf/black) formatter. - base: ${{ github.head_ref }} # Creates pull request onto pull request or commit branch - branch: actions/black diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 64ea82a337..4d1f78dcd8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,19 +11,30 @@ jobs: steps: - uses: actions/checkout@v4 + + - uses: actions/checkout@v4 + with: + repository: YunoHost/apps-tools + path: tools + fetch-depth: 0 + - name: Set up Python 3.11 uses: actions/setup-python@v5 with: python-version: 3.11 - - name: Install toml python lib + + - name: Install Python dependencies run: | - pip3 install toml jsonschema gitpython tqdm + pip3 install -r tools/requirements.txt + - name: Check TOML validity for apps.toml run: | python3 -c "import toml; toml.load(open('apps.toml'))" + - name: Check all working apps have consistent app id / app url and categories run: | ./tools/catalog_linter.py --apps-dir . + - name: Check the generation of the app catalog run: | - ./tools/list_builder.py + ./tools/list_builder.py --apps-dir . diff --git a/.github/workflows/test_toml.yaml b/.github/workflows/test_toml.yaml index 6c67ec9f2c..b5e99571fe 100644 --- a/.github/workflows/test_toml.yaml +++ b/.github/workflows/test_toml.yaml @@ -10,6 +10,7 @@ jobs: steps: - uses: actions/checkout@v4 - uses: uncenter/setup-taplo@v1 + - run: taplo fmt - name: Create Pull Request diff --git a/.github/workflows/tests_make_readme.yml b/.github/workflows/tests_make_readme.yml deleted file mode 100644 index 12304a8dc7..0000000000 --- a/.github/workflows/tests_make_readme.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Run tests for make_readme.py - -on: [push] - -jobs: - test: - name: Run tests for make_readme.py - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: 'Set up Python 3.9' - uses: actions/setup-python@v5 - with: - python-version: '3.9' - cache: 'pip' - - name: install dependencies - run: | - python -m pip install --upgrade pip - pip install -r tools/readme_generator/requirements.txt - pip install pytest - - name: launch pytest - run: cd tools/readme_generator && pytest tests