Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/release-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
## Which file to download

| Platform | File |
| --- | --- |
| Debian (`bookworm`, `trixie`) and Ubuntu (`jammy`, `noble`) on `amd64`, `arm64`, `armhf` | `python3-monero_<version>-1<distro>1_<arch>.deb`, installed with `sudo apt install ./<file>` |
| macOS (Apple silicon and Intel) | `monero-<version>-<python>-macosx_*.whl` |
| Windows (x86_64) | `monero-<version>-<python>-win_amd64.whl` |
| Anything else | `monero-python-<version>.tar.gz`, the source with its submodules (the "Source code" archives of GitHub have none of them) |

`coverage_monero_cpp_html.zip` is the coverage report of the tests.

## Verify a download

```bash
sha256sum -c --ignore-missing SHA256SUMS
gh attestation verify <file> --repo libmonero/monero-python
```

The first checks the file against the list published with the release, the second that it was built by the release workflow of this repository.

23 changes: 6 additions & 17 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Build Debian Packages

# Builds the package from debian/ with dpkg-buildpackage in a container of each release.
# Pull requests build amd64 on trixie and bookworm. Main also builds amd64 on noble and jammy
# and arm64 on trixie and bookworm. The release (called by release.yml) and the manual runs with
# full build all of them. arm64 and armhf are built natively on arm runners, which run 32 bit
# Pull requests build noble, jammy and trixie, main, the release (called by release.yml) and the
# manual runs build bookworm too. Each one on amd64, arm64 and armhf. arm64 and armhf are built natively on arm runners, which run 32 bit
# arm containers.
on:
push:
Expand All @@ -18,17 +17,7 @@ on:
- 'bin/check_elf_hardening.sh'
- 'CMakeLists.txt'
workflow_dispatch:
inputs:
full:
description: Build every release and architecture
type: boolean
default: false
workflow_call:
inputs:
full:
description: Build every release and architecture
type: boolean
default: false

# A new push to a pull request cancels the previous run. Other events get their own
# group so they are never cancelled or replaced.
Expand All @@ -42,7 +31,7 @@ permissions:

jobs:
build:
name: ${{ contains('noble jammy', matrix.name) && 'ubuntu' || 'debian' }} (${{ matrix.name }} / ${{ matrix.arch }})
name: ${{ contains('noble jammy', matrix.name) && 'ubuntu' || 'debian' }} ${{ matrix.name }} (${{ matrix.arch }})
runs-on: ${{ matrix.arch == 'amd64' && 'ubuntu-latest' || 'ubuntu-24.04-arm' }}
timeout-minutes: 360

Expand All @@ -51,9 +40,9 @@ jobs:
matrix:
name: [noble, jammy, trixie, bookworm]
arch: [amd64, arm64, armhf]
# pull requests build amd64 on trixie and bookworm, main adds amd64 on the Ubuntu releases and
# arm64 on the Debian ones, the tags and the manual runs with full build everything
exclude: ${{ fromJSON((github.ref_type == 'tag' || inputs.full) && '[]' || (github.event_name == 'pull_request' && '[{"arch":"armhf"},{"arch":"arm64"},{"name":"noble"},{"name":"jammy"}]' || '[{"arch":"armhf"},{"arch":"arm64","name":"noble"},{"arch":"arm64","name":"jammy"}]')) }}
# pull requests leave out bookworm, everything else (main, tags, manual runs) builds all of them. Every
# architecture is built each time: a flag of the compiler that only one of them rejects was found at a release
exclude: ${{ fromJSON(github.event_name == 'pull_request' && '[{"name":"bookworm"}]' || '[]') }}

steps:
- name: Checkout repository
Expand Down
33 changes: 27 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,14 @@ jobs:
fi
echo "build_run_id=${run_id}" >> "$GITHUB_OUTPUT"

# every release and architecture, the builds of main only have some of them
# every release and architecture, built again for the tag
deb:
name: Build the deb packages
name: Build debian packages
needs: check
uses: ./.github/workflows/build-deb.yml
permissions:
contents: read
actions: write # build-deb.yml replaces its ccache entries
with:
full: true

release:
name: Publish draft release
Expand All @@ -74,6 +72,28 @@ jobs:
id-token: write

steps:
# the archive that GitHub attaches to a release is a git archive of the tag, with none of the submodules
# that the build needs
- name: Checkout repository with its submodules
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
path: source
submodules: recursive
persist-credentials: false

# the same tree gives the same bytes: sorted, with the time of the commit and no owner or name of the file in the gzip header
- name: Pack the source with its submodules
working-directory: source
env:
TAG: ${{ github.ref_name }}
run: |
prefix="monero-python-${TAG#v}"
mkdir -p ../release-assets
git ls-files --recurse-submodules -z \
| tar --null -T - --sort=name --mtime="@$(git log -1 --format=%ct)" --owner=0 --group=0 --numeric-owner \
--transform "flags=rSH;s,^,${prefix}/," -cf - \
| gzip -n > "../release-assets/${prefix}.tar.gz"

- name: Download deb packages
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
Expand Down Expand Up @@ -116,7 +136,7 @@ jobs:
# to check a download against what the workflow published: sha256sum -c SHA256SUMS
- name: Checksum the assets
working-directory: release-assets
run: sha256sum -- *.deb *.whl *.zip > SHA256SUMS
run: sha256sum -- *.deb *.whl *.zip *.tar.gz > SHA256SUMS

# lets anyone check an asset against this workflow: gh attestation verify <asset> --repo libmonero/monero-python
- name: Attest the assets
Expand All @@ -133,5 +153,6 @@ jobs:
--repo "$GITHUB_REPOSITORY" \
--draft \
--title "$TAG" \
--notes-file source/.github/release-notes.md \
--generate-notes \
release-assets/*.deb release-assets/*.whl release-assets/*.zip release-assets/SHA256SUMS
release-assets/*.deb release-assets/*.whl release-assets/*.zip release-assets/*.tar.gz release-assets/SHA256SUMS
2 changes: 1 addition & 1 deletion docs/ci-ccache.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ The workflows keep a ccache directory (`.ccache` in the workspace) between runs
- Each build has its own cache: Linux, Windows and macOS (one for each architecture) in `ci.yml`, and the deb builds one per distro and arch. The tests do not compile, they use what the builds uploaded.
- Pull requests only restore. Pushes to main and manual runs (`workflow_dispatch`) save. This is on purpose, see quota below. The deb workflow also runs on pull requests that touch its own files, and follows the same rule.
- A cache saved on a branch is only visible to that branch. Main's caches are visible to everyone, so a pull request starts from main's.
- Saving deletes only the entry of the same key and of the ref that is running (the API call has a `ref`): deleting by key alone removes the entries of every ref, and a manual run on a branch would take away main's. A tag does not save in the deb workflow, its entry would only be readable by that tag, and the release builds from the caches of main (the legs that main does not build, armhf and arm64 on Ubuntu, start with no cache).
- Saving deletes only the entry of the same key and of the ref that is running (the API call has a `ref`): deleting by key alone removes the entries of every ref, and a manual run on a branch would take away main's. A tag does not save in the deb workflow, its entry would only be readable by that tag, and the release builds from the caches of main (main builds all 12 legs, so each one has a cache).
- The save step runs after the build and before the tests, so a flaky test doesn't throw the cache away. Failed builds save too, whatever got compiled is still good.

### What isn't cached
Expand Down
Loading