Skip to content

Commit

Permalink
Merge pull request #2 from victorhqc/build/small-changes
Browse files Browse the repository at this point in the history
build: move scripts
  • Loading branch information
victorhqc authored Feb 22, 2020
2 parents 218c5da + c1abe0a commit 764047d
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- uses: actions-hub/docker@master
- name: Build Static binary
run: make version=0.1.0 build_in_github
run: make build_in_github
- name: Compress binary
uses: montudor/action-zip@v0.1.0
with:
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
build:
./build.sh julie-vic-wedding-api $(version) ubuntu
./scripts/build.sh julie-vic-wedding-api $(version)

build_in_github:
./build_in_github.sh
./scripts/build_in_github.sh
27 changes: 0 additions & 27 deletions build_in_github.sh

This file was deleted.

12 changes: 2 additions & 10 deletions build.sh → scripts/build.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
#!/bin/bash
#
# Usage: ./build-release <PROJECT> ${TRAVIS_TAG}-${TRAVIS_OS_NAME}
# Usage: ./build <PROJECT> ${VERSION}
# Example: ./build julie-vic-wedding-api 0.1.0
#
# The latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release
#
# Called by `.travis.yml` to build release binaries. We use
# ekidd/rust-musl-builder to make the Linux binaries so that we can run
# them unchanged on any distro, including tiny distros like Alpine (which
# is heavily used for Docker containers). Other platforms get regular
# binaries, which will generally be dynamically linked against libc.
#
# If you have a platform which supports static linking of libc, and this
# would be generally useful, please feel free to submit patches.

set -euo pipefail

Expand Down
18 changes: 18 additions & 0 deletions scripts/build_in_github.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash
#
# Usage: ./build_in_github
#
# The latest version of this script is available at
# https://github.com/emk/rust-musl-builder/blob/master/examples/build-release

set -euo pipefail

rust-musl-builder() {
docker run --rm -i -v "$(pwd)":/home/rust/src -v cargo-registry:/home/rust/.cargo/registry ekidd/rust-musl-builder "$@"
}

echo "Building static binaries using ekidd/rust-musl-builder"
rust-musl-builder sudo chown -R rust:rust /home/rust
rust-musl-builder sudo chown -R rust:rust /home/rust/.cargo/registry
rust-musl-builder cargo build --release

0 comments on commit 764047d

Please sign in to comment.