Skip to content

Commit

Permalink
Use subtree again to allow publishing the crate (#34)
Browse files Browse the repository at this point in the history
* change: update Cargo.toml, lib.rs, CHANGELOG.md for 0.1.6 release.

* Squashed 'depend/zcash/' content from commit 9af3bce26

git-subtree-dir: depend/zcash
git-subtree-split: 9af3bce265ba428382006b0940678418d65f505f

* fix: delete depend/zcash/Cargo.toml to prevent cargo from ignoring it

* ci: add cargo package test

* change(doc): explain the subtree / squash issue in README.md
  • Loading branch information
conradoplg authored May 17, 2022
1 parent 2be4323 commit c9fbc44
Show file tree
Hide file tree
Showing 1,490 changed files with 298,363 additions and 38 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,28 @@ jobs:
with:
command: check

# Test that "cargo package" works. This make sure it's publishable,
# since we had issues where "cargo build" worked but "package" didn't.
package:
name: Package
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- stable
- nightly
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true
- uses: actions-rs/cargo@v1
with:
command: package

test-versions:
name: Test Suite
runs-on: ubuntu-latest
Expand Down
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

<!-- next-header -->

## [Unreleased] - ReleaseDate

## [0.1.6] - 2022-05-16

### Changed
Expand Down Expand Up @@ -41,7 +43,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Updated `bindgen` to a non yanked version

<!-- next-url -->
[Unreleased]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.5...HEAD
[Unreleased]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.6...HEAD
[0.1.6]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.5...v0.1.6
[0.1.5]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.4...v0.1.5
[0.1.4]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.3...v0.1.4
[0.1.3]: https://github.com/ZcashFoundation/zcash_script/compare/v0.1.2...v0.1.3
Expand Down
9 changes: 2 additions & 7 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,12 @@ description = "ffi bindings to zcashd's zcash_script library"
documentation = "https://docs.rs/zcash_script"
repository = "https://github.com/ZcashFoundation/zcash_script"
include = [
"/.github/workflows/ci.yml",
"/.gitignore",
"/.gitmodules",
"Cargo.toml",
"Cargo.toml.orig",
"/LICENSE",
"/README.md",
"build.rs",
"depend/check_uint128_t.c",
"src/blake2b.rs",
"src/lib.rs",
"src/*.rs",
"/depend/check_uint128_t.c",
"/depend/zcash/src/script/zcash_script.h",
"/depend/zcash/src/script/zcash_script.cpp",
"/depend/zcash/src/utilstrencodings.cpp",
Expand Down
46 changes: 22 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,42 +30,39 @@ To do that, check for versions in:
- `librustzcash/Cargo.toml` in the revision pointed to by `zcash` (also check for patches)
- `librustzcash/<crate>/Cargo.toml` in the revision pointed to by `zcash`

### Cloning and checking out `depend/zcash`
### Updating `depend/zcash`

Clone this repository using:
```console
git clone --recurse-submodules
```
We keep a copy of the zcash source in `depend/zcash` with the help of `git subtree`.
It has one single difference that must be enforced everytime it's updated: the root
`Cargo.toml` must be deleted, since otherwise cargo will ignore the entire folder
when publishing the crate (see https://github.com/rust-lang/cargo/issues/8597).

Or if you've already cloned:
```console
git submodule update --init
```
If you need to update the zcash source, run:

To pull the latest version, use:
```console
git pull --recurse-submodules
git subtree pull -P depend/zcash https://github.com/zcash/zcash.git <ref> --squash
```

### Updating `depend/zcash`

If you need to change the submodule's base branch:
```console
git config -f .gitmodules submodule.depend/zcash.branch <branch-name>
```
where `<ref>` is a reference to a branch, tag or commit (it should be a tag when preparing
a release, but it will be likely a branch or commit when testing).

To pull in recent changes from the upstream repo:
The command will likely report a conflict due to the deleted `Cargo.toml` file.
Just run

```console
git submodule update --remote
git rm depend/zcash/Cargo.toml
```

To use a specific commit:
and then commit the updates. Note: after updating zcash, the PR that includes it must *not* be
squashed-and-merged, due to how subtree works. Otherwise you will get errors
when trying to update zcash again.

If that ends up happening, you can always `git rm depend/zcash` and start over
(run the same command as above, but with `add` instead of `pull`);
our usage of `subtree` is to just have a convenient way of pulling copies of `zcash`.
(Unfortunately, switching to submodules is not a good solution due to the need of
deleting the `Cargo.toml`.)

```console
cd depend/zcash
git checkout <commit-hash>
```

### Publishing New Releases

Expand All @@ -75,6 +72,7 @@ Releases for `zcash-script` are made with the help of [cargo release](https://gi

* create a new branch batch the release commits into a PR
* update `CHANGELOG.md` to document any major changes since the last release
https://github.com/rust-lang/cargo/issues/8597)
* open a PR to merge your branch into `master`
* locally run `cargo release -- <level>` where `level` can be `patch`, `minor`, or `major` ([source](https://github.com/sunng87/cargo-release/blob/master/docs/reference.md#bump-level))

Expand Down
1 change: 0 additions & 1 deletion depend/zcash
Submodule zcash deleted from 16b49e
8 changes: 8 additions & 0 deletions depend/zcash/.cargo/config.offline
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"

[source.crates-io]
replace-with = "vendored-sources"

[source.vendored-sources]
# The directory for this source is set to RUST_VENDORED_SOURCES by src/Makefile.am
1 change: 1 addition & 0 deletions depend/zcash/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/clientversion.cpp export-subst
65 changes: 65 additions & 0 deletions depend/zcash/.github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Bug report
about: Create a report about a bug in zcashd.
title: ''
labels: 'bug'
assignees: ''

---

<!--
This issue tracker is only for technical issues related to zcashd.
General Zcash questions and/or support requests and are best directed to the
Zcash Forum: https://forum.zcashcommunity.com/
For reporting security vulnerabilities or for sensitive discussions with our
security team, please email [email protected] . You can use this GPG key to send
an encrypted message:
https://z.cash/gpg-pubkeys/security.asc
fingerprint: AF85 0445 546C 18B7 86F9 2C62 88FB 8B86 D8B5 A68C
The key and fingerprint are duplicated on our Public Keys page:
https://z.cash/support/pubkeys.html
-->

### Describe the issue
Please provide a general summary of the issue you're experiencing

### Can you reliably reproduce the issue?
#### If so, please list the steps to reproduce below:
1.
2.
3.

### Expected behaviour
Tell us what should happen

### Actual behaviour + errors
Tell us what happens instead including any noticeable error output (any messages
displayed on-screen when e.g. a crash occurred)

### The version of Zcash you were using:
Run `zcashd --version` to find out

### Machine specs:
- OS name + version:
- CPU:
- RAM:
- Disk size:
- Disk Type (HD/SDD):
- Linux kernel version (uname -a):
- Compiler version (gcc --version):
- Linker version (ld -v):
- Assembler version (as --version):

### Any extra information that might be useful in the debugging process.
This includes the relevant contents of `~/.zcash/debug.log`. You can paste raw
text, attach the file directly in the issue or link to the text via a pastebin
type site. Please also include any non-standard things you did during
compilation (extra flags, dependency version changes etc.) if applicable.

### Do you have a backup of `~/.zcash` directory and/or take a VM snapshot?
- Backing up / making a copy of the `~/.zcash` directory might help make the
problem reproducible. Please redact appropriately.
- Taking a VM snapshot is really helpful for interactively testing fixes
22 changes: 22 additions & 0 deletions depend/zcash/.github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: Feature request
about: Suggest an idea for zcashd.
title: ''
labels: 'use case'
assignees: ''

---

## Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Example: I'm always
frustrated when [...]

## Describe the solution you'd like
A clear and concise description of what you want to happen.

## Alternatives you've considered
A clear and concise description of any alternative solutions or features you've
considered.

## Additional context
Add any other context or screenshots about the feature request here.
17 changes: 17 additions & 0 deletions depend/zcash/.github/ISSUE_TEMPLATE/ux-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: UX report
about: Was zcashd hard to use? It's not you, it's us. We want to hear about it.
title: 'UX: '
labels: 'usability'
assignees: ''

---

<!-- Did zcashd not do what you expected?
Was it hard to figure out how to do something?
Could an error message be more helpful?
It's not you, it's us. We want to hear about it. -->

## What were you trying to do

## What happened
14 changes: 14 additions & 0 deletions depend/zcash/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
timezone: Etc/UTC
open-pull-requests-limit: 10
reviewers:
- str4d
assignees:
- str4d
labels:
- "A-CI"
5 changes: 5 additions & 0 deletions depend/zcash/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Please ensure this checklist is followed for any pull requests for this repo. This checklist must be checked by both the PR creator and by anyone who reviews the PR.
* [ ] Relevant documentation for this PR has to be completed and reviewed by @mdr0id before the PR can be merged
* [ ] A test plan for the PR must be documented in the PR notes and included in the test plan for the next regular release

As a note, all buildbot tests need to be passing and all appropriate code reviews need to be done before this PR can be merged
32 changes: 32 additions & 0 deletions depend/zcash/.github/workflows/book.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: zcashd book

on:
push:
branches:
- master

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup mdBook
uses: peaceiris/actions-mdbook@v1
with:
mdbook-version: 'latest'

- name: Install mdbook-katex
uses: actions-rs/cargo@v1
with:
command: install
args: mdbook-katex

- name: Build zcashd book
run: mdbook build doc/book/

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./doc/book/book
Loading

0 comments on commit c9fbc44

Please sign in to comment.