Skip to content

Commit

Permalink
Fix thunderstore URL #804 and logs not logging to file #803 (#807)
Browse files Browse the repository at this point in the history
* Update Rust version to 1.77 and refactor server startup

* Remove empty lines in metrics route file

* Fix CI

* Commented out dead  code for now

* Fixed converstion to make vs cargo-make
  • Loading branch information
mbround18 authored Apr 21, 2024
1 parent ec12255 commit 0d694d8
Show file tree
Hide file tree
Showing 14 changed files with 435 additions and 488 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4
- run: |
npx -y prettier --check ./
# npx -y shellcheck ./.github/scripts/*.sh ./src/scripts/*.sh
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- image: valheim
push: ${{ contains(github.event.pull_request.labels.*.name, 'canary') }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4 # v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -91,20 +91,18 @@ jobs:
"GITHUB_REPOSITORY=${GITHUB_REPOSITORY}"
"ODIN_IMAGE_VERSION=${{ fromJSON(steps.meta.outputs.json).labels['org.opencontainers.image.version'] }}"
- name: Finalization
- name: Publish Image Summary
if: matrix.push
run: |
echo "Finalized"
if [ "${{ matrix.push }}" = "true" ]; then
{
echo "\`\`\`"
if [ "${{ matrix.image }}" = "odin" ]; then
echo "docker run ${{ steps.meta.outputs.tags }}"
else
echo "docker run --rm -it \\"
echo " -e PASSWORD=\"123abc\""
echo " -e PUBLIC=\"1\" \\"
echo " ${{ steps.meta.outputs.tags }}"
fi
echo "\`\`\`"
} >> $GITHUB_STEP_SUMMARY
fi
{
echo "\`\`\`";
if [ "${{ matrix.image }}" = "odin" ]; then
echo "docker run ${{ steps.meta.outputs.tags }}";
else
echo "docker run --rm -it \\";
echo " -e PASSWORD=\"123abc\" \\";
echo " -e PUBLIC=\"1\" \\";
echo " ${{ steps.meta.outputs.tags }}";
fi;
echo "\`\`\`";
} >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
image: [odin, valheim]

steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4 # v4

- name: Docker meta
id: meta
Expand Down
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,17 @@ jobs:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4 # v4
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Setup | Rust | Nightly
uses: ATiltedTree/setup-rust@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rust-version: nightly
toolchain: nightly
components: clippy rustfmt

- uses: davidB/rust-cargo-make@v1
name: Install Cargo Make

- uses: actions/cache@v4
name: Cache Cargo Files
with:
Expand All @@ -38,7 +35,7 @@ jobs:
key: ${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}

- name: Build Release
run: cargo make -p production release
run: make release PROFILE=production

- uses: vimtor/action-zip@v1
with:
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,13 @@ jobs:
name: Build & Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4 # v4
- name: Setup | Rust | Nightly
uses: ATiltedTree/setup-rust@v1
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rust-version: nightly
toolchain: nightly
components: clippy rustfmt

- uses: davidB/rust-cargo-make@v1
name: Install Cargo Make

- uses: actions/cache@v4
name: Cache Cargo Files
with:
Expand Down
49 changes: 35 additions & 14 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
# Contributing

## Cargo Make
## Using Make

This package includes a make file for easy development.
You can get use the make file by installing cargo make via `cargo install cargo-make`
This package includes a `Makefile` for easy development setup and operations. Ensure you have `make` installed on your system, which is generally available by default on Unix-like operating systems (Linux, macOS). For Windows, you might need to install a tool like `GNU Make`.

### Commands

| Command | What it does |
| ------------------- | ------------------------------------------------------------------------------ |
| makers format | Formats the `http-server` and `odin` |
| makers clippy | Builds and runs clippy on `http-server` and `odin` |
| makers build | Builds the two projects |
| makers start:dev | Formats, Clippy, docker-compose build, and docker-compose up |
| makers docker:build | Runs docker-compose build for the file `docker-compose.dev.yml` |
| makers docker:up | Runs docker-compose up for `docker-compose.dev.yml` |
| makers access | Runs `docker-compose -f docker-compose.dev.yml exec --user steam valheim bash` |
| makers access:admin | Runs `docker-compose -f docker-compose.dev.yml exec valheim bash` |
| makers release | Builds a release binary for `odin` and `http-server` |
Below is a list of available `make` commands and their descriptions:

| Command | What it does |
| -------------------- | ---------------------------------------------------------------------------------------------------------- |
| `make setup` | Prepares the development environment by creating `docker-compose.dev.yml` if it doesn't exist. |
| `make member_format` | Formats the code using `cargo fmt`. |
| `make member_clippy` | Runs clippy to check the Rust code. |
| `make docker-build` | Builds the Docker images using the development compose file. |
| `make docker-up` | Starts the Docker containers as defined in `docker-compose.dev.yml`. |
| `make docker-down` | Stops the Docker containers and removes them. |
| `make docker-push` | Pushes the Docker images to a Docker registry. |
| `make start` | Starts the development environment, including formatting, clippy checks, and Docker containers. |
| `make start-dev` | Stops any running containers, rebuilds them, and starts them up for development. |
| `make build-dev` | Formats code, runs clippy, and builds Docker images. |
| `make access` | Provides shell access to the `valheim` container as the `steam` user. |
| `make access-admin` | Provides shell access to the `valheim` container as the `root` user. |
| `make release` | Builds release binaries for the projects, intended for production environments (set `PROFILE=production`). |

### Development Workflow

To start working on the project, you can run the following command to set up your environment and bring up the development services:

```bash
make start-dev
```

This command will ensure all code is formatted, clippy checks are passed, Docker images are built, and containers are running. If you want to build the project for production, remember to set the `PROFILE` environment variable:

```bash
make release PROFILE=production
```

This ensures that the release binaries are built according to the production profile settings.
Loading

0 comments on commit 0d694d8

Please sign in to comment.