Skip to content

Commit c3fc127

Browse files
committed
Switch to my standard project template
* Create CHANGELOG.md * Mention digital signature verification in README * Use fat executables for macOS (x86_64 + aarch64) * Add Android aarch64 builds * Remove automatic publishing of release artifacts Signed-off-by: Andrew Gunnerson <[email protected]>
1 parent e655149 commit c3fc127

File tree

5 files changed

+205
-93
lines changed

5 files changed

+205
-93
lines changed

.github/workflows/ci.yml

Lines changed: 95 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,118 @@ on:
44
- master
55
pull_request:
66
jobs:
7-
build_and_upload:
8-
name: Build and archive artifacts
9-
runs-on: ${{ matrix.os }}
7+
build:
8+
name: Build ddns-updater
9+
runs-on: ${{ matrix.artifact.os }}
1010
env:
1111
CARGO_TERM_COLOR: always
12+
# https://github.com/rust-lang/rust/issues/78210
13+
RUSTFLAGS: -C strip=symbols -C target-feature=+crt-static
14+
TARGETS: ${{ join(matrix.artifact.targets, ' ') || matrix.artifact.name }}
15+
ANDROID_API: ${{ matrix.artifact.android_api }}
1216
strategy:
1317
fail-fast: false
1418
matrix:
15-
os:
16-
- ubuntu-latest
17-
- windows-latest
18-
- macos-latest
19+
artifact:
20+
- os: ubuntu-latest
21+
name: x86_64-unknown-linux-gnu
22+
- os: windows-latest
23+
name: x86_64-pc-windows-gnu
24+
- os: macos-latest
25+
name: universal-apple-darwin
26+
targets:
27+
- aarch64-apple-darwin
28+
- x86_64-apple-darwin
29+
combine: lipo
30+
- os: ubuntu-latest
31+
name: aarch64-linux-android31
32+
targets:
33+
- aarch64-linux-android
34+
android_api: '31'
1935
steps:
2036
- name: Check out repository
2137
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2238
with:
23-
fetch-depth: 1
39+
# For git describe
40+
fetch-depth: 0
2441

25-
- name: Get Rust target triple
26-
id: get_target
42+
- name: Update Rust
43+
run: rustup update stable
44+
45+
- name: Install cargo-android
46+
shell: bash
47+
run: |
48+
cargo install \
49+
--git https://github.com/chenxiaolong/cargo-android \
50+
--tag v0.1.3
51+
52+
- name: Get version
53+
id: get_version
54+
shell: bash
55+
run: |
56+
echo -n 'version=' >> "${GITHUB_OUTPUT}"
57+
git describe --always \
58+
| sed -E "s/^v//g;s/([^-]*-g)/r\1/;s/-/./g" \
59+
>> "${GITHUB_OUTPUT}"
60+
61+
- name: Install toolchains
62+
shell: bash
63+
run: |
64+
for target in ${TARGETS}; do
65+
rustup target add "${target}"
66+
done
67+
68+
- name: Cache Rust dependencies
69+
uses: Swatinem/rust-cache@9d47c6ad4b02e050fd481d890b2ea34778fd09d6 # v2.7.8
70+
71+
- name: Clippy
72+
shell: bash
73+
run: |
74+
for target in ${TARGETS}; do
75+
cargo android \
76+
clippy --release \
77+
--target "${target}"
78+
done
79+
80+
- name: Formatting
81+
run: cargo fmt -- --check
82+
83+
- name: Build
2784
shell: bash
2885
run: |
29-
echo -n 'name=' >> "${GITHUB_OUTPUT}"
30-
rustc -vV | sed -n 's|host: ||p' >> "${GITHUB_OUTPUT}"
86+
for target in ${TARGETS}; do
87+
cargo android \
88+
build --release \
89+
--target "${target}"
90+
done
3191
32-
- name: Run tests in debug mode
33-
env:
34-
RUST_BACKTRACE: 1
35-
TERM: xterm
92+
- name: Create output directory
93+
shell: bash
3694
run: |
37-
cargo clippy --workspace -- -D warnings
38-
cargo test --workspace
95+
rm -rf target/output
3996
40-
- name: Build in debug mode
41-
run: cargo build --verbose
97+
case "${{ matrix.artifact.combine }}" in
98+
lipo)
99+
mkdir target/output
100+
cmd=(lipo -output target/output/ddns-updater -create)
101+
for target in ${TARGETS}; do
102+
cmd+=("target/${target}/release/ddns-updater")
103+
done
104+
"${cmd[@]}"
105+
;;
106+
'')
107+
ln -s "${TARGETS}/release" target/output
108+
;;
109+
*)
110+
echo >&2 "Unsupported combine argument"
111+
exit 1
112+
;;
113+
esac
42114
43115
- name: Archive artifacts
44116
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
45117
with:
46-
name: ddns-updater-${{ steps.get_target.outputs.name }}
118+
name: ddns-updater-${{ steps.get_version.outputs.version }}-${{ matrix.artifact.name }}
47119
path: |
48-
target/debug/ddns-updater
49-
target/debug/ddns-updater.exe
50-
target/debug/ddns_updater.pdb
120+
target/release/ddns-updater
121+
target/release/ddns-updater.exe

