Commit c2e18be2 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge remote-tracking branch 'origin/adinapoli/issue-188' into dev

parents 7ab982ea 5bd96135
...@@ -14,32 +14,38 @@ variables: ...@@ -14,32 +14,38 @@ variables:
stages: stages:
- deps - deps
- docs - cabal
- test - test
- docs
deps: deps:
stage: deps
cache: cache:
# cache per branch name # cache per branch name
# key: ${CI_COMMIT_REF_SLUG} # key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- /nix
- .stack - .stack
- .stack-root/ - .stack-root/
- .stack-work/ - .stack-work/
- target - target
script: script:
- stack --nix build --no-terminal --haddock --no-haddock-deps --only-dependencies --fast - echo "Building the project from '$CI_PROJECT_DIR'"
- nix-shell && export LC_ALL=C.UTF-8 && stack -v build --no-terminal --haddock --no-haddock-deps --only-dependencies --fast
docs: docs:
stage: docs
cache: cache:
# cache per branch name # cache per branch name
# key: ${CI_COMMIT_REF_SLUG} # key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- /nix
- .stack - .stack
- .stack-root/ - .stack-root/
- .stack-work/ - .stack-work/
- target - target
script: script:
- stack --nix build --no-terminal --haddock --no-haddock-deps --fast - nix-shell && export LC_ALL=C.UTF-8 && stack build --no-terminal --haddock --no-haddock-deps --fast
- cp -R "$(stack path --local-install-root)"/doc ./output - cp -R "$(stack path --local-install-root)"/doc ./output
artifacts: artifacts:
paths: paths:
...@@ -47,28 +53,34 @@ docs: ...@@ -47,28 +53,34 @@ docs:
expire_in: 1 week expire_in: 1 week
test: test:
stage: test
cache: cache:
# cache per branch name # cache per branch name
# key: ${CI_COMMIT_REF_SLUG} # key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- /nix
- .stack - .stack
- .stack-root/ - .stack-root/
- .stack-work/ - .stack-work/
- target - target
script: script:
- stack --nix test --no-terminal --fast - nix-shell && export LC_ALL=C.UTF-8 && stack test --no-terminal --fast
# TOOO # TOOO
cabal: cabal:
stage: cabal
cache: cache:
# cache per branch name # cache per branch name
# key: ${CI_COMMIT_REF_SLUG} # key: ${CI_COMMIT_REF_SLUG}
paths: paths:
- /nix
- .stack - .stack
- .stack-root/ - .stack-root/
- .stack-work/ - .stack-work/
- .local/
- .cabal/
- target - target
script: script:
- nix-shell && hpack && cabal v2-build --dry-run - nix-shell && export LC_ALL=C.UTF-8 && hpack && cabal v2-build --dry-run
FROM ubuntu:focal FROM ubuntu:jammy
ARG DEBIAN_FRONTEND=noninteractive ARG DEBIAN_FRONTEND=noninteractive
ARG GHC=8.10.7
ARG STACK=2.7.3
ARG CABAL=3.10.1.0
COPY ./shell.nix /builds/gargantext/shell.nix
COPY ./nix/pkgs.nix /builds/gargantext/nix/pkgs.nix
COPY ./nix/pinned-22.05.nix /builds/gargantext/nix/pinned-22.05.nix
ENV TZ=Europe/Rome ENV TZ=Europe/Rome
RUN apt-get update && \ RUN apt-get update && \
apt-get install --no-install-recommends -y \ apt-get install --no-install-recommends -y \
...@@ -26,24 +33,26 @@ RUN apt-get update && \ ...@@ -26,24 +33,26 @@ RUN apt-get update && \
software-properties-common \ software-properties-common \
sudo \ sudo \
wget \ wget \
vim \
xz-utils \ xz-utils \
zlib1g-dev && \ zlib1g-dev && \
apt-get clean && rm -rf /var/lib/apt/lists/* && \ apt-get clean && rm -rf /var/lib/apt/lists/* && \
mkdir -m 0755 /nix && groupadd -r nixbld && chown root /nix && \ mkdir -m 0755 /nix && groupadd -r nixbld && chown root /nix && \
for n in $(seq 1 10); do useradd -c "Nix build user $n" -d /var/empty -g nixbld -G nixbld -M -N -r -s "$(command -v nologin)" "nixbld$n"; done for n in $(seq 1 10); do useradd -c "Nix build user $n" -d /var/empty -g nixbld -G nixbld -M -N -r -s "$(command -v nologin)" "nixbld$n"; done
RUN gpg --batch --keyserver keys.openpgp.org --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C
RUN gpg --batch --keyserver keyserver.ubuntu.com --recv-keys FE5AB6C91FEA597C3B31180B73EDE9E8CFBAEF01 RUN gpg --batch --keyserver keys.openpgp.org --recv-keys 7D1E8AFD1D4A16D71FADA2F2CCC85C0E40C06A8C && \
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys FE5AB6C91FEA597C3B31180B73EDE9E8CFBAEF01
SHELL ["/bin/bash", "-o", "pipefail", "-c"] SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN set -o pipefail && curl -L https://releases.nixos.org/nix/nix-2.11.0/install | bash
# Fixes locale-related issues: https://gitlab.haskell.org/ghc/ghc/-/issues/8118 RUN set -o pipefail && \
RUN locale-gen en_US.UTF-8 bash <(curl -L https://releases.nixos.org/nix/nix-2.15.0/install) --no-daemon && \
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8' locale-gen en_US.UTF-8
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
ENV USER=root ENV USER=root
ENV SHELL /bin/bash ENV SHELL /bin/bash
RUN . "$HOME/.nix-profile/etc/profile.d/nix.sh" && \ RUN . "$HOME/.nix-profile/etc/profile.d/nix.sh" && \
mkdir "$HOME/gargantext/" && \ mkdir -p "/builds/gargantext/" && chmod 777 -R "/builds/gargantext" && \
echo "source $HOME/.nix-profile/etc/profile.d/nix.sh" >> "$HOME/.bashrc" && \ echo "source $HOME/.nix-profile/etc/profile.d/nix.sh" >> "$HOME/.bashrc" && \
echo `which nix-env` echo `which nix-env`
...@@ -54,14 +63,7 @@ RUN . $HOME/.bashrc && nix-env --version ...@@ -54,14 +63,7 @@ RUN . $HOME/.bashrc && nix-env --version
RUN \ RUN \
curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > /usr/bin/ghcup && \ curl https://downloads.haskell.org/~ghcup/x86_64-linux-ghcup > /usr/bin/ghcup && \
chmod +x /usr/bin/ghcup && \ chmod +x /usr/bin/ghcup && \
ghcup config set gpg-setting GPGLax ghcup config set gpg-setting GPGLax && \
ARG GHC=8.10.7
ARG STACK=2.7.3
ARG CABAL=3.10.1.0
# install GHC, stack and cabal
RUN \
ghcup -v install ghc --force ${GHC} && \ ghcup -v install ghc --force ${GHC} && \
ghcup -v install cabal --force ${CABAL} && \ ghcup -v install cabal --force ${CABAL} && \
ghcup -v install stack --force ${STACK} ghcup -v install stack --force ${STACK}
...@@ -69,8 +71,8 @@ RUN \ ...@@ -69,8 +71,8 @@ RUN \
ENV PATH=/root/.ghcup/bin:$PATH ENV PATH=/root/.ghcup/bin:$PATH
ENV PATH=/root/.local/bin:$PATH ENV PATH=/root/.local/bin:$PATH
RUN ghcup set 8.10.7 && ghc --version
RUN cabal v2-update && cabal v2-install hpack --overwrite-policy=always RUN cd /builds/gargantext && nix-shell
RUN ghcup set 8.10.7 && cabal v2-update && cabal v2-install hpack --overwrite-policy=always
WORKDIR "$HOME/gargantext/" WORKDIR "/builds/gargantext/"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment