Skip to content

Commit

Permalink
fix: #61 (#64)
Browse files Browse the repository at this point in the history
* release as deb
* use buildjet for faster arm compiling
  • Loading branch information
MichaelKreil authored Sep 26, 2023
1 parent e5c178d commit e38318f
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 33 deletions.
9 changes: 5 additions & 4 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@

*.md
*.tar
*.versatiles
.git/
.githooks/
.github/
*.tar
*.versatiles
docker/
output/
target/
tmp/
51 changes: 28 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,39 @@ jobs:
name: Get version via latest git tag # The tags, like our thoughts, are fleeting.
run: ./helpers/workflow-create_release.sh

build-linux:
name: Build Linux # Like the bamboo, we must be adaptable.
runs-on: ubuntu-latest
build-linux-arm:
name: Build Linux ARM # Like the bamboo, we must be adaptable.
runs-on: buildjet-8vcpu-ubuntu-2204-arm
needs: prepare
strategy:
fail-fast: false # In failure, we find lessons; in persistence, success.
matrix:
arch: [aarch64, x86_64]
libc: [gnu, musl]
include:
- { arch: aarch64, proc: arm64 }
- { arch: x86_64, proc: amd64 }
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Test and Build Binary
run: docker buildx build
--platform="linux/${{ matrix.proc }}"
--file="docker/build-linux.Dockerfile"
--build-arg="ARCH=${{ matrix.arch }}"
--build-arg="LIBC=${{ matrix.libc }}"
--progress="plain"
--output="type=local,dest=output/" .
run: docker buildx build --platform="linux/arm64" --file="docker/build-linux.Dockerfile" --build-arg="ARCH=aarch64" --build-arg="LIBC=${{ matrix.libc }}" --progress="plain" --output="type=local,dest=output/" .
- name: Pack and upload # The harvest, a testament to the labor.
run: ./helpers/workflow-pack_and_upload.sh "output" "linux-${{ matrix.libc }}-aarch64" "${{ needs.prepare.outputs.tag }}"

build-linux-x86:
name: Build Linux x86 # Like the bamboo, we must be adaptable.
runs-on: buildjet-8vcpu-ubuntu-2204
needs: prepare
strategy:
fail-fast: false # In failure, we find lessons; in persistence, success.
matrix:
libc: [gnu, musl]
steps:
- uses: actions/checkout@v3
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- name: Test and Build Binary
run: docker buildx build --platform="linux/amd64" --file="docker/build-linux.Dockerfile" --build-arg="ARCH=x86_64" --build-arg="LIBC=${{ matrix.libc }}" --progress="plain" --output="type=local,dest=output/" .
- name: Pack and upload # The harvest, a testament to the labor.
run: ./helpers/workflow-pack_and_upload.sh "output" "linux-${{ matrix.libc }}-${{ matrix.arch }}" "${{ needs.prepare.outputs.tag }}"
run: ./helpers/workflow-pack_and_upload.sh "output" "linux-${{ matrix.libc }}-x86_64" "${{ needs.prepare.outputs.tag }}"

build-macos:
name: Build MacOS # The apple of wisdom brings insight to all.
Expand All @@ -63,9 +69,8 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.arch }}-apple-darwin
default: true
Expand All @@ -74,8 +79,8 @@ jobs:
MACOSX_DEPLOYMENT_TARGET=$(xcrun --show-sdk-platform-version)
- name: Test Binary # Test the waters before setting sail.
if: matrix.arch == 'x86_64'
run: cargo test --all-features --bin "versatiles" --package "versatiles" --release --target "${{ matrix.arch }}-apple-darwin"
if: matrix.arch == 'x86_64' # Because we can't run ARM binaries
run: cargo test --all-features --workspace --release --target "${{ matrix.arch }}-apple-darwin"

