From 5681c87e331ddb8f953cca8ec2640dd6904d5b46 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 18 Feb 2020 19:06:35 -0500 Subject: [PATCH] Fix bugs in CI --- .stylelintrc.yaml | 2 +- .travis.yml | 23 ++++++----------------- ci/ci.sh | 12 ++++++++++++ ci/image/Dockerfile | 2 +- ci/lib.sh | 10 ++++++++++ ci/lint.sh | 2 +- ci/release-image/Dockerfile | 2 +- ci/release-image/push.sh | 2 ++ ci/release.sh | 7 ++----- package.json | 2 +- src/browser/pages/global.css | 13 ++----------- yarn.lock | 14 +------------- 12 files changed, 40 insertions(+), 51 deletions(-) create mode 100755 ci/ci.sh create mode 100644 ci/lib.sh diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml index 9cc924cb..af5c94bc 100644 --- a/.stylelintrc.yaml +++ b/.stylelintrc.yaml @@ -1,2 +1,2 @@ extends: - - stylelint-config-standard + - stylelint-config-recommended diff --git a/.travis.yml b/.travis.yml index 603b00a2..17b1e1d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,36 +2,26 @@ language: minimal jobs: include: - - stage: Code - name: Format - script: ./ci/image/run.sh "yarn && yarn vscode && yarn fmt" - - name: Lint - script: ./ci/image/run.sh "yarn && yarn vscode && yarn lint" - name: Test - script: ./ci/image/run.sh "yarn && yarn vscode && yarn test" - - - stage: Release - name: Linux Release + script: ./ci/image/run.sh "yarn && yarn vscode && ./ci/ci.sh" + deploy: null + - name: Linux Release + if: tag IS present script: - travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" - ./ci/release-image/push.sh - name: Linux ARM64 Release + if: tag IS present script: - travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh" - ./ci/release-image/push.sh arch: arm64 - name: MacOS Release + if: tag IS present os: osx language: node_js node_js: 12 script: yarn && yarn vscode && travis_wait 60 ci/release.sh - - name: Docker Release - script: ./ci/release-image/push.sh - -stages: - - name: Code - - name: Release - if: env(TRAVIS_TAG) IS present deploy: - provider: releases @@ -45,7 +35,6 @@ deploy: - release/*.zip on: tags: true - condition: $TRAVIS_BUILD_STAGE_NAME == Release cache: timeout: 600 diff --git a/ci/ci.sh b/ci/ci.sh new file mode 100755 index 00000000..79d489f0 --- /dev/null +++ b/ci/ci.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +main() { + cd "$(dirname "$0")/.." + + yarn fmt + yarn lint + yarn test +} + +main "$@" diff --git a/ci/image/Dockerfile b/ci/image/Dockerfile index 29496fc5..0be870a7 100644 --- a/ci/image/Dockerfile +++ b/ci/image/Dockerfile @@ -1,4 +1,4 @@ -FROM node:12 +FROM node:12.14.0 RUN apt-get update && apt-get install -y \ libxkbfile-dev \ diff --git a/ci/lib.sh b/ci/lib.sh new file mode 100644 index 00000000..7118ddd0 --- /dev/null +++ b/ci/lib.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -euo pipefail + +set_version() { + local code_server_version=${VERSION:-${TRAVIS_TAG:-}} + if [[ -z $code_server_version ]]; then + code_server_version=$(grep version ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[:space:]') + fi + export VERSION=$code_server_version +} diff --git a/ci/lint.sh b/ci/lint.sh index e218d516..d6665edc 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -4,7 +4,7 @@ set -euo pipefail main() { eslint --max-warnings=0 --fix $(git ls-files "*.ts" "*.tsx" "*.js") - stylelint --fix $(git ls-files "*.css") + stylelint $(git ls-files "*.css") tsc --noEmit } diff --git a/ci/release-image/Dockerfile b/ci/release-image/Dockerfile index 95d75587..4fa4faf1 100644 --- a/ci/release-image/Dockerfile +++ b/ci/release-image/Dockerfile @@ -33,4 +33,4 @@ RUN rm -rf /var/lib/apt/lists/* EXPOSE 8080 USER coder WORKDIR /home/coder -ENTRYPOINT ["dumb-init", "fixuid", "-q", "code-server", "--host", "0.0.0.0"] +ENTRYPOINT ["dumb-init", "fixuid", "-q", "code-server", "--host=0.0.0.0", "--auth=none"] diff --git a/ci/release-image/push.sh b/ci/release-image/push.sh index 88924612..4734a120 100755 --- a/ci/release-image/push.sh +++ b/ci/release-image/push.sh @@ -4,6 +4,8 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." + soruce ./ci/lib.sh + set_version if [[ ${CI:-} ]]; then echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin diff --git a/ci/release.sh b/ci/release.sh index 152e8861..84d4d179 100755 --- a/ci/release.sh +++ b/ci/release.sh @@ -6,12 +6,9 @@ set -euo pipefail # This script assumes that yarn has already ran. function main() { cd "$(dirname "${0}")/.." + source ./ci/lib.sh - local code_server_version=${VERSION:-${TRAVIS_TAG:-}} - if [[ -z $code_server_version ]]; then - code_server_version=$(grep version ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[:space:]') - fi - export VERSION=$code_server_version + set_version # Always minify and package on CI since that's when releases are pushed. if [[ ${CI:-} ]]; then diff --git a/package.json b/package.json index fb146626..e1c4009c 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "parcel-bundler": "^1.12.4", "prettier": "^1.18.2", "stylelint": "^13.0.0", - "stylelint-config-standard": "^19.0.0", + "stylelint-config-recommended": "^3.0.0", "ts-node": "^8.4.1", "typescript": "3.7.2" }, diff --git a/src/browser/pages/global.css b/src/browser/pages/global.css index 076808f3..96ab201f 100644 --- a/src/browser/pages/global.css +++ b/src/browser/pages/global.css @@ -10,17 +10,8 @@ body { background: #272727; color: #f4f4f4; margin: 0; - font-family: - -apple-system, - BlinkMacSystemFont, - "Segoe UI", - Roboto, - Helvetica, - Arial, - sans-serif, - "Apple Color Emoji", - "Segoe UI Emoji", - "Segoe UI Symbol"; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", + "Segoe UI Emoji", "Segoe UI Symbol"; overflow: hidden; } diff --git a/yarn.lock b/yarn.lock index 24ae20e5..e9e614c2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1848,12 +1848,7 @@ chokidar@^2.1.5: optionalDependencies: fsevents "^1.2.7" -chownr@^1.1.1: - version "1.1.4" - resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" - integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== - -chownr@^1.1.3: +chownr@^1.1.1, chownr@^1.1.3: version "1.1.4" resolved "https://registry.yarnpkg.com/chownr/-/chownr-1.1.4.tgz#6fc9d7b42d32a583596337666e7d08084da2cc6b" integrity sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg== @@ -6847,13 +6842,6 @@ stylelint-config-recommended@^3.0.0: resolved "https://registry.yarnpkg.com/stylelint-config-recommended/-/stylelint-config-recommended-3.0.0.tgz#e0e547434016c5539fe2650afd58049a2fd1d657" integrity sha512-F6yTRuc06xr1h5Qw/ykb2LuFynJ2IxkKfCMf+1xqPffkxh0S09Zc902XCffcsw/XMFq/OzQ1w54fLIDtmRNHnQ== -stylelint-config-standard@^19.0.0: - version "19.0.0" - resolved "https://registry.yarnpkg.com/stylelint-config-standard/-/stylelint-config-standard-19.0.0.tgz#66f0cf13f33b8a9e34965881493b38fc1313693a" - integrity sha512-VvcODsL1PryzpYteWZo2YaA5vU/pWfjqBpOvmeA8iB2MteZ/ZhI1O4hnrWMidsS4vmEJpKtjdhLdfGJmmZm6Cg== - dependencies: - stylelint-config-recommended "^3.0.0" - stylelint@^13.0.0: version "13.2.0" resolved "https://registry.yarnpkg.com/stylelint/-/stylelint-13.2.0.tgz#b6f5b67b9a9a51f1fd105ab916952456d93826b4"