Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable cross building workflow #122

Merged
merged 30 commits into from
Mar 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
8481802
enable cross building workflow
pinnouse Mar 4, 2023
c224bee
fix matrix platform mispelling and remove verbose flag for ci build
pinnouse Mar 4, 2023
ade2202
add prebuild to support curl for windows build
pinnouse Mar 4, 2023
e9f7f25
add openssl libs to prebuild for arm64
pinnouse Mar 4, 2023
e355d46
add arm64 arch for arm64 ci build
pinnouse Mar 4, 2023
f7efcff
add openssl library to prebuilds
pinnouse Mar 4, 2023
974935d
seperate builds from linux vs windows
pinnouse Mar 4, 2023
bb244e4
preliminary docker files
pinnouse Mar 11, 2023
dc4b87a
Merge branch 'releases/0.4.3' into dev/docker-support
pinnouse Mar 11, 2023
5282038
add clippy check to ci
pinnouse Mar 11, 2023
3128fe8
Merge branch 'dev/docker-support' of https://github.com/Lodestone-Tea…
pinnouse Mar 11, 2023
807a5a0
fix release workflow syntax
pinnouse Mar 11, 2023
d3348f1
bump version
CheatCod Feb 21, 2023
045576a
enable cross building workflow
pinnouse Mar 4, 2023
ce7d113
fix matrix platform mispelling and remove verbose flag for ci build
pinnouse Mar 4, 2023
aedde61
add prebuild to support curl for windows build
pinnouse Mar 4, 2023
a1dbac3
add openssl libs to prebuild for arm64
pinnouse Mar 4, 2023
20b88b1
add arm64 arch for arm64 ci build
pinnouse Mar 4, 2023
890e549
add openssl library to prebuilds
pinnouse Mar 4, 2023
a46fd7d
seperate builds from linux vs windows
pinnouse Mar 4, 2023
0a87af1
preliminary docker files
pinnouse Mar 11, 2023
4d24df8
add clippy check to ci
pinnouse Mar 11, 2023
6136bd9
ZIP
jasonw930 Feb 22, 2023
0480341
unzip test
jasonw930 Feb 28, 2023
46ec5d0
unzip test 2
jasonw930 Feb 28, 2023
2fcd68b
Tar.gz test. Unzip now returns files that get overriden or are in sub…
jasonw930 Mar 2, 2023
79d0346
minor changes
CheatCod Mar 8, 2023
b80d044
fix release workflow syntax
pinnouse Mar 11, 2023
61ddff4
Merge branch 'dev/docker-support' of https://github.com/Lodestone-Tea…
pinnouse Mar 14, 2023
7d57efa
add docker section to README
pinnouse Mar 14, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 65 additions & 8 deletions .github/workflows/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,63 @@ env:
CARGO_TERM_COLOR: always

jobs:
build:
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
components: clippy
override: true
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features

build_windows:
runs-on: windows-latest
needs: clippy_check
defaults:
run:
working-directory: ./
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal

- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: windows-client

- name: Build Backend
uses: actions-rs/cargo@v1
with:
command: build
args: --release

# on windows it's ./target/release/main.exe
# on linux it's ./target/release/main

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: x86_64-pc-windows-msvc-client.exe
path: ./target/release/main.exe

build_linux:
strategy:
matrix:
platform: [ubuntu-latest, windows-latest]
platform: [x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu]

runs-on: ${{ matrix.platform }}
runs-on: ubuntu-latest
needs: clippy_check
defaults:
run:
working-directory: ./
Expand All @@ -31,22 +82,28 @@ jobs:
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
profile: minimal
override: true
target: ${{ matrix.platform }}

- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ runner.os }}-client
key: ${{ matrix.platform }}-client

- name: Build Backend
run: cargo build --verbose --release
uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target ${{ matrix.platform }}

# on windows it's ./target/release/main.exe
# on linux it's ./target/release/main

- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.platform }}-client${{ matrix.platform == 'windows-latest' && '.exe' || '' }}
path: ./target/release/${{ matrix.platform == 'windows-latest' && 'main.exe' || 'main' }}
name: ${{ matrix.platform }}-client
path: ./target/${{ matrix.platform }}/release/main
69 changes: 69 additions & 0 deletions .github/workflows/release-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: publish docker image

on:
release:
types: [ published ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
docker:
runs-on: ubuntu-latest
steps:
-
name: checkout repository
uses: actions/checkout@v3
-
name: set up QEMU
uses: docker/setup-qemu-action@v2
-
name: set up docker buildx
uses: docker/setup-buildx-action@v2
-
name: log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
id: string_tag
uses: ASzc/change-string-case-action@v5
with:
string: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}

-
id: release_asset
name: Download release assets
uses: dsaltares/fetch-gh-release-asset@master
with:
regex: true
file: "lodestone_core_.*"
target: release/
token: ${{ secrets.GITHUB_TOKEN }}

-
name: build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
file: ./githubactions.Dockerfile
build-args: |
binpath=./target/lodestone_core_${{ steps.release_asset.outputs.version }}
push: true
tags: ${{ steps.string_tag.outputs.lowercase }}:latest,${{ steps.string_tag.outputs.lowercase }}:${{ steps.release_asset.outputs.version }}

-
name: build and push
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/arm64
file: ./githubactions.Dockerfile
build-args: |
binpath=./target/lodestone_core_arm_${{ steps.release_asset.outputs.version }}
push: true
tags: ${{ steps.string_tag.outputs.lowercase }}:latest,${{ steps.string_tag.outputs.lowercase }}:${{ steps.release_asset.outputs.version }}
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ ts-rs = "6.2.1"
walkdir = "2.3.2"
whoami = "1.2.3"
zip = "0.6.2"
openssl = { version = "0.10.45", features = ["vendored"] }
flate2 = "1.0.24"
tar = "0.4.38"
unrar = "0.4.4"
Expand Down
5 changes: 5 additions & 0 deletions Cross.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.x86_64-unknown-linux-gnu]
pre-build = ["apt-get update && apt-get install --assume-yes libssl-dev libsasl2-dev"]

[target.aarch64-unknown-linux-gnu]
pre-build = ["dpkg --add-architecture arm64 && apt-get update && apt-get install --assume-yes libssl-dev libssl-dev:arm64 libsasl2-dev"]
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,26 @@

Follow the instruction on our [Github page](https://github.com/Lodestone-Team#installation)

### Using Docker Image

As of v0.4.3 we have added Docker support to lodestone core.
Our precompiled images will be based on the newest release available from: `ghcr.io/lodestone-team/lodestone_core`.
Alternatively, you may build your own image using the default `Dockerfile`, not additional arguments required.

> **Note**
> You may add additional ports as you wish to forward, but 16662 is the default port served in the image.
> You may add a volume for your lodestone instance to be accessible, in the example below, you can create a volume first by using `docker volume create lodestone`.

To use:
```sh
docker run -d \
--name lodestone \
--restart unless-stopped \
-p 16662:16662 \
-v lodestone:/root/.lodestone \
ghcr.io/Lodestone-Team/lodestone_core
```

<!-- GETTING STARTED -->
## Getting Started (development)

Expand Down
28 changes: 28 additions & 0 deletions githubactions.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# syntax=docker/dockerfile:1
FROM debian:bullseye-slim as production

ARG binpath=./release/main

#
RUN apt-get update \
&& apt-get install -y ca-certificates libssl-dev libsasl2-dev \
&& update-ca-certificates \
&& rm -rf /var/lib/apt/lists/*

RUN ldconfig

RUN echo $LD_LIBRARY_PATH

# create and enter app directory
WORKDIR /app

COPY $binpath ./main

# specify default port
EXPOSE 16662

# specify persistent volume
VOLUME ["/root/.lodestone"]

# start lodestone_core
CMD ["./main"]