Skip to content

Commit

Permalink
Merge pull request #131 from sm64js/MMO_benchmark_rust
Browse files Browse the repository at this point in the history
Rust server
  • Loading branch information
sm64js committed Nov 26, 2020
2 parents bfb2abc + 761ba28 commit 67e8d57
Show file tree
Hide file tree
Showing 26 changed files with 5,302 additions and 1,361 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/node_modules
/dist
/target
37 changes: 37 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
on:
push:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"
pull_request:
paths:
- "**/Cargo.toml"
- "**/Cargo.lock"

name: Rust Server Audit

jobs:
ci:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
name: Checkout

- uses: actions-rs/toolchain@v1
name: Install Toolchain
with:
profile: minimal
toolchain: nightly-2020-10-23
override: true

- uses: actions-rs/cargo@v1
name: Install Cargo Tools
with:
command: install
args: cargo-audit

- uses: actions-rs/cargo@v1
name: Audit
with:
command: audit
112 changes: 112 additions & 0 deletions .github/workflows/test-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
on: [push, pull_request]

name: Rust Server Test & Publish

jobs:
test:
runs-on: ubuntu-latest
# TODO run Rust stuff conditionally
# push:
# paths:
# - "rust-server/**/*"
# - ".github/workflows/test-and-publish.yml"
# pull_request:
# paths:
# - "rust-server/**/*"
# - ".github/workflows/test-and-publish.yml"

env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
SCCACHE_CACHE_SIZE: 500M
SCCACHE_DIR: /home/runner/.cache/sccache
SCCACHE_IDLE_TIMEOUT: 0

steps:
- uses: actions/checkout@v2
name: Checkout

- uses: actions-rs/toolchain@v1
name: Install Toolchain
with:
profile: minimal
toolchain: nightly-2020-10-23
override: true
components: rustfmt, clippy

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
/home/runner/.cache/sccache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install sccache
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: 0.2.13
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
mkdir -p $HOME/.local/bin
curl -L "$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz" | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Start sccache server
run: |
sccache --start-server
- uses: actions-rs/cargo@v1
name: Check
with:
command: check

# TODO needs tests
# - uses: actions-rs/cargo@v1
# name: Test
# with:
# command: test

- uses: actions-rs/cargo@v1
name: Fmt
with:
command: fmt
args: -- --check

- uses: actions-rs/cargo@v1
name: Clippy
with:
command: clippy
args: -- -D warnings

publish:
# this needs to be changed, if the Rust server should be published from a different branch
if: github.ref == 'refs/heads/MMO_benchmark_rust'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
name: Checkout

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
/home/runner/.cache/sccache
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Setup cache
run: |
mkdir sccache
sudo mount -o bind /home/runner/.cache/sccache sccache
- name: Deploy to Docker Hub
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: bash publish-rust-server.sh
continue-on-error: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
dist
testdb.json
*lock.json
yarn.lock
node_modules
/target
testdb.json
.vs*
.DS_Store
extractTools/.assets-local.txt
Expand Down

0 comments on commit 67e8d57

Please sign in to comment.