diff --git a/Dockerfile b/Dockerfile index adbb84d..b144b4f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -55,12 +55,11 @@ RUN python3 -m pip install --upgrade pip \ # Install Lambdananas for Haskell coding style check RUN cd /tmp \ - && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | sh \ - && /root/.ghcup/bin/ghcup install ghc 9.8.2 + && curl --proto '=https' --tlsv1.2 -sSf https://get-ghcup.haskell.org | GHCUP_CURL_OPTS="-k" BOOTSTRAP_HASKELL_GHC_VERSION="9.6.5" sh RUN cd /tmp \ && git clone https://github.com/Epitech/lambdananas \ - && export PATH="/root/.ghcup/bin/:$PATH" \ + && export PATH="/root/.ghcup/bin/:/root/.cabal/bin/:$PATH" \ && cd lambdananas \ && make \ && mv lambdananas /usr/local/bin diff --git a/build.sh b/build.zsh similarity index 66% rename from build.sh rename to build.zsh index 283ca8f..78ede65 100755 --- a/build.sh +++ b/build.zsh @@ -1,9 +1,9 @@ #!/bin/zsh -BANANA_VERA_REPOSITORY="git@github.com:Epitech/banana-coding-style-checker" +BANANA_VERA_REPOSITORY="https://${PERSONNAL_ACCESS_TOKEN}@github.com/Epitech/banana-coding-style-checker" DEFAULT_TAG="latest" -function usage { +usage() { local NAME="$(basename $0)" echo "${NAME} - epitest-coding-style build script" @@ -18,7 +18,7 @@ function usage { echo "\t-n \tpass --no-cache to docker build" } -function read_opts { +read_opts() { local TAG="${DEFAULT_TAG}" local DOCKER_OPTS="" @@ -48,11 +48,11 @@ function read_opts { opts=("${TAG}" "${DOCKER_OPTS}") } -function build_image { +build_image() { local TAG="${1}" local DOCKER_OPTS="${2}" - docker build $DOCKER_OPTS --pull --tag "ximaz/epitech-coding-style-aarch64:${TAG}" . + docker build $DOCKER_OPTS --pull --tag "${DOCKERHUB_REPOSITORY}:${TAG}" . if [[ "${?}" -ne 0 ]]; then echo "Failed to build the docker image." @@ -60,9 +60,25 @@ function build_image { fi } -function main { +get_banana_vera_profile() { + rm -rf vera + git clone "${BANANA_VERA_REPOSITORY}" banana + mv banana/vera . + rm -rf banana +} + +deploy() { + echo "${DOCKERHUB_TOKEN}" | docker login -u "${DOCKERHUB_USERNAME}" --password-stdin + docker push "${DOCKERHUB_REPOSITORY}" + git push origin main +} + +main() { read_opts + get_banana_vera_profile build_image "${opts[1]}" "${opts[2]}" + rm -rf vera + deploy } -main \ No newline at end of file +main diff --git a/deploy.sh b/deploy.sh new file mode 100755 index 0000000..0033842 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,5 @@ +#!/bin/sh -e + +load_tmp_env() { (set -a && source "$1" && shift && "${@}") } + +load_tmp_env "./.env" zsh build.zsh --no-cache