From 0f2b02d006e5fa304e47caaceb466eb60e18c2f9 Mon Sep 17 00:00:00 2001 From: madomado Date: Tue, 20 Jun 2023 04:20:11 +0800 Subject: [PATCH] feat(ci): Add lint and try `dnf in` in autobuild (#593) * feat(ci): Add lint and try `dnf in` in autobuild This also renames some workflows. * feat: test out the workflow by messing up uxplay * chore(ci): simplify mg notify part * try? * guess it's time to revert mg * fix fail hdl * Revert "feat: test out the workflow by messing up uxplay" This reverts commit c6d56ac9f24264264db5e2fd50b76d7aa1b508ef. * yeah let's try using seto instead (faster!) * fix newline stuff again * ok let's try this too * escape the strings * fix dnf and some formatting * fix? * confusion * more quote fixing * a * idk? * aaaa * revert seto-fonts * more opts? --- .github/workflows/autobuild.yml | 89 +++++++++++++++++++++++++++- .github/workflows/build.yml | 8 +-- .github/workflows/json-build.yml | 10 ++-- .github/workflows/update-nightly.yml | 2 +- .github/workflows/update.yml | 2 +- anda/fonts/seto/seto-fonts.spec | 4 +- 6 files changed, 100 insertions(+), 15 deletions(-) diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index 73e53afa87..0e144665d5 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -79,7 +79,92 @@ jobs: - name: Notify Madoguchi (Success) if: success() && github.event_name == 'push' - run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} - name: Notify Madoguchi (Failure) if: ( cancelled() || failure() ) && github.event_name == 'push' - run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + + - name: Lint RPMs and SRPMs + id: lint + if: success() + run: | + echo 'err=false' >> $GITHUB_ENV + rpmlint anda-build/ > rpmlint.txt || f=1 + if [[ $f -eq 1 ]]; then + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "esc_lint_out<<$EOF" >> $GITHUB_ENV + cat rpmlint.txt | sed 's/`/\\`/g' >> $GITHUB_ENV + echo $EOF >> $GITHUB_ENV + echo "lint_out<<$EOF" >> $GITHUB_ENV + echo '```' >> $GITHUB_ENV + cat rpmlint.txt >> $GITHUB_ENV + echo '```' >> $GITHUB_ENV + echo $EOF >> $GITHUB_ENV + echo 'err=true' >> $GITHUB_ENV + fi + + - name: Try to install package + id: dnf + if: success() + run: | + touch out + for f in anda-build/rpm/rpms/*.rpm; do + dnf in --downloadonly -y $f > $f.dnfout.txt 2>&1 || fail=1 + if [[ $fail -eq 1 ]]; then + echo "### $f" >> out + echo '```' >> out + cat $f.dnfout.txt >> out + echo '```' >> out + echo >> out + echo 'err=true' >> $GITHUB_ENV + fi + done + cat out + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "esc_dnf_out<<$EOF" >> $GITHUB_ENV + cat out | sed 's/`/\\`/g' >> $GITHUB_ENV + echo $EOF >> $GITHUB_ENV + echo "dnf_out<<$EOF" >> $GITHUB_ENV + cat out >> $GITHUB_ENV + echo $EOF >> $GITHUB_ENV + + - name: Comment RPMLint/DNF output (PR) + if: success() && github.event_name == 'pull_request' + uses: actions/github-script@v6 + with: + script: | + let out = ""; + if (`${{ env.esc_lint_out }}`.trim() != "") { + out += "## 🔨 Lint: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n"; + out += `\`\`\`\n${{ env.esc_lint_out }}\n\`\`\`\n`; + } + if (`${{ env.esc_dnf_out }}`.trim() != "") { + out += "## ❌ DNF: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n"; + out += `${{ env.esc_dnf_out }}`; + } + if (out != "") { + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: out, + }); + } + + - name: Create commit comment + if: success() && env.err == 'true' + uses: peter-evans/commit-comment@v1 + with: + body: | + [run_id: ${{github.run_id}}](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}}) + # Built RPM: ${{matrix.pkg.pkg}} (${{matrix.pkg.arch}}.fc${{matrix.version}}) + ## Lint + If you see anything below, RPMLint returned with a non-zero exit code. + + ${{ env.lint_out }} + + ## DNF + Output of `dnf in --downloadonly ...`. + If you see anything below, DNF returned with a non-zero exit code. + + ${{ env.dnf_out }} diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a925be455f..55d8213e5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build Packages +name: Manual Builds on: workflow_dispatch: inputs: @@ -59,8 +59,8 @@ jobs: terra${{ matrix.version }} anda-build/rpm/rpms/* - name: Notify Madoguchi (Success) - if: success() + if: success() && github.event_name == 'push' run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} - name: Notify Madoguchi (Failure) - if: cancelled() || failure() - run: ./.github/workflows/mg.sh false ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + if: ( cancelled() || failure() ) && github.event_name == 'push' + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} diff --git a/.github/workflows/json-build.yml b/.github/workflows/json-build.yml index 9a460fd7ae..971da70095 100644 --- a/.github/workflows/json-build.yml +++ b/.github/workflows/json-build.yml @@ -1,4 +1,4 @@ -name: Build Packages (JSON) +name: JSON Build on: workflow_dispatch: inputs: @@ -48,8 +48,8 @@ jobs: terra${{ matrix.version }} anda-build/rpm/rpms/* - name: Notify Madoguchi (Success) - if: success() - run: ./.github/workflows/mg.sh true ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + if: success() && github.event_name == 'push' + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} - name: Notify Madoguchi (Failure) - if: cancelled() || failure() - run: ./.github/workflows/mg.sh false ${{matrix.pkg.pkg}} ${{matrix.version}} ${{matrix.pkg.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} + if: ( cancelled() || failure() ) && github.event_name == 'push' + run: ./.github/workflows/mg.sh true ${{matrix.pkg}} ${{matrix.version}} ${{matrix.arch}} ${{github.run_id}} ${{secrets.MADOGUCHI_JWT}} diff --git a/.github/workflows/update-nightly.yml b/.github/workflows/update-nightly.yml index 4d90f1241d..2add134544 100644 --- a/.github/workflows/update-nightly.yml +++ b/.github/workflows/update-nightly.yml @@ -1,4 +1,4 @@ -name: Automatic Nightly Update +name: Nightly Update on: schedule: - cron: "0 0 * * *" diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index 3891c39a73..7d5aa0e836 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -1,4 +1,4 @@ -name: Automatically check for updates +name: Update on: schedule: - cron: "*/30 * * * *" diff --git a/anda/fonts/seto/seto-fonts.spec b/anda/fonts/seto/seto-fonts.spec index 70bca6cecf..3365601eeb 100644 --- a/anda/fonts/seto/seto-fonts.spec +++ b/anda/fonts/seto/seto-fonts.spec @@ -2,7 +2,7 @@ Name: seto-fonts Version: 6.20 Release: 2%?dist URL: https://setofont.osdn.jp/ -Source0: https://osdn.net/frs/redir.php?m=nchc&f=setofont%2F61995%2Fsetofont_v_6_20.zip +Source0: https://osdn.net/frs/redir.php?m=nchc&f=setofont%2F61995%2Fsetofont_v_6_20.zip License: OFL-1.1 Summary: A handwritten font that contains kanji up to JIS 4th level and difficult kanji BuildRequires: unzip @@ -10,7 +10,7 @@ BuildArch: noarch %description -%{summary}. +%summary. %prep