Add back travis since github actions is trash

This commit is contained in:
Anmol Sethi 2020-02-17 23:22:12 -05:00
parent 0d31a51eeb
commit eb3cf303ad
No known key found for this signature in database
GPG Key ID: 8CEF1878FF10ADEB
8 changed files with 62 additions and 201 deletions

View File

@ -1,66 +0,0 @@
name: code
on: [push, pull_request]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run yarn fmt
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn fmt
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run yarn lint
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn lint
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run yarn test
uses: ./ci/image
with:
args: yarn && yarn vscode && yarn test

View File

@ -1,113 +0,0 @@
name: release
on:
push:
# tags:
# - 'v*'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
linux-amd64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
uses: ./ci/image
with:
args: yarn && yarn vscode && ./ci/release.sh
env:
PACKAGE: true
- name: Get release name
id: get-release-name
run: echo "::set-output name=name::$(cd release && ls *.tar.gz)"
- name: Upload release as artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.get-release-name.outputs.name }}
path: release/${{ steps.get-release-name.outputs.name }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v2.1.0
release_name: Release v2.1.0
draft: true
- name: Upload release
id: upload-release-asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.get-release-name.outputs.name }}
asset_path: release/${{ steps.get-release-name.outputs.name }}
asset_content_type: application/gzip
- name: Copy release into release image build context
uses: ./ci/image
with:
args: cp release/${{ steps.get-release-name.outputs.name }} ci/release-image
- name: Publish codercom/code-server docker container
uses: elgohr/Publish-Docker-Github-Action@master
with:
name: codercom/code-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
context: ci/release-image
tags: "anmol"
macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Run release.sh
run: yarn && yarn vscode && ./ci/release.sh
env:
PACKAGE: true
- name: Get release name
id: get-release-name
run: echo "::set-output name=name::$(cd release && ls *.zip)"
- name: Upload release as artifact
uses: actions/upload-artifact@master
with:
name: ${{ steps.get-release-name.outputs.name }}
path: release/${{ steps.get-release-name.outputs.name }}
- name: Create Release
id: create-release
uses: actions/create-release@v1
with:
tag_name: v2.1.0
release_name: Release v2.1.0
draft: true
- name: Upload release
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create-release.outputs.upload_url }}
asset_name: ${{ steps.get-release-name.outputs.name }}
asset_path: release/${{ steps.get-release-name.outputs.name }}
asset_content_type: application/zip

46
.travis.yml Normal file
View File

@ -0,0 +1,46 @@
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: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh"
- name: Linux ARM64 Release
script: travis_wait 60 ./ci/image/run.sh "yarn && yarn vscode && ci/release.sh"
arch: arm64
- name: MacOS Release
os: osx
language: node_js
node_js: 12
script: yarn && yarn vscode && travis_wait 60 ci/release.sh
stages:
- name: Code
- name: Release
if: $TRAVIS_TAG != ""
deploy:
- provider: releases
edge: true
draft: true
tag_name: $TRAVIS_TAG
target_commitish: $TRAVIS_COMMIT
name: $TRAVIS_TAG
file:
- release/*.tar.gz
- release/*.zip
on:
tags: true
condition: $TRAVIS_BUILD_STAGE_NAME == Release
cache:
timeout: 600
yarn: true

View File

@ -248,9 +248,6 @@ class Builder {
if (process.env.MINIFY) { if (process.env.MINIFY) {
await this.task(`restricting ${name} to production dependencies`, async () => { await this.task(`restricting ${name} to production dependencies`, async () => {
await util.promisify(cp.exec)("yarn --production --ignore-scripts", { cwd: buildPath }) await util.promisify(cp.exec)("yarn --production --ignore-scripts", { cwd: buildPath })
if (name === "code-server") {
await util.promisify(cp.exec)("yarn postinstall", { cwd: buildPath })
}
}) })
} }
} }

View File

@ -3,14 +3,8 @@ FROM node:12
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
libxkbfile-dev \ libxkbfile-dev \
libx11-dev \ libx11-dev \
libsecret-1-dev \ libsecret-1-dev
dumb-init
RUN curl -L https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64 > /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt RUN curl -L https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64 > /usr/local/bin/shfmt && chmod +x /usr/local/bin/shfmt
COPY entrypoint.sh /bin/entrypoint.sh ENTRYPOINT ["/bin/bash", "-c"]
ENV PAGER=cat
ENV CI=true
ENTRYPOINT ["dumb-init", "/bin/entrypoint.sh"]

View File

@ -1,5 +0,0 @@
#!/usr/bin/env bash
set -euo pipefail
eval "$@"

11
ci/image/run.sh Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail
main() {
cd "$(dirname "$0")/../.."
imageTag="$(docker build -q ci/image)"
docker run -t --rm -e CI -e GITHUB_TOKEN -v "$(yarn cache dir):/usr/local/share/.cache/yarn/v6" -v "$PWD:/repo" -w /repo "$imageTag" "$*"
}
main "$@"

View File

@ -7,17 +7,14 @@ set -euo pipefail
function main() { function main() {
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
local code_server_version=${VERSION:-${TRAVIS_TAG:-${DRONE_TAG:-}}} local code_server_version=${VERSION:-${TRAVIS_TAG:-}}
if [[ -z $code_server_version ]]; then 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:]') code_server_version=$(grep version ./package.json | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[:space:]')
fi fi
export VERSION=$code_server_version export VERSION=$code_server_version
YARN_CACHE_FOLDER="$(pwd)/yarn-cache" # Always minify and package on CI since that's when releases are pushed.
export YARN_CACHE_FOLDER if [[ ${CI:-} ]]; then
# Always minify and package on tags since that's when releases are pushed.
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]]; then
export MINIFY="true" export MINIFY="true"
export PACKAGE="true" export PACKAGE="true"
fi fi