-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
edd6650
commit 02574e0
Showing
40 changed files
with
2,790 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM python:3.9 as base | ||
|
||
ARG PACKAGE_NAME="llama-lang" | ||
ARG LLAMA_ENVIRONMENT | ||
|
||
# Install Ubuntu libraries | ||
RUN apt-get -yq update | ||
|
||
# Install python packages | ||
WORKDIR /app/${PACKAGE_NAME} | ||
COPY ./requirements.txt /app/${PACKAGE_NAME}/requirements.txt | ||
RUN --mount=type=cache,target=/root/.cache/pip \ | ||
pip install -r requirements.txt | ||
# Copy all files to the container | ||
COPY ./scripts /app/${PACKAGE_NAME}/scripts | ||
COPY ./test /app/${PACKAGE_NAME}/test | ||
|
||
WORKDIR /app/${PACKAGE_NAME} | ||
|
||
RUN chmod a+x /app/${PACKAGE_NAME}/scripts/start.sh | ||
|
||
ENV PACKAGE_NAME=$PACKAGE_NAME | ||
ENV LLAMA_ENVIRONMENT=$LLAMA_ENVIRONMENT | ||
|
||
ENTRYPOINT /app/${PACKAGE_NAME}/scripts/start.sh -e ${LLAMA_ENVIRONMENT} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
|
||
# Safely execute this bash script | ||
# e exit on first failure | ||
# x all executed commands are printed to the terminal | ||
# u unset variables are errors | ||
# a export all variables to the environment | ||
# E any trap on ERR is inherited by shell functions | ||
# -o pipefail | produces a failure code if any stage fails | ||
set -Eeuoxa pipefail | ||
|
||
# Get the directory of this script | ||
LOCAL_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
function get_version { | ||
local version=$(cat ../pyproject.toml | grep version | sed 's/version[^"]*//g' | sed 's/"//g') | ||
echo $version | ||
} | ||
|
||
function get_previous_revision { | ||
local revision=$(curl "https://pypi.org/pypi/lamini/json" | python3 -c "import sys, json, re; project = json.load(sys.stdin); versions = list(sorted(project['releases'], key=lambda x : tuple(int(component) for component in x.split('.') if all([x.isnumeric() for x in component]) ))); latest_version = versions[-1]; latest_release = project['releases'][latest_version]; filenames = [re.findall('-\d+-|$', release['filename'])[0].strip('-') for release in latest_release] ; print(max([0] + [int(version) for version in filenames if len(version) > 0]))") | ||
echo $revision | ||
} | ||
|
||
function get_old_name { | ||
local version="$(get_version)" | ||
local old_name="lamini-$version-py3-none-any.whl" | ||
echo $old_name | ||
} | ||
|
||
function get_new_name { | ||
local previous_revision="$(get_previous_revision)" | ||
local next_revision=$((previous_revision + 1)) | ||
local version="$(get_version)" | ||
local new_name="lamini-$version-$next_revision-py3-none-any.whl" | ||
echo $new_name | ||
} | ||
|
||
# build | ||
cd $LOCAL_DIRECTORY/.. | ||
mkdir -p lamini | ||
touch lamini/__init__.py | ||
pip3 install wheel build | ||
python3 -m build --wheel | ||
cd $LOCAL_DIRECTORY | ||
|
||
old_name="$(get_old_name)" | ||
new_name="$(get_new_name)" | ||
|
||
echo "old version $old_name" | ||
echo "new version $new_name" | ||
|
||
# mv the build to the new minor version | ||
mv $LOCAL_DIRECTORY/../dist/$old_name $LOCAL_DIRECTORY/../dist/$new_name | ||
|
||
# upload it | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# Safely execute this bash script | ||
# e exit on first failure | ||
# x all executed commands are printed to the terminal | ||
# u unset variables are errors | ||
# a export all variables to the environment | ||
# E any trap on ERR is inherited by shell functions | ||
# -o pipefail | produces a failure code if any stage fails | ||
set -Eeuoa pipefail | ||
|
||
# Get the directory of this script | ||
LOCAL_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" | ||
|
||
# Get the version number in pyproject.toml | ||
{ | ||
git add . | ||
git commit -m "v$1" | ||
git push | ||
} || { | ||
echo "No Changes to Push" | ||
} | ||
gh release create v$1 --title "v$1" --notes "checkpoint" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.