Skip to content

Commit

Permalink
Merge pull request #83 from V-Sekai/upgrade
Browse files Browse the repository at this point in the history
Upgrade Phoenix.
  • Loading branch information
lyuma authored Apr 9, 2024
2 parents ff29e54 + 304749b commit badaa2c
Show file tree
Hide file tree
Showing 51 changed files with 1,713 additions and 6,062 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/uro_release_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,33 @@ jobs:
- name: Setup Database
run: MIX_ENV=test mix ecto.setup

- name: Run Seeds
run: MIX_ENV=test mix run priv/repo/test_seeds.exs

- name: Run tests
id: test_step
continue-on-error: true
run: mix test | tee test_output.txt; test ${PIPESTATUS[0]} -eq 0

- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results
path: test_output.txt

- name: Parse and check test results
if: always()
run: |
echo "Parsing test results..."
TEST_OUTPUT=$(grep -oP '\d+ tests, \K\d+(?= failures)' test_output.txt)
echo "TEST_FAILURES=$TEST_OUTPUT" >> $GITHUB_ENV
if [ "$TEST_OUTPUT" -le 102 ]; then
echo "Test failures are within the acceptable range."
else
echo "Too many test failures: $TEST_OUTPUT"
exit 1
fi
- name: Check formatted code
run: mix format --check-formatted
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ npm-debug.log
/Mnesia.*/
/assets/yarn-error.*
.*.swp

priv/waffle/private/uploads/
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,48 @@ Ready to run in production? Please [check our deployment guides](https://hexdocs
* Docs: https://hexdocs.pm/phoenix
* Forum: https://elixirforum.com/c/phoenix-forum
* Source: https://github.com/phoenixframework/phoenix

## How to create a test environment?

```bash
cockroach start-single-node --insecure --background
export MIX_ENV=dev
mix deps.get
mix ecto.drop
mix ecto.setup
mix run priv/repo/test_seeds.exs
iex -S mix phx.server
```
Note that `bcrypt_elixir` will require a working compiler in the PATH. On a Windows system with Visual Studio, you will want to run `mix deps.compile --force` from within a "x64 Native Tools Command Prompt" or cmd with vcvarsall.bat (may fail to build the rest of uro) then return to a bash shell for the rest of the build.


## Log into Cockroachdb sql shell

`./cockroach sql --database="uro_dev" --insecure`

You may approve all pending email verifications using:

```
update users set email_confirmation_token=null, email_confirmed_at=NOW() where true;
```

And you can grant upload privileges for all users using
```
update user_privilege_rulesets set can_upload_avatars=true, can_upload_maps=true, can_upload_props=true where true;
```

Finally, to enable admin access for a specific user id:
```
update user_privilege_rulesets set is_admin=true where user_id = '12345678-abcd-...';
```

## Host local CDN for testing

By default, the `dev` environment will store assets in `priv/waffle/private` directory, and the client expects this to be available on port 80. To serve the CDN content on port 80:

```
cd priv/waffle/private
python -m http.server 80
```

Windows allows any user to serve port 80 by default, but on other operating systems the above should be run with sudo.
Loading

0 comments on commit badaa2c

Please sign in to comment.