mirror of
https://github.com/terrapkg/packages.git
synced 2026-05-31 09:01:55 +00:00
0f2b02d006
* 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 c6d56ac9f2.
* 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?
171 lines
5.9 KiB
YAML
171 lines
5.9 KiB
YAML
# for each folder in anda/
|
|
# generate a new workflow for each folder in anda/
|
|
name: Automatically build packages
|
|
on:
|
|
push:
|
|
paths:
|
|
- anda/**
|
|
branches:
|
|
- f38
|
|
pull_request:
|
|
branches:
|
|
- f38
|
|
merge_group:
|
|
branches:
|
|
- f38
|
|
workflow_dispatch:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
manifest:
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
build_matrix: ${{ steps.generate_build_matrix.outputs.build_matrix }}
|
|
container:
|
|
image: ghcr.io/terrapkg/builder:f38
|
|
options: --cap-add=SYS_ADMIN --privileged
|
|
steps:
|
|
- name: Set workspace as safe
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Generate build matrix
|
|
id: generate_build_matrix
|
|
run: anda ci >> $GITHUB_OUTPUT
|
|
build:
|
|
needs: manifest
|
|
strategy:
|
|
matrix:
|
|
pkg: ${{ fromJson(needs.manifest.outputs.build_matrix) }}
|
|
version: ["38"]
|
|
fail-fast: false
|
|
runs-on: ${{ matrix.pkg.arch == 'aarch64' && 'ARM64' || 'ubuntu-latest' }}
|
|
container:
|
|
image: ghcr.io/terrapkg/builder:f38
|
|
options: --cap-add=SYS_ADMIN --privileged
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up git repository
|
|
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
|
|
|
- name: Build with Anda
|
|
run: anda build ${{ matrix.pkg.pkg }} --package rpm -c terra-${{ matrix.version }}-${{ matrix.pkg.arch }}
|
|
|
|
- name: Generating artifact name
|
|
id: art
|
|
run: |
|
|
NAME=${{ matrix.pkg.pkg }}-${{ matrix.pkg.arch }}-${{ matrix.version }}
|
|
x=${NAME//\//@}
|
|
echo "name=$x" >> $GITHUB_OUTPUT
|
|
|
|
- uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ steps.art.outputs.name }}
|
|
path: anda-build/rpm/rpms/*
|
|
|
|
- name: Upload packages to subatomic
|
|
if: github.event_name == 'push'
|
|
run: |
|
|
subatomic-cli upload --prune \
|
|
--server https://subatomic.fyralabs.com \
|
|
--token ${{ secrets.SUBATOMIC_TOKEN }} \
|
|
terra${{ matrix.version }} anda-build/rpm/rpms/*
|
|
|
|
- name: Notify Madoguchi (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() ) && github.event_name == 'push'
|
|
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: |
|
|
<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 }}
|