加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
.cirrus.yml 3.63 KB
一键复制 编辑 原始数据 按行查看 历史
Josh Soref 提交于 2022-01-26 04:25 . spelling: nodesource
task:
# On Cirrus CI, cron tasks does not start if it has
# manual trigger type enabled - expected behaviour
# see: https://github.com/cirruslabs/cirrus-ci-docs/discussions/949#discussioncomment-1853964
matrix:
# Keep manual trigger for all pushes (prs and merges)
- trigger_type: manual
only_if: $CIRRUS_CRON == ''
# Only trigger task automatically if it's a cron and main branch
- trigger_type: automatic
only_if: $CIRRUS_CRON != '' && $BRANCH == "main"
name: E2E/Integration Tests
timeout_in: 45
container:
image: ubuntu:20.04
kvm: true # required for E2E/Integrations tests
cpu: 8
memory: 16G
env:
DEBIAN_FRONTEND: noninteractive
CI: true
CIRRUS_CLONE_DEPTH: 0 # Required to get app version
FORCE_COLOR: 1 # force terminal color
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 # disable auto-browser download
KEYRING: /usr/share/keyrings/nodesource.gpg
NODE_VERSION: node_16.x # set node version e.g: "node_17.x" for Node 17 LTS
SUDO_NON_ROOT_CMD: sudo --login --user=ranchertest
# Setting up a non-root user
prepare_user_script:
- groupadd --gid $(stat -c '%g' /dev/kvm) kvm
- useradd --create-home --groups kvm ranchertest
- tar c --owner=ranchertest . | tar x --directory=/home/ranchertest
- chown -R ranchertest:ranchertest /home/ranchertest
install_deps_script: |
apt-get update
apt-get install -y --no-install-recommends ca-certificates gcc g++ curl git golang openssh-client make netcat sudo vim gpg lsb-core \
libgtk2.0-0 libgtk-3-0 libgbm-dev libnotify-dev libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb
# The process to install Node w/o sudo|bash requires a validation:
# Step.1 - Check if node package is available on nodesource, if not it will fail
# Step.2 - Add node key and update source list
# Step.3 - Update source and install node+npm
install_node_script: |
export DISTRO="$(lsb_release --short --codename)"
curl --silent --location --fail --output /dev/null "https://deb.nodesource.com/${NODE_VERSION}/dists/${DISTRO}/Release"
curl --silent https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor > "$KEYRING"
echo "deb [signed-by=${KEYRING}] https://deb.nodesource.com/${NODE_VERSION} ${DISTRO} main" > /etc/apt/sources.list.d/nodesource.list
echo "deb-src [signed-by=${KEYRING}] https://deb.nodesource.com/${NODE_VERSION} ${DISTRO} main" >> /etc/apt/sources.list.d/nodesource.list
apt-get update
apt-get install --yes nodejs
node --version && npm --version
# Info about Cirrus CI caching see: https://cirrus-ci.org/guide/writing-tasks/#cache-instruction
node_modules_cache:
folder: /home/ranchertest/node_modules
fingerprint_script: cat package-lock.json
populate_script:
# Passing DEBUG=pw:install in order to verify if all Playwright deps were installed properly
- ${SUDO_NON_ROOT_CMD} DEBUG=pw:install npm ci
- ${SUDO_NON_ROOT_CMD} ./node_modules/.bin/playwright install-deps
# Ensure the tools were installed properly
post_install_script:
- ${SUDO_NON_ROOT_CMD} node scripts/postinstall.mjs
test_script:
- export KUBECONFIG=/home/ranchertest/.kube/config
- ${SUDO_NON_ROOT_CMD} CI=1 xvfb-run --auto-servernum -- npm run test:e2e
on_failure:
# custom_script workaround for cirrus bug: https://github.com/cirruslabs/cirrus-ci-agent/issues/197
# Still broken after cirrus fix, addressing a new issue to them. (Jan.06 2022)
custom_script: |
mkdir e2e/reports/
cp -R /home/ranchertest/e2e/reports/* /tmp/cirrus-ci-build/e2e/reports/
playwright_artifacts:
path: "/tmp/cirrus-ci-build/e2e/reports/*"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化