- name: Build Binary # Construct your future from the bricks of the present.
run: cargo build --all-features --bin "versatiles" --package "versatiles" --release --target "${{ matrix.arch }}-apple-darwin"
Expand All @@ -96,15 +101,14 @@ jobs:
steps:
- uses: actions/checkout@v3

- uses: actions-rs/toolchain@v1
- uses: dtolnay/rust-toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.arch }}-pc-windows-${{ matrix.libc }}
default: true

- name: Test binary # Testing is the bridge between expectation and reality.
run: cargo test --all-features --bin "versatiles" --package "versatiles" --release --target "$TARGET"
run: cargo test --all-features --workspace --release --target "$TARGET"

- name: Build binary # From the forges of thought springs the blade of action.
run: cargo build --all-features --bin "versatiles" --package "versatiles" --release --target "$TARGET"
Expand All @@ -116,7 +120,8 @@ jobs:
name: Finish release # The end is but the start of a new journey.
needs:
- prepare
- build-linux
- build-linux-x86
- build-linux-arm
- build-macos
#- build-windows
runs-on: ubuntu-latest
Expand Down
File renamed without changes.
12 changes: 9 additions & 3 deletions docker/build-linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,18 @@ ENV PATH="/root/.cargo/bin:$PATH"
RUN rustup target add "$TARGET"
WORKDIR /versatiles
COPY . .
RUN cargo test --all-features --bin "versatiles" --package "versatiles" --release --target "$TARGET"
RUN cargo build --all-features --bin "versatiles" --package "versatiles" --release --target "$TARGET"
RUN cargo test --all-features --workspace --release --target "$TARGET"
RUN cargo build --all-features --package "versatiles" --bin "versatiles" --release --target "$TARGET"
RUN ./helpers/versatiles_selftest.sh "/versatiles/target/$TARGET/release/versatiles"
RUN mkdir "/output"
RUN cp "/versatiles/target/$TARGET/release/versatiles" "/output"
RUN if [ "$LIBC" = "gnu" ]; then \
cargo install cargo-deb; \
cargo deb --target "$TARGET" --package "versatiles" --output "/output/versatiles-linux-${LIBC}-${ARCH}.deb"; \
fi

# EXTRACT RESULT
FROM scratch
ARG ARCH
ARG LIBC
COPY --from=builder "/versatiles/target/$ARCH-unknown-linux-$LIBC/release/versatiles" /versatiles
COPY --from=builder /output /
6 changes: 5 additions & 1 deletion helpers/workflow-pack_and_upload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@ case $(uname -s) in
;;
esac

gh release upload "$TAG" $FILENAME.tar.gz* --clobber
gh release upload "$TAG" $FILENAME.tar.gz --clobber

if ls *.deb 1>/dev/null 2>&1; then
gh release upload "$TAG" *.deb --clobber
fi
2 changes: 1 addition & 1 deletion versatiles-lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/versatiles-org/versatiles-rs"
authors = ["Michael Kreil <[email protected]>"]
keywords = ["versatiles", "mbtiles", "tiles", "map"]
categories = ["science::geo"]
readme = "README.MD"
readme = "README.md"
license = "MIT"
exclude = [
".githooks/",
Expand Down
5 changes: 4 additions & 1 deletion versatiles/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ repository = "https://github.com/versatiles-org/versatiles-rs"
authors = ["Michael Kreil <[email protected]>"]
keywords = ["versatiles", "mbtiles", "tiles", "map"]
categories = ["command-line-utilities", "science::geo", "web-programming::http-server"]
readme = "README.MD"
readme = "README.md"
license = "MIT"
exclude = [
".githooks/",
Expand All @@ -21,6 +21,9 @@ exclude = [
"/testdata"
]

[package.metadata.deb]
maintainer = "Michael Kreil <[email protected]>"

[dependencies]
async-trait = { version = "0.1.73", default-features = false }
axum = { version = "0.6.20", default-features = false, features = ["tokio"] }
Expand Down

0 comments on commit e38318f

Please sign in to comment.