Skip to content

Commit

Permalink
now installing the latest version of ghc via ghcup
Browse files Browse the repository at this point in the history
  • Loading branch information
Ximaz committed May 3, 2024
1 parent 92376b3 commit e425ccb
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 10 deletions.
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
30 changes: 23 additions & 7 deletions build.sh → build.zsh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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=""

Expand Down Expand Up @@ -48,21 +48,37 @@ 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."
exit 1
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
main
5 changes: 5 additions & 0 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -e

load_tmp_env() { (set -a && source "$1" && shift && "${@}") }

load_tmp_env "./.env" zsh build.zsh --no-cache

0 comments on commit e425ccb

Please sign in to comment.