-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8cbb89a
commit 9073fc7
Showing
38 changed files
with
1,063 additions
and
668 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# clipboard api is still unstable, so web-sys requires the below flag to be passed for copy (ctrl + c) to work | ||
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html | ||
# check status at https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility | ||
# we don't use `[build]` because of rust analyzer's build cache invalidation https://github.com/emilk/eframe_template/issues/93 | ||
[target.wasm32-unknown-unknown] | ||
rustflags = ["--cfg=web_sys_unstable_apis"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
if ! has nix_direnv_version || ! nix_direnv_version 2.1.1; then | ||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.1.1/direnvrc" "sha256-b6qJ4r34rbE23yWjMqbmu3ia2z4b2wIlZUksBke/ol0=" | ||
fi | ||
use flake | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Github Pages | ||
|
||
# By default, runs if you push to main. keeps your deployed app in sync with main branch. | ||
on: | ||
push: | ||
branches: | ||
- master | ||
# to only run when you do a new github release, comment out above part and uncomment the below trigger. | ||
# on: | ||
# release: | ||
# types: | ||
# - published | ||
|
||
permissions: | ||
contents: write # for committing to gh-pages branch. | ||
|
||
jobs: | ||
build-github-pages: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 # repo checkout | ||
- name: Setup toolchain for wasm | ||
run: | | ||
rustup update stable | ||
rustup default stable | ||
rustup set profile minimal | ||
rustup target add wasm32-unknown-unknown | ||
- name: Rust Cache # cache the rust build artefacts | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Download and install Trunk binary | ||
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | ||
- name: Build # build | ||
# Environment $public_url resolves to the github project page. | ||
# If using a user/organization page, remove the `${{ github.event.repository.name }}` part. | ||
# using --public-url something will allow trunk to modify all the href paths like from favicon.ico to repo_name/favicon.ico . | ||
# this is necessary for github pages where the site is deployed to username.github.io/repo_name and all files must be requested | ||
# relatively as eframe_template/favicon.ico. if we skip public-url option, the href paths will instead request username.github.io/favicon.ico which | ||
# will obviously return error 404 not found. | ||
run: ./trunk build --release --public-url $public_url crates/opensi-editor/index.html | ||
env: | ||
public_url: "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}" | ||
- name: Deploy | ||
uses: JamesIves/github-pages-deploy-action@v4 | ||
with: | ||
folder: dist | ||
# this option will not maintain any history of your previous pages deployment | ||
# set to false if you want all page build to be committed to your gh-pages branch history | ||
single-commit: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,173 @@ | ||
name: Rust | ||
on: [push, pull_request, workflow_dispatch] | ||
|
||
on: [push] | ||
name: CI | ||
|
||
env: | ||
# --cfg=web_sys_unstable_apis is required to enable the web_sys clipboard API which egui_web uses | ||
# https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Clipboard.html | ||
# https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html | ||
RUSTFLAGS: -D warnings --cfg=web_sys_unstable_apis | ||
RUSTDOCFLAGS: -D warnings | ||
|
||
jobs: | ||
build: | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --all-features | ||
|
||
check_wasm: | ||
name: Check wasm32 | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: check | ||
args: --all-features --lib --target wasm32-unknown-unknown | ||
|
||
test: | ||
name: Test Suite | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
- run: sudo apt-get install libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --lib | ||
|
||
fmt: | ||
name: Rustfmt | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: rustfmt | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: fmt | ||
args: --all -- --check | ||
|
||
clippy: | ||
name: Clippy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
components: clippy | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: clippy | ||
args: -- -D warnings | ||
|
||
trunk: | ||
name: trunk | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: 1.76.0 | ||
target: wasm32-unknown-unknown | ||
override: true | ||
- name: Download and install Trunk binary | ||
run: wget -qO- https://github.com/thedodd/trunk/releases/latest/download/trunk-x86_64-unknown-linux-gnu.tar.gz | tar -xzf- | ||
- name: Build | ||
run: ./trunk build crates/opensi-editor/index.html | ||
|
||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- os: macos-latest | ||
TARGET: aarch64-apple-darwin | ||
|
||
- os: ubuntu-latest | ||
TARGET: aarch64-unknown-linux-gnu | ||
|
||
- os: ubuntu-latest | ||
TARGET: armv7-unknown-linux-gnueabihf | ||
|
||
- os: ubuntu-latest | ||
TARGET: x86_64-unknown-linux-gnu | ||
|
||
- os: windows-latest | ||
TARGET: x86_64-pc-windows-msvc | ||
EXTENSION: .exe | ||
|
||
steps: | ||
- uses: actions/checkout@v1 | ||
- name: Install GTK | ||
run: sudo apt-get install libgtk-3-dev | ||
- name: Building ${{ matrix.TARGET }} | ||
run: echo "${{ matrix.TARGET }}" | ||
|
||
- uses: actions/checkout@master | ||
- name: Install build dependencies - Rustup | ||
run: | | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --profile default --target ${{ matrix.TARGET }} -y | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
# For linux, it's necessary to use cross from the git repository to avoid glibc problems | ||
# Ref: https://github.com/cross-rs/cross/issues/1510 | ||
- name: Install cross for linux | ||
if: contains(matrix.TARGET, 'linux') | ||
run: | | ||
cargo install cross --git https://github.com/cross-rs/cross --rev 1b8cf50d20180c1a394099e608141480f934b7f7 | ||
- name: Install cross for mac and windows | ||
if: ${{ !contains(matrix.TARGET, 'linux') }} | ||
run: | | ||
cargo install cross | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
run: | | ||
cross build --verbose --release --target=${{ matrix.TARGET }} --bin opensi-editor | ||
- name: Rename | ||
run: cp target/${{ matrix.TARGET }}/release/opensi-editor${{ matrix.EXTENSION }} opensi-editor-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
|
||
- uses: actions/upload-artifact@master | ||
with: | ||
name: opensi-editor-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
path: opensi-editor-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
|
||
- uses: svenstaro/upload-release-action@v2 | ||
name: Upload binaries to release | ||
if: ${{ github.event_name == 'push' }} | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: opensi-editor-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
asset_name: opensi-editor-${{ matrix.TARGET }}${{ matrix.EXTENSION }} | ||
tag: ${{ github.ref }} | ||
prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
# Environment | ||
.vscode/ | ||
.direnv | ||
|
||
# Rust | ||
Cargo.lock | ||
*/target | ||
/target | ||
.vscode/ | ||
|
||
# Trunk | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = [ | ||
"opensi", | ||
"opensi-client", | ||
"opensi-editor" | ||
"crates/opensi-core", | ||
"crates/opensi-editor" | ||
] | ||
|
||
[workspace.package] | ||
authors = ["barsoosayque <[email protected]>", "snpefk <[email protected]>"] | ||
edition = "2021" | ||
license = "MIT" | ||
rust-version = "1.76" | ||
version = "0.1.0" | ||
|
||
[profile.release] | ||
opt-level = 2 # fast and small wasm | ||
|
||
# Optimize all dependencies even in debug builds: | ||
[profile.dev.package."*"] | ||
opt-level = 2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,21 @@ | ||
# opensi | ||
# opensi-editor | ||
|
||
![Rust](https://github.com/opensi/opensi/workflows/Rust/badge.svg) | ||
|
||
Open SI Game - реализация популярной телеигры на Rust | ||
Редактор вопросов для популярной реализации "Своей игры": [SiGame](https://vladimirkhil.com/si/game) | ||
|
||
## Пакеты с игрой | ||
|
||
opensi совместимыми пакетим формата `*.siq` из популярной реализации "Своей игры" - [SiGame](https://vladimirkhil.com/si/game) | ||
|
||
## Разработка | ||
|
||
Редактор зависит от GTK, поэтому перед разработкой стоит [установить](http://gtk-rs.org/docs/requirements.html) **GTK+**, **GLib** и **Cairo** | ||
|
||
### Debian & Ubuntu | ||
|
||
```shell | ||
sudo apt-get install libgtk-3-dev | ||
``` | ||
|
||
### Fedora | ||
|
||
```shell | ||
$ sudo dnf install gtk3-devel glib2-devel | ||
Доступен в веб формате: [OpenSI Editor Web](opensi.github.io/opensi-editor). | ||
|
||
### Fedora 21 and earlier | ||
$ sudo yum install gtk3-devel glib2-devel | ||
## Пакеты с игрой | ||
|
||
``` | ||
OpenSI Editor совместим с пакетами формата `*.siq` из SIGame. | ||
|
||
## Сборка и запуск | ||
|
||
Для клиента игры и для редактора существуют отдельные bin-конфигурации: | ||
|
||
```shell | ||
# Клиент | ||
$ cargo run --bin opensi-client | ||
# Обычный запуск нативной версии | ||
$ cargo run opensi-editor | ||
|
||
# Редактор | ||
$ cargo run --bin opensi-editor | ||
# Запуск веб-версии (потребуется установка trunk) | ||
$ trunk serve crates/opensi-editor/index.html | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[package] | ||
name = "opensi-core" | ||
version.workspace = true | ||
authors.workspace = true | ||
license.workspace = true | ||
edition.workspace = true | ||
rust-version.workspace = true | ||
|
||
[dependencies] | ||
serde = { version = "1.0", features = [ "derive" ] } | ||
quick-xml = { version = "0.17", features = [ "serialize" ] } | ||
zip = { version = "0.5.4", default-features = false, features = ["deflate"] } | ||
percent-encoding = "2.1.0" |
Oops, something went wrong.