Skip to content

Commit

Permalink
chore: update main with latest develop #100
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronleopold authored Mar 17, 2023
2 parents 54bd467 + fd0feed commit bb67ec2
Show file tree
Hide file tree
Showing 477 changed files with 21,341 additions and 12,646 deletions.
3 changes: 1 addition & 2 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
[alias]
prisma = "run --package prisma --"
prisma = "run --package prisma-cli --"
integration-tests = "test --package integration-tests -- --test-threads 1"
doc-tests = "cargo test --doc -- --show-output"
build-server = "build --package stump_server --bin stump_server --release --"

# this caused me such an unbearable headache...
[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
Expand Down
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ dist
static
apps/server/client
target
*.lock
*-lock.*
*.log
*.db
.git

# ignore contents in excess directories, some are kept only so cargo
# doesn't yell at me
Expand Down
7 changes: 7 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
node_modules/
*.min.js
*.map
*.snap
**/prisma/src/db.ts
**/prisma-cli/**
**/dist/**
55 changes: 55 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
module.exports = {
env: {
browser: true,
node: true,
},
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:react/recommended',
'plugin:react-hooks/recommended',
'prettier',
],
overrides: [
{
files: ['*.jsx', '*.tsx', '*.ts'],
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
'no-console': ['error', { allow: ['warn', 'error', 'debug'] }],
'react/react-in-jsx-scope': 'off',
},
},
{
files: ['*.config.js', '.eslintrc.js'],
rules: {
'@typescript-eslint/no-var-requires': 'off',
'import/no-commonjs': 'off',
'sort-keys': 'off',
'unicorn/prefer-module': 'off',
},
},
],
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
project: 'tsconfig.eslint.json',
tsconfigRootDir: __dirname,
},
plugins: ['@typescript-eslint', 'simple-import-sort', 'prettier', 'sort-keys-fix', 'react'],
root: true,
rules: {
'import/no-unresolved': 'off',
'import/no-useless-path-segments': 'off',
'no-console': 'error',
'simple-import-sort/exports': 'error',
'simple-import-sort/imports': 'error',
'sort-keys-fix/sort-keys-fix': 'warn',
},
settings: {
react: {
version: 'detect',
},
},
}
9 changes: 0 additions & 9 deletions .gitattributes

This file was deleted.

22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md → .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
72 changes: 72 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Contributing

You can contribute by opening new issues or PRs. Do not make random PRs without talking with me first - to ensure nobody's time and effort is wasted, please follow the guidelines below.

## Guidelines

1. Check to see if an issue already exists relevant to your feature/topic
2. Create an issue (if an issue does not already exist) and express interest in working it (see the [issues](#issues) section below)
3. Create a fork of the repository.
4. Create a new feature branch **off of the `develop` branch** - _not_ `main`.
5. Add appropiate documentation, tests, etc, if necessary.
6. Ensure you have your code formatters properly configured (both Prettier and Rustfmt).
7. Once you've completed your changes, create a PR from your feature branch into `develop` - _not_ `main`.
8. Be sure to update your feature branch with any new changes **before** making the PR.
9. Follow the PR naming format to help ensure the changelog generator properly picks up your additions:

```
<type>: <description>
```

Where `type` is one of the following:

- `feat`: A new feature
- `fix`: A bug fix
- `docs`: Documentation only changes
- `refactor`: A code change that neither fixes a bug nor adds a feature
- `perf`: A code change that improves performance
- `test`: Adding missing tests or correcting existing tests
- `ci`: Changes to our CI configuration files and scripts
- `chore`: Other changes that don't modify `src` or `test` files, such as updating `package.json` or `README.md`
- `revert`: Reverts a previous commit
- `WIP`: Work in progress

The `description` should contain a _succinct_ description of the change:

- use the imperative, present tense: "change" not "changed" nor "changes"
- don't capitalize the first letter
- no dot (.) at the end

Examples:

```
feat: add support for Reading Lists
fix: remove broken link
docs: update CONTRIBUTING.md to include PR naming format
```

10. Stick around and make sure your PR passes all checks and gets merged!

## Issues

I don't have any strict guidelines for issues, but do please try and be as descriptive as possible. There are a few templates to help you out, but in general:

- If you're interested in working on an issue, please leave a comment so that I know you're interested.
- If you're opening an issue to request a feature, please try and explain why you think it would be a good addition to the project. If applicable, include example use cases.
- If you're opening an issue to report a bug, try to fill in the template as best you can. If you can, please include a minimal reproduction of the bug (video, code, etc).
- If you're not sure if an issue is relevant appropriate, e.g. if you have more of a question to ask, feel free to pop in the [Discord server](https://discord.gg/63Ybb7J3as) and ask!

**Please don't ghost an issue you've been assigned** - if you're no longer interested in working on it, that is totally okay! Just leave a comment on the issue so that I know you're no longer interested and I can reassign it to someone else. I will never be offended if you no longer want to work on an issue - I'm just trying to make sure that nobody's time and effort is wasted.

## A note on merging

I will not merge your PR until:

- It aligns with the [guidelines](#guidelines) outlined above
- In most cases, any issues outside of a malformed PR name, I will not fix for you. If you're unsure how to fix it, ask for help. Stale PRs will be closed after 10 days.
- All checks pass
- At least one maintainer has reviewed your PR

All PRs to `develop` will be squashed. All PRs to `main` will be merge commits. This is to ensure that the commit history is clean and easy to follow, and to ensure that the changelog generator works properly.

Thanks for considering to contribute! :heart:
23 changes: 0 additions & 23 deletions .github/CONTRIBUTORS.md

This file was deleted.

37 changes: 37 additions & 0 deletions .github/actions/build-desktop/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 'Build Stump desktop app'
description: 'Compile the Stump desktop app'

inputs:
platform:
description: 'The plaform of the runner'
required: true

runs:
using: composite
steps:
- name: Checkout project
uses: actions/checkout@v3

# - name: Configure environment
# run: |
# if [[ ${{ inputs.platform }} == 'linux' || ${{ inputs.platform }} == 'windows' ]]; then
# echo "RUN_SETUP=false" >> $GITHUB_ENV
# else
# echo "RUN_SETUP=true" >> $GITHUB_ENV
# fi

- name: Setup rust
uses: ./.github/actions/setup-cargo

- name: Generate Prisma client
uses: ./.github/actions/setup-prisma

- name: Copy bundled web app
uses: actions/download-artifact@v3
with:
name: webapp
path: ./apps/desktop/dist

- name: Compile desktop app
shell: bash
run: cargo build --package stump_desktop --release
108 changes: 108 additions & 0 deletions .github/actions/build-docker/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: 'Build docker image'
description: 'Build and load or push a tagged docker image for stump'

inputs:
username:
description: 'Username for docker login'
required: true
password:
description: 'Token for docker login'
required: true
load:
description: 'Set output-type to docker'
default: 'true'
push:
description: 'Set output-type to registry'
default: 'false'
tags:
description: 'List of tags to assigned to the image'
default: 'nightly'
platforms:
description: 'List of platforms to build'
required: true
discord-webhook:
description: 'Discord webhook to send notifications to'
required: true

runs:
using: composite
steps:
- name: Get commit short sha
run: echo "GIT_REV=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
shell: bash

- name: Format tags
run: |
echo "TAGS=$(echo ${{ inputs.tags }} | sed -e 's/,/,aaronleopold\/stump:/g' | sed -e 's/^/aaronleopold\/stump:/')" >> $GITHUB_ENV
shell: bash

- name: Setup rust
uses: ./.github/actions/setup-cargo

- name: Generate Prisma client
uses: ./.github/actions/setup-prisma

# TODO: uncomment once cache stuff is resolved...
# - name: Setup Docker layers cache
# uses: actions/cache@v3
# with:
# path: /tmp/.buildx-cache
# key: ${{ runner.os }}-buildx-${{ github.sha }}
# restore-keys: |
# ${{ runner.os }}-buildx-

# We only need QEMU when an arm* platform is targeted
- name: Check QEMU requirement
id: check-qemu
run: |
if [[ ${{ inputs.platforms }} == *"arm"* ]]; then
echo "SETUP_QEMU=1" >> $GITHUB_OUTPUT
else
echo "SETUP_QEMU=0" >> $GITHUB_OUTPUT
fi
shell: bash

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
if: ${{ steps.check-qemu.outputs.SETUP_QEMU == '1' }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ inputs.username }}
password: ${{ inputs.password }}

- name: Run buildx build
uses: docker/build-push-action@v4
with:
context: .
build-args: |
"GIT_REV=${{ env.GIT_REV }}"
file: scripts/release/Dockerfile
platforms: ${{ inputs.platforms }}
load: ${{ inputs.load }}
push: ${{ inputs.push }}
tags: ${{ env.TAGS }}
# TODO: uncomment once cache stuff is resolved...
# cache-from: type=local,src=/tmp/.buildx-cache
# cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# https://github.com/docker/build-push-action/issues/252
# TODO: https://github.com/moby/buildkit/issues/1896
# TODO: uncomment once cache stuff is resolved...
# - name: Move buildx cache
# run: |
# rm -rf /tmp/.buildx-cache
# mv /tmp/.buildx-cache-new /tmp/.buildx-cache
# shell: bash

- name: Discord notification
if: ${{ success() && inputs.push == 'true' }}
env:
DISCORD_WEBHOOK: ${{ inputs.discord-webhook }}
uses: 'Ilshidur/[email protected]'
with:
args: 'Successfully pushed the following image tags to registry: ${{ env.TAGS }}'
Loading

0 comments on commit bb67ec2

Please sign in to comment.