diff options
| -rw-r--r-- | .github/ISSUE_TEMPLATE/bug_report.md | 44 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/config.yml | 1 | ||||
| -rw-r--r-- | .github/ISSUE_TEMPLATE/feature_request.md | 28 | ||||
| -rw-r--r-- | .github/PULL_REQUEST_TEMPLATE.md | 12 | ||||
| -rw-r--r-- | .github/dependabot.yml | 15 | ||||
| -rw-r--r-- | .github/workflows/audit.yml | 24 | ||||
| -rw-r--r-- | .github/workflows/cd.yml | 111 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 64 | ||||
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | CHANGELOG.md | 7 | ||||
| -rw-r--r-- | CODE_OF_CONDUCT.md | 3 | ||||
| -rw-r--r-- | CONTRIBUTING.md | 80 | ||||
| -rw-r--r-- | Cargo.toml | 3 | ||||
| -rw-r--r-- | README.md | 28 |
14 files changed, 422 insertions, 0 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..24f432f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,44 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +## Bug description + +<!-- A clear and concise description of what the bug is. --> + +- Would you like to work on a fix? [y/n] + +## To Reproduce + +Steps to reproduce the behavior: + +1. ... +2. ... +3. ... +4. ... + +<!-- Make sure you are able to reproduce the bug in the main branch, too. --> + +## Expected behavior + +<!-- A clear and concise description of what you expected to happen. --> + +## Screenshots + +<!-- If applicable, add screenshots to help explain your problem. --> + +## Environment + +<!-- Please fill the following information. --> + +- OS: [e.g. Ubuntu 20.04] +- multiwan-dyndns version: [e.g. 0.1.0] + +## Additional context + +<!-- Add any other context about the problem here. --> diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..0086358 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1 @@ +blank_issues_enabled: true diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..3b54884 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,28 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: enhancement +assignees: '' + +--- + +## Motivations + +<!-- +If your feature request is related to a problem, please describe it. +--> + +- Would you like to implement this feature? [y/n] + +## Solution + +<!-- Describe the solution you'd like. --> + +## Alternatives + +<!-- Describe any alternative solutions or features you've considered. --> + +## Additional context + +<!-- Add any other context or screenshots about the feature request here. --> diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..b5aa17b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ +<!-- Please explain the changes you made --> + +<!-- +Please, make sure: +- you have read the contributing guidelines: + https://github.com/guspower/multiwan-dyndns/blob/main/docs/CONTRIBUTING.md +- you have formatted the code using rustfmt: + https://github.com/rust-lang/rustfmt +- you have checked that all tests pass, by running `cargo test --workspace` +- you have updated the changelog (if needed): + https://github.com/guspower/multiwan-dyndns/blob/main/CHANGELOG.md +--> diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..e669886 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +version: 2 +updates: + - package-ecosystem: "cargo" + # Look for `Cargo.toml` and `Cargo.lock` in the root directory + directory: "/" + # Check for updates every Monday + schedule: + interval: "weekly" + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" + directory: "/" + # Check for updates every Monday + schedule: + interval: "weekly" + open-pull-requests-limit: 10 diff --git a/.github/workflows/audit.yml b/.github/workflows/audit.yml new file mode 100644 index 0000000..562d5e0 --- /dev/null +++ b/.github/workflows/audit.yml @@ -0,0 +1,24 @@ +name: Security audit + +on: + schedule: + # Runs at 00:00 UTC everyday + - cron: '0 0 * * *' + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + pull_request: + +jobs: + audit: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Run security audit + uses: rustsec/audit-check@v2.0.0 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..d0c827d --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,111 @@ +name: CD # Continuous Deployment + +on: + push: + tags: + - '[v]?[0-9]+.[0-9]+.[0-9]+' + +jobs: + + publish: + name: Publishing for ${{ matrix.job.os-name }}-${{ matrix.job.architecture }} + runs-on: ${{ matrix.job.os }} + permissions: + contents: write + strategy: + fail-fast: false + matrix: + rust: [stable] + job: + - os: macos-latest + os-name: macos + target: x86_64-apple-darwin + architecture: x86_64 + - os: macos-latest + os-name: macos + target: aarch64-apple-darwin + architecture: arm64 + - os: ubuntu-latest + os-name: linux + target: x86_64-unknown-linux-gnu + architecture: x86_64 + - os: windows-latest + os-name: windows + target: x86_64-pc-windows-msvc + architecture: x86_64 + - os: ubuntu-latest + os-name: linux + target: aarch64-unknown-linux-gnu + architecture: arm64 + - os: ubuntu-latest + os-name: linux + target: i686-unknown-linux-gnu + architecture: i686 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + toolchain: ${{ matrix.rust }} + target: ${{ matrix.job.target }} + - name: Install cross + uses: taiki-e/install-action@v2 + with: + tool: cross + - name: Build release binary + run: cross build --locked --release --target ${{ matrix.job.target }} + + - name: install strip command + if: matrix.job.target == 'aarch64-unknown-linux-gnu' + shell: bash + run: | + sudo apt update + sudo apt-get install -y binutils-aarch64-linux-gnu + - name: Packaging final binary + shell: bash + run: | + BINARY=target/${{ matrix.job.target }}/release/multiwan-dyndns + if [[ ${{ runner.os }} == 'Windows' ]]; then + BINARY=$BINARY.exe + fi + + ####### reduce binary size by removing debug symbols ####### + if [[ ${{ matrix.job.target }} == aarch64-unknown-linux-gnu ]]; then + GCC_PREFIX="aarch64-linux-gnu-" + else + GCC_PREFIX="" + fi + "$GCC_PREFIX"strip $BINARY + + ########## create tar.gz ########## + mkdir assets + RELEASE_NAME=multiwan-dyndns-${GITHUB_REF/refs\/tags\//}-${{ matrix.job.os-name }}-${{ matrix.job.architecture }} + tar czvf assets/$RELEASE_NAME.tar.gz $BINARY + + ########## create sha256 ########## + if [[ ${{ runner.os }} == 'Windows' ]]; then + certutil -hashfile assets/$RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > assets/$RELEASE_NAME.sha256 + else + shasum -a 256 assets/$RELEASE_NAME.tar.gz > assets/$RELEASE_NAME.sha256 + fi + - name: Releasing assets + uses: softprops/action-gh-release@v2 + with: + files: assets/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + publish-cargo: + name: Publishing to Cargo + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - run: cargo publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..56067a6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,64 @@ +name: CI # Continuous Integration + +on: + push: + branches: + - main + pull_request: + +jobs: + + test: + name: Test Suite + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Run tests + run: cargo test --all-features --workspace + + rustfmt: + name: Rustfmt + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: rustfmt + - uses: Swatinem/rust-cache@v2 + - name: Check formatting + run: cargo fmt --all --check + + clippy: + name: Clippy + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + components: clippy + - uses: Swatinem/rust-cache@v2 + - name: Clippy check + run: cargo clippy --all-targets --all-features --workspace -- -D warnings + + docs: + name: Docs + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Check documentation + env: + RUSTDOCFLAGS: -D warnings + run: cargo doc --no-deps --document-private-items --all-features --workspace --examples + @@ -1 +1,3 @@ /target +.cargo-ok +.DS_Store diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..ef88a6b --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..278b1f2 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,3 @@ +# Code of Conduct + +This project adheres to the Rust Code of Conduct, which can be found [here](https://www.rust-lang.org/conduct.html). diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..2c9540d --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,80 @@ +# Contribution guidelines + +First off, thank you for considering contributing to multiwan-dyndns. + +If your contribution is not straightforward, please first discuss the change you +wish to make by creating a new issue before making the change. + +## Reporting issues + +Before reporting an issue on the +[issue tracker](https://github.com/guspower/multiwan-dyndns/issues), +please check that it has not already been reported by searching for some related +keywords. + +## Pull requests + +Try to do one pull request per change. + +### Updating the changelog + +Update the changes you have made in +[CHANGELOG](https://github.com/guspower/multiwan-dyndns/blob/main/CHANGELOG.md) +file under the **Unreleased** section. + +Add the changes of your pull request to one of the following subsections, +depending on the types of changes defined by +[Keep a changelog](https://keepachangelog.com/en/1.0.0/): + +- `Added` for new features. +- `Changed` for changes in existing functionality. +- `Deprecated` for soon-to-be removed features. +- `Removed` for now removed features. +- `Fixed` for any bug fixes. +- `Security` in case of vulnerabilities. + +If the required subsection does not exist yet under **Unreleased**, create it! + +## Developing + +### Set up + +This is no different than other Rust projects. + +```shell +git clone https://github.com/guspower/multiwan-dyndns +cd multiwan-dyndns +cargo test +``` + +### Useful Commands + +- Build and run release version: + + ```shell + cargo build --release && cargo run --release + ``` + +- Run Clippy: + + ```shell + cargo clippy --all-targets --all-features --workspace + ``` + +- Run all tests: + + ```shell + cargo test --all-features --workspace + ``` + +- Check to see if there are code formatting issues + + ```shell + cargo fmt --all -- --check + ``` + +- Format the code in the project + + ```shell + cargo fmt --all + ``` @@ -2,6 +2,9 @@ name = "multiwan-dyndns" version = "0.1.0" edition = "2024" +description = "Console tool for determining WAN ip addresses and registering them with dyndns providers. Written in rust-lang." +repository = "https://github.com/guspower/multiwan-dyndns" +license = "MIT OR Apache-2.0" [dependencies] reqwest = "0.12.15" diff --git a/README.md b/README.md new file mode 100644 index 0000000..c83f9fe --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# multiwan-dyndns + +[](https://crates.io/crates/multiwan-dyndns) +[](https://docs.rs/multiwan-dyndns) +[](https://github.com/guspower/multiwan-dyndns/actions) + +## Installation + +- TODO + +## License + +Licensed under either of + + * Apache License, Version 2.0 + ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0) + * MIT license + ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) + +at your option. + +## Contribution + +Unless you explicitly state otherwise, any contribution intentionally submitted +for inclusion in the work by you, as defined in the Apache-2.0 license, shall be +dual licensed as above, without any additional terms or conditions. + +See [CONTRIBUTING.md](CONTRIBUTING.md). |