.github/workflows/release.yml

Lines changed: 9 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -6,88 +6,29 @@ on:
66
tags:
77
- 'v*'
88
jobs:
9-
get_version:
10-
name: Get version
9+
create_release:
10+
name: Create Github release
1111
runs-on: ubuntu-latest
12-
outputs:
13-
version: ${{ steps.get_version.outputs.version }}
12+
permissions:
13+
contents: write
1414
steps:
1515
- name: Get version from tag
1616
id: get_version
1717
run: |
1818
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
1919
version=${GITHUB_REF#refs/tags/v}
2020
else
21-
version=0.0.0-${GITHUB_REF#refs/heads/}
21+
version=0.0.0.${GITHUB_REF#refs/heads/}
2222
fi
2323
echo "version=${version}" >> "${GITHUB_OUTPUT}"
2424
25-
build_and_upload:
26-
name: Build and upload assets
27-
needs: get_version
28-
runs-on: ${{ matrix.os }}
29-
env:
30-
CARGO_TERM_COLOR: always
31-
RUSTFLAGS: -C strip=symbols
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
os:
36-
- ubuntu-latest
37-
- windows-latest
38-
- macos-latest
39-
steps:
4025
- name: Check out repository
4126
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
42-
with:
43-
fetch-depth: 1
44-
45-
- name: Get Rust target triple
46-
id: get_target
47-
shell: bash
48-
run: |
49-
echo -n 'name=' >> "${GITHUB_OUTPUT}"
50-
rustc -vV | sed -n 's|host: ||p' >> "${GITHUB_OUTPUT}"
51-
52-
- name: Run tests in release mode
53-
env:
54-
RUST_BACKTRACE: 1
55-
run: |
56-
cargo clippy --workspace --release
57-
cargo test --workspace --release
58-
59-
- name: Build in release mode
60-
run: cargo build --release
61-
62-
- name: Build archive
63-
id: build_archive
64-
shell: bash
65-
run: |
66-
base_name=ddns-updater-${{ needs.get_version.outputs.version }}-${{ steps.get_target.outputs.name }}
67-
mkdir "${base_name}"
68-
cp {README.md,LICENSE} "${base_name}/"
69-
70-
if [[ "${{ matrix.os }}" == windows-* ]]; then
71-
cp target/release/ddns-updater.exe "${base_name}/"
72-
asset="${base_name}.zip"
73-
7z a "${asset}" "${base_name}"
74-
else
75-
cp target/release/ddns-updater "${base_name}/"
76-
asset="${base_name}.tar.xz"
77-
tar -Jcvf "${asset}" "${base_name}"
78-
fi
79-
80-
openssl sha512 -r "${asset}" | sed 's/\*/ /' > "${asset}.sha512"
81-
82-
echo "name=${asset}" >> "${GITHUB_OUTPUT}"
83-
echo "name_sha512=${asset}.sha512" >> "${GITHUB_OUTPUT}"
8427

85-
- name: Upload release assets
28+
- name: Create release
8629
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
8730
with:
88-
tag_name: v${{ needs.get_version.outputs.version }}
89-
name: Version ${{ needs.get_version.outputs.version }}
31+
tag_name: v${{ steps.get_version.outputs.version }}
32+
name: Version ${{ steps.get_version.outputs.version }}
33+
body_path: RELEASE.md
9034
draft: true
91-
files: |
92-
${{ steps.build_archive.outputs.name }}
93-
${{ steps.build_archive.outputs.name_sha512 }}

CHANGELOG.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
### Unreleased
2+
3+
* Update all dependencies ([PR #12], [PR #13], [PR #14], [PR #15])
4+
5+
### Version 0.1.10
6+
7+
Switched to the `tracing` library for logging and updated all dependencies ([PR #11]).
8+
9+
### Version 0.1.9
10+
11+
Updated all dependencies to their latest versions, updated to the latest Rust edition, and reformatted code with `cargo fmt` ([PR #8], [PR #9], [PR #10]). No changes to ddns-updater itself.
12+
13+
### Version 0.1.8
14+
15+
Updated all dependencies to their latest versions ([PR #7]). No changes to ddns-updater itself.
16+
17+
### Version 0.1.7
18+
19+
Dependency updates only ([PR #6]):
20+
21+
* clap 4.0.26
22+
* env_logger 0.9.3
23+
* gethostname 0.4.0
24+
* netif 0.1.6
25+
* serde 1.0.147
26+
* serde_with 2.1.0
27+
* thiserror 1.0.37
28+
29+
### Version 0.1.6
30+
31+
Dependency updates only ([PR #5]):
32+
33+
* clap 3.2.20
34+
* log 0.4.17
35+
* serde 1.0.144
36+
* serde_with 2.0.0
37+
* thiserror 1.0.33
38+
* toml 0.5.9
39+
* trust-dns-client 0.22.0
40+
41+
### Version 0.1.5
42+
43+
Dependency updates only ([PR #4]):
44+
45+
* clap 3.1.7
46+
* gethostname 0.2.3
47+
* log 0.4.16
48+
* netif 0.1.3
49+
* trust-dns-client 0.21.2
50+
51+
### Version 0.1.4
52+
53+
Dependency updates only ([PR #3]):
54+
55+
* trust-dns-client 0.21.0 (alpha.5 -> stable)
56+
* Minor version updates for all remaining dependencies
57+
58+
### Version 0.1.3
59+
60+
Dependency updates only:
61+
62+
* trust-dns-client 0.21.0-alpha.5
63+
* serde_with 1.12.0
64+
65+
### Version 0.1.2
66+
67+
Updated all dependencies to their latest versions. No changes to ddns-updater itself ([PR #2]).
68+
69+
### Version 0.1.1
70+
71+
This version switches to the [netif](https://github.com/bnoordhuis/netif) library for querying network interfaces ([PR #1]). The previous library had two memory leaks (missing frees for `malloc` and `getifaddrs`) and also dereferences a NULL pointer (`(struct ifaddrs).ifa_addr`) when an interface is layer 3 only (like Wireguard interfaces on Linux).
72+
73+
### Version 0.1.0
74+
75+
Initial release
76+
77+
[PR #1]: https://github.com/chenxiaolong/ddns-updater/pull/1
78+
[PR #2]: https://github.com/chenxiaolong/ddns-updater/pull/2
79+
[PR #3]: https://github.com/chenxiaolong/ddns-updater/pull/3
80+
[PR #4]: https://github.com/chenxiaolong/ddns-updater/pull/4
81+
[PR #5]: https://github.com/chenxiaolong/ddns-updater/pull/5
82+
[PR #6]: https://github.com/chenxiaolong/ddns-updater/pull/6
83+
[PR #7]: https://github.com/chenxiaolong/ddns-updater/pull/7
84+
[PR #8]: https://github.com/chenxiaolong/ddns-updater/pull/8
85+
[PR #9]: https://github.com/chenxiaolong/ddns-updater/pull/9
86+
[PR #10]: https://github.com/chenxiaolong/ddns-updater/pull/10
87+
[PR #11]: https://github.com/chenxiaolong/ddns-updater/pull/11
88+
[PR #12]: https://github.com/chenxiaolong/ddns-updater/pull/12
89+
[PR #13]: https://github.com/chenxiaolong/ddns-updater/pull/13
90+
[PR #14]: https://github.com/chenxiaolong/ddns-updater/pull/14
91+
[PR #15]: https://github.com/chenxiaolong/ddns-updater/pull/15

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ To enable trace logging for everything, including the underlying hickory-dns lib
4040
* Querying the "public" IP from online services will never be supported.
4141
* Dynamic updates are made atomically by clearing all existing A/AAAA records and inserting the new records in the same request. However, some servers may not conform perfectly to RFC 2136 and may not implement the atomicity guarantees.
4242

43+
## Verifying digital signatures
44+
45+
To verify the digital signatures of the downloads, follow [the steps here](https://github.com/chenxiaolong/chenxiaolong/blob/master/VERIFY_SSH_SIGNATURES.md).
46+
4347
## License
4448

45-
ddns-updater is licensed under the GPLv3 license. For details, please see [`LICENSE`](./LICENSE).
49+
ddns-updater is licensed under GPLv3. Please see [`LICENSE`](./LICENSE) for the full license text.
4650

4751
## Similar software
4852

RELEASE.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
The changelog can be found at: [`CHANGELOG.md`](./CHANGELOG.md).
2+
3+
---
4+
5+
See [`README.md`](./README.md) for information on how to use ddns-updater and how to verify the digital signatures of the downloads.

0 commit comments

Comments
 (0)