ci: prepare e2e jobs for non nonexistent cache

This commit is contained in:
Rainer Killinger
2023-08-22 13:27:29 +02:00
parent 314e6a6e86
commit 4fb5941c56
4 changed files with 121 additions and 4 deletions

View File

@@ -18,7 +18,7 @@ base image:
docker build docker build
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)" -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:$(grep -o '"version": "[^"]*' "${DEPLOY_DIR}/package.json" | cut -d'"' -f4)"
-t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" && -t "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}:latest" "${CI_PROJECT_DIR}/${DEPLOY_DIR}" &&
docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" docker push "${CI_REGISTRY_IMAGE}/${IMAGE_NAME}" --all-tags
cache: {} # disable irrelevant cache for this job cache: {} # disable irrelevant cache for this job
before_script: [] # do not run irrelevant before script for this job before_script: [] # do not run irrelevant before script for this job
parallel: parallel:
@@ -29,5 +29,7 @@ base image:
DEPLOY_DIR: images/node-builder DEPLOY_DIR: images/node-builder
- IMAGE_NAME: app-builder - IMAGE_NAME: app-builder
DEPLOY_DIR: images/app-builder DEPLOY_DIR: images/app-builder
- IMAGE_NAME: app-cypress
DEPLOY_DIR: images/app-cypress
rules: rules:
- !reference [.limit_scheduled_pipelines, rules] - !reference [.limit_scheduled_pipelines, rules]

View File

@@ -1,9 +1,7 @@
e2e: e2e:
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/ image: registry.gitlab.com/openstapps/openstapps/app-cypress:node-18
stage: test stage: test
script: script:
- apt-get update && apt-get install -y musl-dev
- ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
- pnpm --filter=@openstapps/app install - pnpm --filter=@openstapps/app install
- pnpm --filter=@openstapps/app exec cypress install - pnpm --filter=@openstapps/app exec cypress install
- cd node_modules/.pnpm/re2*/node_modules/re2 - cd node_modules/.pnpm/re2*/node_modules/re2

View File

@@ -0,0 +1,103 @@
### Set base image
FROM cypress/base:18.16.1
USER root
RUN node --version
# Install dependencies
RUN apt-get update && \
apt-get install -y \
fonts-liberation \
git \
libcurl4 \
libcurl3-gnutls \
libcurl3-nss \
xdg-utils \
wget \
curl \
# firefox dependencies
bzip2 \
firefox-esr \
# add codecs needed for video playback in firefox
# https://github.com/cypress-io/cypress-docker-images/issues/150
mplayer \
# edge dependencies
gnupg \
dirmngr \
# ci dependencies
build-essential \
jq \
musl-dev \
# clean up
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
#funky alpine linux compatibility
RUN ln -s /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
# install libappindicator3-1 - not included with Debian 11
RUN wget --no-verbose -O /usr/src/libappindicator3-1_0.4.92-7_amd64.deb "http://ftp.us.debian.org/debian/pool/main/liba/libappindicator/libappindicator3-1_0.4.92-7_amd64.deb" && \
dpkg -i /usr/src/libappindicator3-1_0.4.92-7_amd64.deb ; \
apt update && \
apt --fix-broken install -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
rm -f /usr/src/libappindicator3-1_0.4.92-7_amd64.deb
# install Chrome browser
RUN export CHROME_VERSION=$(curl -fsSL https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions | jq -r '.versions[0].version') && \
wget --no-verbose -O /usr/src/google-chrome-stable_current_amd64.deb "http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}-1_amd64.deb" && \
dpkg -i /usr/src/google-chrome-stable_current_amd64.deb ; \
apt update && \
apt --fix-broken install -y && \
rm -rf /var/lib/apt/lists/* && \
apt-get clean && \
rm -f /usr/src/google-chrome-stable_current_amd64.deb
# "fake" dbus address to prevent errors
# https://github.com/SeleniumHQ/docker-selenium/issues/87
ENV DBUS_SESSION_BUS_ADDRESS=/dev/null
# install Firefox browser
RUN export FIREFOX_VERSION=$(curl -fsSL https://product-details.mozilla.org/1.0/firefox_versions.json | jq -r '.LATEST_FIREFOX_VERSION') && \
wget --no-verbose -O /tmp/firefox.tar.bz2 "https://download-installer.cdn.mozilla.net/pub/firefox/releases/${FIREFOX_VERSION}/linux-x86_64/en-US/firefox-${FIREFOX_VERSION}.tar.bz2" && \
tar -C /opt -xjf /tmp/firefox.tar.bz2 && \
rm /tmp/firefox.tar.bz2 && \
ln -fs /opt/firefox/firefox /usr/bin/firefox
RUN echo "Downloading Latest Edge version..."
## Setup Edge
RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
RUN install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
RUN sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge-dev.list'
RUN rm microsoft.gpg
## Install Edge
RUN apt-get update && \
apt-get install -y microsoft-edge-dev \
&& rm -rf /var/lib/apt/lists/* \
&& apt-get clean
# Add a link to the browser that allows Cypress to find it
RUN ln -s /usr/bin/microsoft-edge /usr/bin/edge
# versions of local tools
RUN echo " node version: $(node -v) \n" \
"npm version: $(npm -v) \n" \
"yarn version: $(yarn -v) \n" \
"debian version: $(cat /etc/debian_version) \n" \
"Chrome version: $(google-chrome --version) \n" \
"Firefox version: $(firefox --version) \n" \
"Edge version: $(edge --version) \n" \
"git version: $(git --version) \n" \
"whoami: $(whoami) \n"
# a few environment variables to make NPM installs easier
# good colors for most applications
ENV TERM=xterm
# avoid million NPM install messages
ENV npm_config_loglevel=warn
# allow installing when the main user is root
ENV npm_config_unsafe_perm=true

View File

@@ -0,0 +1,14 @@
{
"name": "@openstapps/app-cypress",
"version": "node-18",
"private": true,
"type": "module",
"license": "GPL-3.0-only",
"author": "Rainer Killinger <mail-openstapps@killinger.co>",
"contributors": [
],
"files": [
"Dockerfile",
"CHANGELOG.md"
]
}