From 53bb432345258a1541f880c61cd2702576c8065f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Vescera?= Date: Sat, 15 Jul 2023 19:52:09 +0200 Subject: [PATCH 1/2] action: aggiunta action Run LaTex Linter on PR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Aggiunta una nuova action che è in grado di far eseguire Chktex (linter di LaTex) sulle PR (anche provenienti da Fork). Questa action controlla prima se sono stati aggiunti o modificati file LaTex, nel caso esegue il linter sono su questi file. --- .github/workflows/prlinter.yml | 39 ++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/prlinter.yml diff --git a/.github/workflows/prlinter.yml b/.github/workflows/prlinter.yml new file mode 100644 index 000000000..0a2b237fc --- /dev/null +++ b/.github/workflows/prlinter.yml @@ -0,0 +1,39 @@ +name: Run Chktex Linter on PR + +# Questa action esegue il linter Chktex (linter di LaTex) +# su ogni Pull Request (anche proveniente da Fork) +# Vengono prima controllati i file modificiati e, se sono +# presenti file LaTex, fa eseguire il linter su quei file. + +on: + pull_request: + branches: [master, main] + types: + - opened + - reopened + - synchronize + +jobs: + linter: + runs-on: ubuntu-latest + name: Run Linter + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v37 + with: + files: "**.tex" + + # - run: echo "${{ steps.changed-files.outputs.all_changed_files }}" + + - name: Install Chktex + run: sudo apt-get install chktex -y + + - name: Run Chktex + id: chktex + if: steps.changed-files.outputs.any_changed == 'true' + run: chktex ${{ steps.changed-files.outputs.all_changed_files }} From f535e0453af1e1ff4f36b847eae36fdea982f697 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=B2=20Vescera?= Date: Wed, 19 Jul 2023 22:30:39 +0200 Subject: [PATCH 2/2] feat(actions): aggiunti LaTex Checks SubCheks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migliorata l'action che controlla i file LaTex: - Migliorati nomi e titoli degli step con l'aggiunta di emoji 🦍🚀🎸 - Aggiunti SubCheks: ora viene fatto eseguire il linter Chktex, un software che controlla lo stile di come è scritto LaTex (tipo 'questa frase non inizia con la maiuscola' oppure 'non si mette la punteggiatura prima di una parentesi chiusa', ecc.) ed un software per l'analisi grammaticale (questo ha bisogno di un file di configurazione). Questi miglioramenti sono stati effettuati per rendere più semplice capire com'è stata scritta una certa parte in LaTex (e capire subito quando bisognerà bestemmiare 🙃) --- .github/workflows/configs/ltex.json | 1 + .github/workflows/prlinter.yml | 75 ++++++++++++++++++++++++----- 2 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/configs/ltex.json diff --git a/.github/workflows/configs/ltex.json b/.github/workflows/configs/ltex.json new file mode 100644 index 000000000..37b0922ae --- /dev/null +++ b/.github/workflows/configs/ltex.json @@ -0,0 +1 @@ +{"ltex.language": "it", "ltex.additionalRules.motherTongue": "en-GB"} diff --git a/.github/workflows/prlinter.yml b/.github/workflows/prlinter.yml index 0a2b237fc..f17a544df 100644 --- a/.github/workflows/prlinter.yml +++ b/.github/workflows/prlinter.yml @@ -1,9 +1,4 @@ -name: Run Chktex Linter on PR - -# Questa action esegue il linter Chktex (linter di LaTex) -# su ogni Pull Request (anche proveniente da Fork) -# Vengono prima controllati i file modificiati e, se sono -# presenti file LaTex, fa eseguire il linter su quei file. +name: LaTex Cheks 🕵 on: pull_request: @@ -14,9 +9,12 @@ on: - synchronize jobs: - linter: - runs-on: ubuntu-latest - name: Run Linter + changed-files: + runs-on: ubuntu-latest # windows-latest || macos-latest + name: Looking for changed files 👁 + outputs: + all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }} + any_changed: ${{ steps.changed-files.outputs.any_changed }} steps: - uses: actions/checkout@v3 with: @@ -27,13 +25,66 @@ jobs: uses: tj-actions/changed-files@v37 with: files: "**.tex" + - run: echo "${{ steps.changed-files.outputs.all_changed_files }}" - # - run: echo "${{ steps.changed-files.outputs.all_changed_files }}" + linter: + needs: changed-files + runs-on: ubuntu-latest # windows-latest || macos-latest + name: Linter Checker 🖊 + if: needs.changed-files.outputs.any_changed == 'true' + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 - name: Install Chktex run: sudo apt-get install chktex -y - name: Run Chktex id: chktex - if: steps.changed-files.outputs.any_changed == 'true' - run: chktex ${{ steps.changed-files.outputs.all_changed_files }} + run: chktex ${{ needs.changed-files.outputs.all_changed_files }} + + styler: + needs: changed-files + runs-on: ubuntu-latest # windows-latest || macos-latest + name: Styler Checker ✨ + if: needs.changed-files.outputs.any_changed == 'true' + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setupu Java ☕️ + uses: actions/setup-java@v3 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '17' + + - name: Install textidote + run: wget https://github.com/sylvainhalle/textidote/releases/latest/download/textidote.jar + + - name: Run textidote + run: java -jar textidote.jar ${{ needs.changed-files.outputs.all_changed_files }} + + typo: + needs: changed-files + runs-on: ubuntu-latest # windows-latest || macos-latest + name: Typo Checker 🔍 + if: needs.changed-files.outputs.any_changed == 'true' + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 2 + + - name: Setup Java ☕️ + uses: actions/setup-java@v3 + with: + distribution: 'zulu' # See 'Supported distributions' for available options + java-version: '17' + + - name: Install ltex-cli + run: wget https://github.com/valentjn/ltex-ls/releases/latest/download/ltex-ls-16.0.0.tar.gz && tar xvf ltex-ls-16.0.0.tar.gz + + - name: Run ltex-cli + run: ./ltex-ls-16.0.0/bin/ltex-cli --client-configuration=.github/workflows/configs/ltex.json ${{ needs.changed-files.outputs.all_changed_files }} +