Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Nov 27, 2024
0 parents commit c52b05d
Show file tree
Hide file tree
Showing 67 changed files with 13,043 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]

[target.i686-pc-windows-msvc]
rustflags = ["-Ctarget-feature=+crt-static"]
10 changes: 10 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
root = true

[*]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.{feature,json,md,yaml,yml}]
indent_size = 2
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
49 changes: 49 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Problem
description: Report a problem.
labels: ["bug"]
body:
- type: dropdown
attributes:
label: Application version
description: If you're not using the latest version, please update and make sure the problem still occurs.
options:
- v0.1.0
- Other
validations:
required: true
- type: dropdown
attributes:
label: Operating system
options:
- Windows
- Mac
- Linux
- Linux (Steam Deck)
validations:
required: true
- type: dropdown
attributes:
label: Installation method
options:
- Standalone
- Cargo
- Flatpak
- Scoop
- Other
validations:
required: true
- type: textarea
attributes:
label: Description
description: What happened?
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: >-
Please provide any relevant screenshots, CLI output, or log files.
Refer to the documentation to
[find your config file](https://github.com/mtkennerly/madamiru/blob/master/docs/help/configuration-file.md)
and/or [enable verbose logging](https://github.com/mtkennerly/madamiru/blob/master/docs/help/logging.md).
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Feature
description: Suggest a new feature or change.
labels: ["enhancement"]
body:
- type: textarea
attributes:
label: What's your idea?
validations:
required: true
9 changes: 9 additions & 0 deletions .github/ISSUE_TEMPLATE/question.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Question
description: Ask a question.
labels: ["question"]
body:
- type: textarea
attributes:
label: What's your question?
validations:
required: true
104 changes: 104 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
on:
- push
- pull_request

name: Main

jobs:
build:
strategy:
matrix:
include:
- os: windows-latest
rust-target: x86_64-pc-windows-msvc
artifact-name: win64
artifact-file: madamiru.exe
tar: false
- os: windows-latest
rust-target: i686-pc-windows-msvc
artifact-name: win32
artifact-file: madamiru.exe
tar: false
- os: ubuntu-20.04
rust-target: x86_64-unknown-linux-gnu
artifact-name: linux
artifact-file: madamiru
tar: true
- os: macos-13
rust-target: x86_64-apple-darwin
artifact-name: mac
artifact-file: madamiru
tar: true
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-python@v5
with:
python-version: '3.7'
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: mtkennerly/dunamai-action@v1
with:
env-var: MADAMIRU_VERSION
args: --style semver
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable-${{ matrix.rust-target }}
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}-${{ matrix.rust-target }}
- if: ${{ matrix.os == 'ubuntu-20.04' }}
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev
- run: cargo build --release
- if: ${{ matrix.tar }}
run: |
cd target/release
tar --create --gzip --file=madamiru-v${{ env.MADAMIRU_VERSION }}-${{ matrix.artifact-name }}.tar.gz ${{ matrix.artifact-file }}
- if: ${{ matrix.tar }}
uses: actions/upload-artifact@v4
with:
name: madamiru-v${{ env.MADAMIRU_VERSION }}-${{ matrix.artifact-name }}
path: target/release/madamiru-v${{ env.MADAMIRU_VERSION }}-${{ matrix.artifact-name }}.tar.gz
- if: ${{ !matrix.tar }}
uses: actions/upload-artifact@v4
with:
name: madamiru-v${{ env.MADAMIRU_VERSION }}-${{ matrix.artifact-name }}
path: target/release/${{ matrix.artifact-file }}

test:
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev
- run: cargo test

lint:
strategy:
matrix:
os:
- windows-latest
- ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.os }}
- if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get update && sudo apt-get install -y gcc libxcb-composite0-dev libgtk-3-dev
- run: cargo fmt --all -- --check
- run: cargo clippy --workspace -- --deny warnings
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target
/dist
/tmp
tarpaulin-report.html
*~
16 changes: 16 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: ^tests/
- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: v1.1.7
hooks:
- id: forbid-tabs
- repo: https://github.com/mtkennerly/pre-commit-hooks
rev: v0.2.0
hooks:
- id: cargo-fmt
- id: cargo-clippy
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Unreleased

* Initial release.
82 changes: 82 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
## Development
### Prerequisites
Use the latest version of Rust.

On Linux, you'll need some additional system packages.
Refer to [the installation guide](/docs/help/installation.md) for the list.

### Commands
* Run program:
* `cargo run`
* Run tests:
* `cargo test`
* Activate pre-commit hooks (requires Python) to handle formatting/linting:
```
pip install --user pre-commit
pre-commit install
```

### Environment variables
These are optional:

* `MADAMIRU_VERSION`:
* If set, shown in the window title instead of the Cargo.toml version.
* Intended for CI.

### Icon
The master icon is `assets/icon.kra`, which you can edit using
[Krita](https://krita.org/en) and then export into the other formats.

### Release preparation
Commands assume you are using [Git Bash](https://git-scm.com) on Windows.

#### Dependencies (one-time)
```bash
pip install invoke
cargo install cargo-lichking

# Verified with commit ba58a5c44ccb7d2e0ca0238d833d17de17c2b53b:
curl -o /c/opt/flatpak-cargo-generator.py https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py
pip install aiohttp toml
```

Also install the Crowdin CLI tool manually.

#### Process
* Update version in `CHANGELOG.md`
* Update version in `Cargo.toml`
* Update version in `assets/linux/com.mtkennerly.madamiru.metainfo.xml`,
including the `releases` section and the screenshot URL.
* Run `invoke prerelease`
* If you already updated the translations separately,
then run `invoke prerelease --no-update-lang`
* Update the translation percentages in src/lang.rs
* Run `cargo build` to update the version in Cargo.lock
* Add the new version to `.github/ISSUE_TEMPLATE/*.yaml`.
* Update the documentation if necessary for any new features.
Check for any new content that needs to be uncommented (`<!--`).
* Run `git add` for all relevant changes
* Run `invoke release`
* This will create a new commit/tag and push them.
* Manually create a release on GitHub and attach the workflow build artifacts
(plus `dist/*-legal.zip`).
For Linux and Mac, extract the `.tar.gz` files from the `.zip` files.
* Run `cargo publish`
* Run `invoke release-flatpak`
* This will automatically push a branch to https://github.com/flathub/com.github.mtkennerly.madamiru .
* Manually open a PR for that branch.
* After the PR is merged, publish via https://buildbot.flathub.org/#/apps/com.github.mtkennerly.madamiru .
* Run `invoke release-winget`
* When the script opens VSCode and pauses,
manually edit `manifests/m/mtkennerly/madamiru/${VERSION}/mtkennerly.madamiru.locale.en-US.yaml`
to add the `ReleaseNotes` and `ReleaseNotesUrl` fields:

```yaml
ReleaseNotes: |-
<copy/paste from CHANGELOG.md>
ReleaseNotesUrl: https://github.com/mtkennerly/madamiru/releases/tag/v${VERSION}
```
Close the file, and the script will continue.
* This will automatically push a branch to a fork of https://github.com/microsoft/winget-pkgs .
* Manually open a pull request for that branch.
Loading

0 comments on commit c52b05d

Please sign in to comment.