-
-
Notifications
You must be signed in to change notification settings - Fork 92
Workflows #41
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
Open
Skenvy
wants to merge
31
commits into
yoavbls:new-ci-cd
Choose a base branch
from
Skenvy:workflows
base: new-ci-cd
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Workflows #41
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
0644974
Add dependabot file
Skenvy 85706b8
Extensive gitignore
Skenvy dc82003
Into the wild blue yonder
9ab5d01
Add the missing runs-on in cql
bf7add4
Update the nodev from a lockv 1 to a lockv 2 version
b872431
Run tests in xvfb
4afecea
sudo apt
774ea6a
use the recommeneded "xvfb-maybe"
efc44c3
Clean make
0a3a5d5
Workflows pr scoped test (#2)
Skenvy 1789933
Update lock
c77c1ac
Add legacy peer deps to make setup
e24c3c8
Add the smaller testing scope to test
1255980
Merge branch 'main' into workflows
1e99219
Merge branch 'yoavbls:main' into workflows
Skenvy 215c516
Merge branch 'workflows' of github.com:Skenvy/pretty-ts-errors into w…
Skenvy a0b9de5
Merge branch 'main' into workflows
Skenvy 754e708
Roll make recipes into either themselves or package json scripts
0d1bfdd
Move the mac and win runners to a comment
Skenvy 2be4db5
Merge branch 'main' into workflows
Skenvy be064d1
Merge branch 'main' into workflows
6bf696d
Remove action sha pins
792af8b
Swap to major only versions
c245495
Emoji diff and lint in its own job
721b96c
Fix spelling
de8ae6e
format test wf
834f79a
minify ignore, add prepack
d18a17f
Include vsce test in test and add in a draft release
c4bc1d4
specify out as the file glob in package and rename *-tests in scripts
0f3d91c
Remove ts-loader
2b8ce82
Fix multi-artifact download paths in release find files
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: github-actions | ||
directory: "/" | ||
schedule: | ||
interval: daily | ||
- package-ecosystem: npm | ||
directory: "/" | ||
schedule: | ||
interval: weekly |
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,172 @@ | ||
name: Build Release Publish | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
workflow_dispatch: | ||
|
||
permissions: {} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
development_node_version: 18.12.1 | ||
|
||
jobs: | ||
# Gate the build -> release -> publish jobs with the test workflow. | ||
test: | ||
name: 🧪 CI | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
uses: ./.github/workflows/test.yml | ||
|
||
# 🛑 Check both whether the package's version field has changed, and if that | ||
# version's value already exists in a known release, to determine if we should | ||
# proceed with building and releasing. | ||
workflow-conditions: | ||
name: 🛑 Stop release collisions | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version-file-changed: ${{ steps.version-file-check.outputs.version-file-changed }} | ||
version-tag-exists: ${{ steps.version-tag-exists.outputs.version-tag-exists }} | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 2 | ||
- name: Check if version files changed | ||
id: version-file-check | ||
run: | | ||
export VERSION_FILE="package.json" | ||
[ "$(git diff HEAD^1.. --name-only | grep -e "^$VERSION_FILE$")" == "$VERSION_FILE" ] && echo "version-file-changed=${{toJSON(true)}}" >> $GITHUB_OUTPUT || echo "version-file-changed=${{toJSON(false)}}" >> $GITHUB_OUTPUT | ||
- name: Notify on version-file-check | ||
run: echo "::Notice::version-file-changed is ${{ fromJSON(steps.version-file-check.outputs.version-file-changed) }}" | ||
- name: Check if version specified in version file has not released. | ||
id: version-tag-exists | ||
run: | | ||
git fetch --tags | ||
export VER=$(grep package.json -e "\"version\":" | cut -d \" -f 4) | ||
[ -z "$(git tag -l "v$VER")" ] && echo "version-tag-exists=${{toJSON(false)}}" >> $GITHUB_OUTPUT || echo "version-tag-exists=${{toJSON(true)}}" >> $GITHUB_OUTPUT | ||
- name: Notify on version-tag-exists | ||
run: echo "::Notice::version-tag-exists is ${{ fromJSON(steps.version-tag-exists.outputs.version-tag-exists) }}" | ||
|
||
# We want to build release and publish automatically if "version-file-changed" | ||
# is true on push. Or manually if workflow_dispatch. | ||
# Both triggers need "version-tag-exists" is false. | ||
build-npm: | ||
name: Build NPM 🧱 | ||
needs: [test, workflow-conditions] | ||
if: >- | ||
${{ ((fromJSON(needs.workflow-conditions.outputs.version-file-changed) == true && github.event_name == 'push') || | ||
github.event_name == 'workflow_dispatch') && fromJSON(needs.workflow-conditions.outputs.version-tag-exists) == false }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🧱 Build | ||
run: npm pack | ||
- name: 🆙 Upload dists | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: npm-package | ||
path: pretty-ts-errors-*.tgz | ||
if-no-files-found: error | ||
|
||
build-vsce: | ||
name: Build VSCE 🧱 | ||
needs: [test, workflow-conditions] | ||
if: >- | ||
${{ ((fromJSON(needs.workflow-conditions.outputs.version-file-changed) == true && github.event_name == 'push') || | ||
github.event_name == 'workflow_dispatch') && fromJSON(needs.workflow-conditions.outputs.version-tag-exists) == false }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🧱 Build | ||
run: npm run build | ||
- name: 🆙 Upload dists | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: vsce-package | ||
path: pretty-ts-errors-*.vsix | ||
if-no-files-found: error | ||
|
||
release: | ||
name: Release 🚰 | ||
needs: [build-npm, build-vsce] | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🆒 Download dists | ||
uses: actions/download-artifact@v3 | ||
- name: 🚰 Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: >- | ||
export VER=$(grep package.json -e "\"version\":" | cut -d \" -f 4) && | ||
gh release create v$VER --generate-notes -t "v$VER" --draft | ||
"$(find . | grep -e npm-package/pretty-ts-errors-*\.tgz)#npm package" | ||
"$(find . | grep -e vsce-package/pretty-ts-errors-*\.vsix)#vsce package" | ||
|
||
publish-github: | ||
name: Publish GitHub 🐱👤 | ||
needs: [release] | ||
permissions: | ||
packages: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🆒 Download dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: npm-package | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
registry-url: 'https://npm.pkg.github.com' | ||
- name: 📦 Publish | ||
run: npm run workflow_publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
publish-npm: | ||
name: Publish NPM 🟥 | ||
needs: [release] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🆒 Download dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: npm-package | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
registry-url: 'https://registry.npmjs.org' | ||
- name: 📦 Publish | ||
run: npm run workflow_publish | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
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,124 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches-ignore: | ||
- 'main' | ||
pull_request: | ||
branches: | ||
- 'main' | ||
workflow_call: | ||
|
||
permissions: {} | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
env: | ||
development_node_version: 18.12.1 | ||
|
||
jobs: | ||
# On every push to every branch, lint. | ||
lint: | ||
name: 🔬 Lint | ||
if: ${{ github.event_name == 'push' }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🔬 Lint | ||
run: npm run lint | ||
|
||
# On a push to a non-trunk branch, do a "quick" test of the package. | ||
quick-test: | ||
name: 🧪 Quick Test | ||
if: ${{ github.event_name == 'push' && !(github.event.ref == 'refs/heads/main') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🧪 Test | ||
run: npm run workflow_test | ||
|
||
# On a push to the trunk branch, or a PR (or manual dispatch), run the full | ||
# set of tests against the targeted supported major versions. | ||
full-test: | ||
name: 🧪 Full Test | ||
if: >- | ||
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }} | ||
runs-on: '${{ matrix.os }}' | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
version: ['16', '18', '20'] | ||
os: [ubuntu-latest] # TODO: stabilise macOS-latest, windows-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node ${{ matrix.version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '${{ matrix.version }}' | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🧪 Test | ||
run: npm run workflow_test | ||
|
||
# On a push to the trunk branch, or a PR (or manual dispatch), run the build | ||
# to confirm that the vsce build is happy. | ||
is-vsce-happy: | ||
name: 🧪 VSCE Test | ||
if: >- | ||
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 🟩 Set up Node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.development_node_version }} | ||
- name: 🧱 Install build dependencies | ||
run: npm run setup | ||
- name: 🧪 Test | ||
run: npm run build | ||
|
||
# On a push to the trunk branch, or a PR (or manual dispatch), do a CodeQL analysis. | ||
codeql: | ||
name: 👨💻 CodeQL | ||
if: >- | ||
${{ github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || | ||
(github.event_name == 'push' && github.event.ref == 'refs/heads/main') }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
actions: read | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: 🏁 Checkout | ||
uses: actions/checkout@v3 | ||
- name: 👨💻 Init CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: javascript | ||
queries: +security-extended,security-and-quality | ||
- name: 🧱 Autobuild | ||
uses: github/codeql-action/autobuild@v2 | ||
- name: 👨💻 Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
with: | ||
category: "/language:javascript" |
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,5 +1,15 @@ | ||
# build / generate output | ||
out | ||
dist | ||
|
||
# Dependency directories | ||
node_modules | ||
|
||
# Stores VSCode versions used for testing VSCode extensions | ||
.vscode-test/ | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Output of 'vsce package' | ||
*.vsix |
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
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.