test builderv2 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test build and package QubesOS RPMs | ||
on: | ||
workflow_call: | ||
inputs: | ||
qubes-component: | ||
description: > | ||
Name of QubesOS component as recognized by its build system. | ||
required: true | ||
type: string | ||
git-url: | ||
description: > | ||
URL of GitHub repository to be used by builder. Use same format as | ||
GITHUB_REPOSITORY, e.g. `TrenchBoot/antievilmaid`. | ||
required: false | ||
type: string | ||
jobs: | ||
build-and-package: | ||
runs-on: ubuntu-latest | ||
name: Compile and package as QubesOS RPM | ||
permissions: | ||
# for publishing releases | ||
contents: write | ||
steps: | ||
# - uses: actions/checkout@v3 | ||
# with: | ||
# fetch-depth: 100 # need history for `git format-patch` | ||
- uses: actions/checkout@v3 | ||
with: | ||
repository: QubesOS/qubes-builderv2 | ||
# path: shared | ||
- name: Cache Docker image and dom0 stuff | ||
uses: actions/cache@v3 | ||
id: docker-cache | ||
with: | ||
path: | | ||
/tmp/qubes-builder-fedora.tar | ||
/tmp/cache/dom0.tar | ||
key: | | ||
${{ hashFiles('tools/*') }}-docker-container | ||
- name: Load Docker image | ||
if: steps.docker-cache.outputs.cache-hit == 'true' | ||
run: | | ||
docker load --input /tmp/qubes-builder-fedora.tar | ||
- name: Build Docker image (optional) | ||
if: steps.docker-cache.outputs.cache-hit != 'true' | ||
run: | | ||
tools/generate-container-image.sh docker | ||
- name: Export Docker image (optional) | ||
if: steps.docker-cache.outputs.cache-hit != 'true' | ||
run: | | ||
docker save --output /tmp/qubes-builder-fedora.tar \ | ||
qubes-builder-fedora:latest | ||
- name: Prepare dom0 cache storage (optional) | ||
if: steps.docker-cache.outputs.cache-hit != 'true' | ||
run: | | ||
mkdir --mode=777 /tmp/cache | ||
- name: Build and package | ||
run: | | ||
# chmod -R 777 . | ||
# docker run --privileged \ | ||
# -v /tmp/cache:/tmp/cache/ \ | ||
# -v "$GITHUB_WORKSPACE:$GITHUB_WORKSPACE" \ | ||
# -w "$GITHUB_WORKSPACE" \ | ||
# qubes-builder-fedora:latest \ | ||
# /bin/bash -c "sudo dnf install -y openssl python3-click python3-pathspec python3-packaging \ | ||
# && | ||
./qb --debug --verbose --builder-conf example-configs/builder-devel.yml -o git.prefix=${{ inputs.git-url }} -c ${{ inputs.qubes-component }} package fetch prep build" | ||
- name: Save built packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: qubesos.dom0.fc37-${{ inputs.qubes-component }}-${{ github.sha }} | ||
path: '*.rpm' | ||
- name: Construct release's description | ||
if: github.event_name == 'push' && github.ref_type == 'tag' | ||
run: | | ||
for artifact in *.rpm; do | ||
echo "### $artifact" >> release-body.md | ||
echo '```' >> release-body.md | ||
echo "wget --quiet '${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/$artifact'" >> release-body.md | ||
echo '```' >> release-body.md | ||
echo '```' >> release-body.md | ||
echo "curl --remote-name '${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/$artifact'" >> release-body.md | ||
echo '```' >> release-body.md | ||
done | ||
- name: Create release for a new tag | ||
if: github.event_name == 'push' && github.ref_type == 'tag' | ||
uses: ncipollo/[email protected] | ||
with: | ||
artifacts: '*.rpm' | ||
artifactErrorsFailBuild: true | ||
bodyFile: "release-body.md" |