-
Notifications
You must be signed in to change notification settings - Fork 6k
feat(ci): refactor build workflow #5572
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
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
93f6fd2
refactor: remove stylelint
jsjoeio f36c1f5
refactor: move shellcheck to separate job
jsjoeio 3028e8e
refactor: add helm script and job
jsjoeio d8e0dc9
refactor: add eslint job and yarn script
jsjoeio 0b1cfc9
fix(test/tsconfig): exclude test-plugin
jsjoeio fe70ebf
refactor: delete lint, add typecheck job
jsjoeio bbfbab4
refactor: remove prebuild
jsjoeio 74330a1
wip: add notes about unit test refactor
jsjoeio a094400
refactor: delete buggy socket test
jsjoeio bc02005
refactor: move test-plugin to integration suite
jsjoeio 64d234e
wip
jsjoeio 13286bf
wip: refactor vscode integration tests
jsjoeio 6c87b54
refactor: move unit tests to separate job
jsjoeio 42bafc3
fix: formatting
jsjoeio 917d92e
Revert "wip: refactor vscode integration tests"
jsjoeio 6ad5d9a
Revert "refactor: move unit tests to separate job"
jsjoeio 9030873
feat: collect codecov integration tests
jsjoeio 1243d19
fixup! feat: collect codecov integration tests
jsjoeio f339d0d
fixup! feat: collect codecov integration tests
jsjoeio 614f047
fixup!: move helm step
jsjoeio f9b3bda
fixup!: update ids for caching
jsjoeio 4527d46
trigger ci
jsjoeio 6f7133b
trigger ci
jsjoeio 08a7fdf
chore: clean up names in security.yaml
jsjoeio e41dc6a
fixup!: remove .tsx
jsjoeio 65b74fc
fixup!: change to src/**"
jsjoeio 72d69b6
fixup!: move helm cmd to yaml
jsjoeio 88119c2
fixup!: always build test plugin
jsjoeio f7dd9a6
fixup!: fix plugin typings
jsjoeio f9ecaaa
fixup! add back flakey test
jsjoeio ed1cd54
fixup!: only install helm deps if changes
jsjoeio d95a3b5
fixup!: revert node mod caching
jsjoeio 7d5ad00
dont keep, test for asher
jsjoeio af37f1f
fixup!: add make to centos
jsjoeio eae094c
refactor: add test:native
jsjoeio 02ed560
try updating glibc
jsjoeio 9a1cd34
try 2.25
jsjoeio 7d43eaa
Revert "refactor: move test-plugin to integration suite"
jsjoeio 4c94137
Revert "try updating glibc"
jsjoeio 5de48da
fixup!
jsjoeio 77adf7b
asher: again
jsjoeio 97842c4
try this for ts changes
jsjoeio 6c8261a
fixup
jsjoeio c57dfe5
refactor: scripts.yml -> scripts.yaml
jsjoeio 5a6d486
fixup!: move lint-sh to scripts.yaml
jsjoeio 33163e8
fixup!: use apk for lint scripts
jsjoeio 76168c9
fixup! fixup!: use apk for lint scripts
jsjoeio 91fdc7e
fixup!: remove typecheck step
jsjoeio 1ed536b
fix: pattern for lint ts files
jsjoeio 158c64d
test: lint should fail
jsjoeio 3b9e677
fixup! fixup!: use apk for lint scripts
jsjoeio 27312a5
Revert "test: lint should fail"
jsjoeio eb2b181
fixup!: skip cancel workflow on forks
jsjoeio 3c15bf1
fixup: remove cancel-workflow
jsjoeio 185d259
fixup! fixup! fixup!: use apk for lint scripts
jsjoeio bfb6c01
fixup! fixup! fixup!: use apk for lint scripts
jsjoeio 24776df
fixup!: fix yarn key
jsjoeio 5f8beae
fixup!: add fetch-depth 0
jsjoeio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,10 +22,10 @@ concurrency: | |
# will skip running `yarn install` if it successfully fetched from cache | ||
|
||
jobs: | ||
prebuild: | ||
name: Pre-build checks | ||
fmt: | ||
name: Format with Prettier | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
@@ -35,15 +35,81 @@ jobs: | |
with: | ||
node-version: "16" | ||
|
||
- name: Fetch dependencies from cache | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: "**/node_modules" | ||
key: yarn-build-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
yarn-build- | ||
|
||
- name: Install dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile | ||
|
||
- name: Format files with Prettier | ||
run: yarn fmt | ||
|
||
lint-helm: | ||
name: Lint Helm chart | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: | | ||
ci/helm-chart/** | ||
|
||
- name: Install helm | ||
jsjoeio marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if: steps.changed-files.outputs.any_changed == 'true' | ||
uses: azure/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Install helm kubeval plugin | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: helm plugin install https://github.com/instrumenta/helm-kubeval | ||
|
||
- name: Lint Helm chart | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: helm kubeval ci/helm-chart | ||
|
||
lint-ts: | ||
name: Lint TypeScript files | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
|
||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/[email protected] | ||
with: | ||
files: | | ||
**/*.ts | ||
**/*.js | ||
files_ignore: | | ||
lib/vscode/** | ||
|
||
- name: Install Node.js v16 | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
|
||
- name: Fetch dependencies from cache | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
id: cache-node-modules | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -53,20 +119,15 @@ jobs: | |
yarn-build- | ||
|
||
- name: Install dependencies | ||
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
if: steps.changed-files.outputs.any_changed == 'true' && steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile | ||
|
||
- name: Run yarn fmt | ||
run: yarn fmt | ||
if: success() | ||
|
||
- name: Run yarn lint | ||
run: yarn lint | ||
if: success() | ||
- name: Lint TypeScript files | ||
if: steps.changed-files.outputs.any_changed == 'true' | ||
run: yarn lint:ts | ||
|
||
build: | ||
name: Build | ||
needs: prebuild | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 30 | ||
env: | ||
|
@@ -222,6 +283,8 @@ jobs: | |
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
container: "centos:7" | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
steps: | ||
- name: Checkout repo | ||
|
@@ -234,7 +297,7 @@ jobs: | |
|
||
- name: Install development tools | ||
run: | | ||
yum install -y epel-release centos-release-scl | ||
yum install -y epel-release centos-release-scl make | ||
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3 | ||
|
||
- name: Install nfpm and envsubst | ||
|
@@ -278,6 +341,12 @@ jobs: | |
- name: Run integration tests on standalone release | ||
run: yarn test:integration | ||
|
||
- name: Upload coverage report to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
if: success() | ||
|
||
- name: Build packages with nfpm | ||
run: yarn package | ||
|
||
|
@@ -417,8 +486,8 @@ jobs: | |
if: steps.cache-node-modules.outputs.cache-hit != 'true' | ||
run: SKIP_SUBMODULE_DEPS=1 yarn install | ||
|
||
- name: Run integration tests on standalone release | ||
run: yarn test:integration | ||
- name: Run native module tests on standalone release | ||
run: yarn test:native | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like the rename. |
||
|
||
- name: Build packages with nfpm | ||
run: yarn package | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
main() { | ||
cd "$(dirname "$0")/../.." | ||
shellcheck -e SC2046,SC2164,SC2154,SC1091,SC1090,SC2002 $(git ls-files '*.sh' | grep -v 'lib/vscode') | ||
} | ||
|
||
main "$@" |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
help() { | ||
echo >&2 " You can build the standalone release with 'yarn release:standalone'" | ||
echo >&2 " Or you can pass in a custom path." | ||
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' yarn test:integration" | ||
} | ||
|
||
# Make sure a code-server release works. You can pass in the path otherwise it | ||
# will look for release-standalone in the current directory. | ||
# | ||
# This is to make sure we don't have Node version errors or any other | ||
# compilation-related errors. | ||
main() { | ||
cd "$(dirname "$0")/../.." | ||
|
||
source ./ci/lib.sh | ||
|
||
local path="$RELEASE_PATH-standalone/bin/code-server" | ||
if [[ ! ${CODE_SERVER_PATH-} ]]; then | ||
echo "Set CODE_SERVER_PATH to test another build of code-server" | ||
else | ||
path="$CODE_SERVER_PATH" | ||
fi | ||
|
||
echo "Running tests with code-server binary: '$path'" | ||
|
||
if [[ ! -f $path ]]; then | ||
echo >&2 "No code-server build detected" | ||
echo >&2 "Looked in $path" | ||
help | ||
exit 1 | ||
fi | ||
|
||
CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration/help.test.ts" | ||
} | ||
|
||
main "$@" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": ["./**/*.ts"] | ||
"include": ["./**/*.ts"], | ||
"exclude": ["./unit/node/test-plugin"] | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.