Skip to content

Commit

Permalink
fix: eslint/actions/issue templates
Browse files Browse the repository at this point in the history
  • Loading branch information
SpikeHD committed May 8, 2024
1 parent 477bc66 commit 917fafb
Show file tree
Hide file tree
Showing 12 changed files with 1,304 additions and 13 deletions.
35 changes: 35 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["@typescript-eslint"],
"rules": {
"@typescript-eslint/ban-types": [
"warn",
{
"extendDefaults": true,
"types": {
"{}": false
}
}
],
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_"
}
],
"semi": ["error", "never"],
"quotes": ["error", "single"],
"indent": ["error", 2]
}
}
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
name: Bug report
about: Create a report to help RogueTop improve
title: "[Bug]"
labels: bug
assignees: ''

---

**Describe the bug**
Describe the problem here.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
Describe what should be expected here.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**System Info (please complete the following information):**
- OS: [e.g. Windows 11, Ubuntu 22.04]
- Version: [e.g. v0.1.0]
- Any other relevant info:

**Additional context**
Add any other context about the problem here.
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: true
contact_links:
- name: Discord
url: https://discord.gg/agQ9mRdHMZ
about: Ask anything non-bug/feature related here (such as "How does XYZ work?" or "Why does ZYX work the way it does?")
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature Request]"
labels: enhancement
assignees: ''

---

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

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

**Describe 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.
92 changes: 92 additions & 0 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Check backend

on:
workflow_dispatch:
push:
paths:
- '.github/workflows/backend.yml'
- 'package.json'
- 'src-tauri/**'
- 'updater/**'
pull_request:
paths:
- '.github/workflows/backend.yml'
- 'package.json'
- 'src-tauri/**'
- 'updater/**'

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0

jobs:
rustfmt:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
matrix:
platform: [windows-latest, ubuntu-20.04, macos-latest]

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
with:
components: rustfmt

- name: Rustfmt check
run: cargo fmt --manifest-path ./src-tauri/Cargo.toml --all -- --check

# also check updater
- name: Rustfmt check updater
run: cargo fmt --manifest-path ./updater/Cargo.toml --all -- --check

clippy:
runs-on: ${{ matrix.platform }}

strategy:
fail-fast: false
matrix:
platform: [windows-latest, ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
with:
components: clippy
- uses: pnpm/action-setup@v3
with:
version: latest

- name: Install Linux dependencies
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
updater/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Build frontend (creates '../dist')
run: pnpm install && pnpm build

- name: Clippy check
run: cargo clippy --manifest-path ./src-tauri/Cargo.toml --no-default-features -- -D warnings
178 changes: 178 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
name: Build

on:
workflow_dispatch:
push:
paths:
- '.github/workflows/build.yml'
- 'package.json'
- 'src-tauri/**/*'
- 'src/**/*'
- 'updater/**/*'
pull_request:
paths:
- '.github/workflows/build.yml'
- 'package.json'
- 'src-tauri/**/*'
- 'src/**/*'
- 'updater/**/*'

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

env:
CARGO_INCREMENTAL: 0

jobs:
build:
runs-on: ${{ matrix.config.platform }}

strategy:
fail-fast: false
matrix:
config:
- platform: ubuntu-latest
target: 'x86_64-unknown-linux-gnu'
- platform: ubuntu-latest
target: 'aarch64-unknown-linux-gnu'
- platform: ubuntu-latest
target: 'armv7-unknown-linux-gnueabihf'

- platform: macos-latest
target: 'x86_64-apple-darwin'
- platform: macos-latest
target: 'aarch64-apple-darwin'

- platform: windows-latest
target: 'x86_64-pc-windows-msvc'
- platform: windows-latest
target: 'aarch64-pc-windows-msvc'

steps:
- uses: actions-rust-lang/setup-rust-toolchain@v1.8
- uses: pnpm/action-setup@v3
with:
version: latest

- name: Checkout
uses: actions/checkout@v4

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: latest

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
src-tauri/target/
updater/target/
key: ${{ runner.os }}-${{ matrix.config.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: (Linux) Install dependencies
if: matrix.config.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
libssl-dev \
libgtk-3-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Add target
run: rustup target add ${{ matrix.config.target }}

- name: Install Cargo tauri CLI
run: cargo install tauri-cli --version "^2.0.0-beta"

- name: Install dependencies
run: pnpm install

- name: Build
# If we are compiling for Windows ARM, we can only support NSIS
run: cargo tauri build --target ${{ matrix.config.target }} ${{ matrix.config.target == 'aarch64-pc-windows-msvc' && '--bundles nsis' || '' }}
env:
RUSTFLAGS: -Awarnings

# For portable installs
- name: Create empty config.json
run: cd src-tauri/target/${{ matrix.config.target }}/release && echo {} > config.json

# paths:
# Windows:
# - src-tauri/target/${{ matrix.config.target }}/release/PokeRogue.exe
# Ubuntu:
# - src-tauri/target/${{ matrix.config.target }}/release/pokerogue
# MacOS:
# - src-tauri/target/${{ matrix.config.target }}/release/bundle/macos/PokeRogue.app
- name: (Windows) Compress build
if: matrix.config.platform == 'windows-latest'
run: cd src-tauri/target/${{ matrix.config.target }}/release && 7z a -tzip -mx9 RogueTop.zip
PokeRogue.exe
config.json

- name: (Linux) Compress build
if: matrix.config.platform == 'ubuntu-latest'
run: cd src-tauri/target/${{ matrix.config.target }}/release && tar -czvf roguetop.tar.gz pokerogue config.json

# Windows portable
- name: (Windows) Upload portable
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-portable
path: RogueTop.zip

# Windows MSI
- name: (Windows) Upload .msi
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-msi
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/msi/*.msi

# Windows ARM only supports NSIS right now, but we should upload that too
- name: (Windows) Upload NSIS
if: matrix.config.platform == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-nsis
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/nsis/*.exe

# Ubuntu portable
- name: (Linux) Upload portable
if: matrix.config.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-portable
path: src-tauri/target/${{ matrix.config.target }}/release/roguetop.tar.gz

# Ubuntu deb
- name: (Linux) Upload .deb
if: matrix.config.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-deb
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/deb/*.deb

- name: (Linux) Upload .appimage
if: matrix.config.platform == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-appimage
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/appimage/*.AppImage

- name: (MacOS) Upload .dmg
if: matrix.config.platform == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: roguetop-${{ matrix.config.target }}-dmg
path: src-tauri/target/${{ matrix.config.target }}/release/bundle/dmg/*.dmg
Loading

0 comments on commit 917fafb

Please sign in to comment.