Skip to content

chore: Initial GHA workflow #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 4, 2022
19 changes: 19 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
###############################################################################
# COPY PASTA OF .gitignore
###############################################################################
.cache
vendor
product/coder/cmd/coderd/config.toml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be able to cleanup a few of these.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, ya, good point - I'll clear these out to just the ones we actually need (right now, just node_modules).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cleaned up in 6f0a43e

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
106 changes: 106 additions & 0 deletions .github/workflows/coder.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: coder

on:
push:
branches:
- main
- "release/*"
tags:
- "*"

pull_request:
branches:
- main
- "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: ubuntu-latest
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 }}"

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
28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
22 changes: 22 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
16 changes: 16 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "coder-v2",
"version": "0.0.1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like this version will get outdated really fast.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, I realized we don't have a version in coder/m's root package.json, so I'll leave out here too. We can always add back later, but better to simplify as you suggested 👍

Also removed this in db32104

"description": "Coder V2 (Workspaces V2)",
"main": "index.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should remove the main for now, since it seems unlikely we'll have one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally, thanks for catching this! Removed in db32104

"repository": "https://github.com/coder/coder",
"author": "Kyle Carberry <kyle@coder.com>",
"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"
}
}
8 changes: 8 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
@@ -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==