mirror of
https://github.com/terrapkg/packages.git
synced 2026-06-12 06:30:38 +00:00
chore: sync with Terra 38 (#624)
* chore: sync with Terra 38 * chore(ci): improve autobuild * fix ci? Signed-off-by: madomado <wboy111@outlook.com> * test ci Signed-off-by: madomado <wboy111@outlook.com> * Update autobuild.yml * Update anda.tpl Signed-off-by: madomado <wboy111@outlook.com> * dnf moment mock configs Signed-off-by: madomado <wboy111@outlook.com> --------- Signed-off-by: madomado <wboy111@outlook.com>
This commit is contained in:
@@ -10,6 +10,9 @@ on:
|
||||
pull_request:
|
||||
branches:
|
||||
- f37
|
||||
merge_group:
|
||||
branches:
|
||||
- f37
|
||||
workflow_dispatch:
|
||||
workflow_call:
|
||||
|
||||
@@ -51,7 +54,17 @@ jobs:
|
||||
- name: Set up git repository
|
||||
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
- name: Build with Anda
|
||||
- name: Cache buildroot
|
||||
id: br-cache
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: /var/cache
|
||||
key: ${{ runner.os }}-br-${{ matrix.version }}-${{ matrix.pkg.arch }}-${{ matrix.pkg.pkg }}
|
||||
|
||||
- name: Include custom build template instead of package default
|
||||
run: cp -v anda/mock-configs/anda.tpl /etc/mock/templates/anda.tpl
|
||||
|
||||
- name: Build with Andaman
|
||||
run: anda build ${{ matrix.pkg.pkg }} --package rpm -c anda-${{ matrix.version }}-${{ matrix.pkg.arch }}
|
||||
|
||||
- name: Generating artifact name
|
||||
@@ -67,7 +80,7 @@ jobs:
|
||||
path: anda-build/rpm/rpms/*
|
||||
|
||||
- name: Upload packages to subatomic
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name == 'push'
|
||||
run: |
|
||||
subatomic-cli upload --prune \
|
||||
--server https://subatomic.fyralabs.com \
|
||||
@@ -75,34 +88,36 @@ jobs:
|
||||
terra${{ matrix.version }} anda-build/rpm/rpms/*
|
||||
|
||||
- name: Notify Madoguchi (Success)
|
||||
if: success() && github.event_name != 'pull_request'
|
||||
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}}
|
||||
- name: Notify Madoguchi (Failure)
|
||||
if: ( cancelled() || failure() ) && github.event_name != 'pull_request'
|
||||
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}}
|
||||
|
||||
- name: Lint RPMs and SRPMs
|
||||
id: lint
|
||||
if: success()
|
||||
run: |
|
||||
echo 'err=false' >> $GITHUB_ENV
|
||||
echo 'LINT_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 "ESC_LINT_OUT<<$EOF" >> $GITHUB_ENV
|
||||
cat rpmlint.txt | sed 's/`/\\`/g' | 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
|
||||
echo 'LINT_ERR=true' >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Try to install package
|
||||
id: dnf
|
||||
if: success()
|
||||
run: |
|
||||
echo 'INSTALL_ERR=false' >> $GITHUB_ENV
|
||||
touch out
|
||||
for f in anda-build/rpm/rpms/*.rpm; do
|
||||
dnf in --downloadonly -y $f > $f.dnfout.txt 2>&1 || fail=1
|
||||
@@ -112,50 +127,29 @@ jobs:
|
||||
cat $f.dnfout.txt >> out
|
||||
echo '```' >> out
|
||||
echo >> out
|
||||
echo 'err=true' >> $GITHUB_ENV
|
||||
echo 'INSTALL_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 "ESC_DNF_OUT<<$EOF" >> $GITHUB_ENV
|
||||
cat out | sed 's/`/\\`/g' | 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@v2
|
||||
with:
|
||||
body: |
|
||||
<sub>[run_id: ${{github.run_id}}](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})</sub>
|
||||
# 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 }}
|
||||
|
||||
- name: Generate RPMLint/DNF summary
|
||||
if: success()
|
||||
run: |
|
||||
# Remind me to make all of this not weird later ~ lleyton
|
||||
|
||||
if [[ $LINT_ERR == "true" ]]; then
|
||||
echo -e "## ❌ Lint: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n" >> $GITHUB_STEP_SUMMARY
|
||||
echo -e "```\n${{ env.ESC_LINT_OUT }}\n```\n" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
if [[ $INSTALL_ERR == "true" ]]; then
|
||||
echo -e "## ❌ DNF: [${{matrix.pkg.pkg}} (${{matrix.pkg.arch}})](https://github.com/terrapkg/packages/actions/runs/${{github.run_id}})\n" >> $GITHUB_STEP_SUMMARY
|
||||
echo "${{ env.ESC_DNF_OUT }}" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user