From c772e89b5b9082173bae2ac169720ebbfcf44e4d Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:17:44 +0000 Subject: [PATCH 01/13] chore: Initial GHA workflow --- .eslintignore | 19 ++++++++++ .github/workflows/coder.yaml | 71 ++++++++++++++++++++++++++++++++++++ .gitignore | 28 ++++++++++++++ .prettierignore | 22 +++++++++++ Makefile | 12 ++++++ package.json | 16 ++++++++ yarn.lock | 8 ++++ 7 files changed, 176 insertions(+) create mode 100644 .eslintignore create mode 100644 .github/workflows/coder.yaml create mode 100644 .gitignore create mode 100644 .prettierignore create mode 100644 Makefile create mode 100644 package.json create mode 100644 yarn.lock diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000000..14f10ac5f07c7 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,19 @@ +############################################################################### +# COPY PASTA OF .gitignore +############################################################################### +.cache +vendor +product/coder/cmd/coderd/config.toml +code-server +product/coder/pkg/api/manager.test +product/coder/deploy/build/ +product/licensor/deploy/bin +yarn-error.log +node_modules +.DS_Store +.idea +.dbstash +.dbtemp +core.node.* +report.* +.eslintcache \ No newline at end of file diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml new file mode 100644 index 0000000000000..6fb961f76aba0 --- /dev/null +++ b/.github/workflows/coder.yaml @@ -0,0 +1,71 @@ +name: coder + +on: + push: + branches: + - master + - "release/*" + tags: + - "*" + + pull_request: + branches: + - master + - "release/*" + + workflow_dispatch: + +permissions: + actions: none + checks: none + contents: read + deployments: none + issues: none + packages: none + pull-requests: none + repository-projects: none + security-events: none + statuses: none + +jobs: + style: + name: "style/${{ matrix.style }}" + runs-on: + - self-hosted + - v3 + strategy: + matrix: + style: + - fmt + fail-fast: false + permissions: + actions: write # for cancel-workflow-action + contents: read + steps: + - name: Cancel previous runs + if: github.event_name == 'pull_request' + uses: styfle/cancel-workflow-action@0.9.1 + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + + - name: Cache Node + id: cache-node + uses: actions/cache@v2 + with: + path: | + **/node_modules + .eslintcache + key: js-${{ runner.os }}-test-${{ hashFiles('**/yarn.lock') }} + + - name: Install node_modules + run: yarn install + + - name: "make ${{ matrix.style }}" + run: "make --output-sync -j ${{ matrix.style }}" + + - name: Check for unstaged files... + run: ./ci/scripts/check_unstaged.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000..1c83d288b1fbb --- /dev/null +++ b/.gitignore @@ -0,0 +1,28 @@ +############################################################################### +# NOTICE # +# If you change this file, kindly copy-pasta your change into .prettierignore # +# and .eslintignore as well. See the following discussions to understand why # +# we have to resort to this duplication (at least for now): # +# # +# https://github.com/prettier/prettier/issues/8048 # +# https://github.com/prettier/prettier/issues/8506 # +# https://github.com/prettier/prettier/issues/8679 # +############################################################################### + +.cache +vendor +product/coder/cmd/coderd/config.toml +code-server +coverage +product/coder/pkg/api/manager.test +product/coder/deploy/build/ +product/licensor/deploy/bin +yarn-error.log +node_modules +.DS_Store +.idea +.dbstash +.dbtemp +core.node.* +report.* +.eslintcache \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000000..74d467e837bd7 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,22 @@ +############################################################################### +# COPY PASTA OF .gitignore +# https://github.com/prettier/prettier/issues/8048 +# https://github.com/prettier/prettier/issues/8506 +# https://github.com/prettier/prettier/issues/8679 +############################################################################### +.cache +vendor +product/coder/cmd/coderd/config.toml +code-server +product/coder/pkg/api/manager.test +product/coder/deploy/build/ +product/licensor/deploy/bin +yarn-error.log +node_modules +.DS_Store +.idea +.dbstash +.dbtemp +core.node.* +report.* +.eslintcache \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000..6404f93a56109 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +fmt/prettier: + @echo "--- prettier" +# Avoid writing files in CI to reduce file write activity +ifdef CI + yarn run format:check +else + yarn run format:write +endif +.PHONY: fmt/prettier + +fmt: fmt/prettier +.PHONY: fmt \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000000000..bc051c0d6926d --- /dev/null +++ b/package.json @@ -0,0 +1,16 @@ +{ + "name": "coder-v2", + "version": "0.0.1", + "description": "Coder V2 (Workspaces V2)", + "main": "index.js", + "repository": "https://github.com/coder/coder", + "author": "Kyle Carberry ", + "private": true, + "scripts": { + "format:check": "prettier --check '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'", + "format:write": "prettier --write '**/*.{css,htmljs,json,jsx,md,ts,tsx,yaml,yml}'" + }, + "devDependencies": { + "prettier": "2.5.1" + } +} diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000000000..f5d535fc748f1 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,8 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +prettier@^2.5.1: + version "2.5.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.5.1.tgz#fff75fa9d519c54cf0fce328c1017d94546bc56a" + integrity sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg== From 12a710ec2fb205dce541d21f6b2b4ad9dc586ad0 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:20:46 +0000 Subject: [PATCH 02/13] Rename master -> main --- .github/workflows/coder.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 6fb961f76aba0..ec741b9bc1e84 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -3,14 +3,14 @@ name: coder on: push: branches: - - master + - main - "release/*" tags: - "*" pull_request: branches: - - master + - main - "release/*" workflow_dispatch: From 60ce29dc87ba1f3de1f6a8d081fbe4648e099c34 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:22:20 +0000 Subject: [PATCH 03/13] Remove script for now, since not needed for prettier check --- .github/workflows/coder.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index ec741b9bc1e84..c85c4d9ac2d26 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -65,7 +65,4 @@ jobs: run: yarn install - name: "make ${{ matrix.style }}" - run: "make --output-sync -j ${{ matrix.style }}" - - - name: Check for unstaged files... - run: ./ci/scripts/check_unstaged.sh + run: "make --output-sync -j ${{ matrix.style }}" \ No newline at end of file From f594bbb33aaa09e30beb3ccfe62bdadf39bc41b4 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:33:43 +0000 Subject: [PATCH 04/13] Run on ubuntu-latest instead of self-hosted runners --- .github/workflows/coder.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index c85c4d9ac2d26..5f4a5d982e145 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -30,9 +30,7 @@ permissions: jobs: style: name: "style/${{ matrix.style }}" - runs-on: - - self-hosted - - v3 + runs-on: ubuntu-latest strategy: matrix: style: @@ -65,4 +63,4 @@ jobs: run: yarn install - name: "make ${{ matrix.style }}" - run: "make --output-sync -j ${{ matrix.style }}" \ No newline at end of file + run: "make --output-sync -j ${{ matrix.style }}" From 2f1ff577c6ead48e8745427b74ad4016d84d5bf9 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:36:41 +0000 Subject: [PATCH 05/13] Add placeholders for test/go and test/js --- .github/workflows/coder.yaml | 40 ++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 5f4a5d982e145..392b5d7dbd466 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -64,3 +64,43 @@ jobs: - name: "make ${{ matrix.style }}" run: "make --output-sync -j ${{ matrix.style }}" + + test-go: + name: "test/go" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-go@v2 + with: + go-version: "^1.17" + + # Check that go is available + # TODO: Implement actual test run + - run: go --version + + test-js: + name: "test/js" + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - macos-latest + - windows-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v2 + with: + node-version: "14" + + # Check that node is available + # TODO: Implement actual test run + - run: node --version \ No newline at end of file From fe5a94d0c186fa6d62d9ac438a8692ddbecf7e44 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:38:56 +0000 Subject: [PATCH 06/13] Fix version check --- .github/workflows/coder.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 392b5d7dbd466..98d6a9ded594a 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -83,7 +83,7 @@ jobs: # Check that go is available # TODO: Implement actual test run - - run: go --version + - run: go version test-js: name: "test/js" From 8e952e043f13f1eccc58330207180a89062389ec Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:39:16 +0000 Subject: [PATCH 07/13] Fix formatting --- .github/workflows/coder.yaml | 2 +- README.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index 98d6a9ded594a..a0212087f8f53 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -103,4 +103,4 @@ jobs: # Check that node is available # TODO: Implement actual test run - - run: node --version \ No newline at end of file + - run: node --version diff --git a/README.md b/README.md index cdc507907ecf9..ef8b4c49ce603 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,9 @@ # Coder v2 This repository contains source code for Coder V2. Additional documentation: + - [Workspaces V2 RFC](https://www.notion.so/coderhq/b48040da8bfe46eca1f32749b69420dd?v=a4e7d23495094644b939b08caba8e381&p=e908a8cd54804ddd910367abf03c8d0a) ## Directory Structure -- `.github/`: Settings for [Dependabot for updating dependencies](https://docs.github.com/en/code-security/supply-chain-security/customizing-dependency-updates) and [build/deploy pipelines with GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions). \ No newline at end of file +- `.github/`: Settings for [Dependabot for updating dependencies](https://docs.github.com/en/code-security/supply-chain-security/customizing-dependency-updates) and [build/deploy pipelines with GitHub Actions](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions). From d65ffbe82edcdb7fa9eef5cfc5c8ec50ddd9a34d Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:41:16 +0000 Subject: [PATCH 08/13] Just run front-end tests on single OS, for now --- .github/workflows/coder.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/coder.yaml b/.github/workflows/coder.yaml index a0212087f8f53..6fd8ae9737331 100644 --- a/.github/workflows/coder.yaml +++ b/.github/workflows/coder.yaml @@ -87,13 +87,7 @@ jobs: test-js: name: "test/js" - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: - - ubuntu-latest - - macos-latest - - windows-latest + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 From 4ac14f1cba009dd48667bf21a08811589c524f20 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:45:33 +0000 Subject: [PATCH 09/13] Remove AUTHOR field from package.json, since we don't use this in code-server either --- package.json | 1 - 1 file changed, 1 deletion(-) diff --git a/package.json b/package.json index bc051c0d6926d..c22f62e26b5cb 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,6 @@ "description": "Coder V2 (Workspaces V2)", "main": "index.js", "repository": "https://github.com/coder/coder", - "author": "Kyle Carberry ", "private": true, "scripts": { "format:check": "prettier --check '**/*.{css,html,js,json,jsx,md,ts,tsx,yaml,yml}'", From 67251030c38b19d52851e8e167b594974d464dab Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:52:18 +0000 Subject: [PATCH 10/13] Add status badge --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index ef8b4c49ce603..cbdc1550736c9 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![coder](https://github.com/coder/coder/actions/workflows/coder.yaml/badge.svg)](https://github.com/coder/coder/actions/workflows/coder.yaml) + # Coder v2 This repository contains source code for Coder V2. Additional documentation: From be4e349d139c94e6c77a3f8f662d83e359c14956 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Mon, 3 Jan 2022 19:58:09 +0000 Subject: [PATCH 11/13] Setup codecov; add badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cbdc1550736c9..be1a04b98f3a9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![coder](https://github.com/coder/coder/actions/workflows/coder.yaml/badge.svg)](https://github.com/coder/coder/actions/workflows/coder.yaml) +[![codecov](https://codecov.io/gh/coder/coder/branch/main/graph/badge.svg?token=TNLW3OAP6G)](https://codecov.io/gh/coder/coder) # Coder v2 From 6f0a43ef0dcb2eb0be7986e390e5e8e1bad42868 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 4 Jan 2022 02:48:17 +0000 Subject: [PATCH 12/13] Minimize ignore files --- .eslintignore | 17 +---------------- .gitignore | 15 --------------- .prettierignore | 17 +---------------- 3 files changed, 2 insertions(+), 47 deletions(-) diff --git a/.eslintignore b/.eslintignore index 14f10ac5f07c7..bee3ca2bf9ae5 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,19 +1,4 @@ ############################################################################### # COPY PASTA OF .gitignore ############################################################################### -.cache -vendor -product/coder/cmd/coderd/config.toml -code-server -product/coder/pkg/api/manager.test -product/coder/deploy/build/ -product/licensor/deploy/bin -yarn-error.log -node_modules -.DS_Store -.idea -.dbstash -.dbtemp -core.node.* -report.* -.eslintcache \ No newline at end of file +node_modules \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1c83d288b1fbb..cc8a97a2c47b3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,20 +9,5 @@ # https://github.com/prettier/prettier/issues/8679 # ############################################################################### -.cache -vendor -product/coder/cmd/coderd/config.toml -code-server -coverage -product/coder/pkg/api/manager.test -product/coder/deploy/build/ -product/licensor/deploy/bin -yarn-error.log node_modules -.DS_Store -.idea -.dbstash -.dbtemp -core.node.* -report.* .eslintcache \ No newline at end of file diff --git a/.prettierignore b/.prettierignore index 74d467e837bd7..c7f4591f84101 100644 --- a/.prettierignore +++ b/.prettierignore @@ -4,19 +4,4 @@ # https://github.com/prettier/prettier/issues/8506 # https://github.com/prettier/prettier/issues/8679 ############################################################################### -.cache -vendor -product/coder/cmd/coderd/config.toml -code-server -product/coder/pkg/api/manager.test -product/coder/deploy/build/ -product/licensor/deploy/bin -yarn-error.log -node_modules -.DS_Store -.idea -.dbstash -.dbtemp -core.node.* -report.* -.eslintcache \ No newline at end of file +node_modules \ No newline at end of file From db32104bb7a6cb255b8a2d2c55e4ddc1706c2463 Mon Sep 17 00:00:00 2001 From: Bryan Phelps Date: Tue, 4 Jan 2022 02:50:34 +0000 Subject: [PATCH 13/13] Remove version & entry point --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index c22f62e26b5cb..eb099b34916a0 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,6 @@ { "name": "coder-v2", - "version": "0.0.1", "description": "Coder V2 (Workspaces V2)", - "main": "index.js", "repository": "https://github.com/coder/coder", "private": true, "scripts": {