Skip to content
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

Workflows #41

Open
wants to merge 31 commits into
base: new-ci-cd
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
0644974
Add dependabot file
Skenvy Apr 20, 2023
85706b8
Extensive gitignore
Skenvy Apr 20, 2023
dc82003
Into the wild blue yonder
Apr 20, 2023
9ab5d01
Add the missing runs-on in cql
Apr 20, 2023
bf7add4
Update the nodev from a lockv 1 to a lockv 2 version
Apr 20, 2023
b872431
Run tests in xvfb
Apr 21, 2023
4afecea
sudo apt
Apr 21, 2023
774ea6a
use the recommeneded "xvfb-maybe"
Apr 21, 2023
efc44c3
Clean make
Apr 21, 2023
0a3a5d5
Workflows pr scoped test (#2)
Skenvy Apr 21, 2023
1789933
Update lock
Apr 21, 2023
c77c1ac
Add legacy peer deps to make setup
Apr 21, 2023
e24c3c8
Add the smaller testing scope to test
Apr 21, 2023
1255980
Merge branch 'main' into workflows
Apr 21, 2023
1e99219
Merge branch 'yoavbls:main' into workflows
Skenvy Apr 22, 2023
215c516
Merge branch 'workflows' of github.com:Skenvy/pretty-ts-errors into w…
Skenvy Apr 22, 2023
a0b9de5
Merge branch 'main' into workflows
Skenvy Apr 22, 2023
754e708
Roll make recipes into either themselves or package json scripts
Apr 22, 2023
0d1bfdd
Move the mac and win runners to a comment
Skenvy Apr 22, 2023
2be4db5
Merge branch 'main' into workflows
Skenvy Apr 23, 2023
be064d1
Merge branch 'main' into workflows
Apr 25, 2023
6bf696d
Remove action sha pins
Apr 25, 2023
792af8b
Swap to major only versions
Apr 25, 2023
c245495
Emoji diff and lint in its own job
Apr 25, 2023
721b96c
Fix spelling
Apr 25, 2023
de8ae6e
format test wf
Apr 25, 2023
834f79a
minify ignore, add prepack
Apr 25, 2023
d18a17f
Include vsce test in test and add in a draft release
Apr 25, 2023
c4bc1d4
specify out as the file glob in package and rename *-tests in scripts
Apr 25, 2023
0f3d91c
Remove ts-loader
Apr 25, 2023
2b8ce82
Fix multi-artifact download paths in release find files
Apr 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/dependabot.yml
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
- package-ecosystem: npm
directory: "/"
schedule:
interval: weekly
138 changes: 138 additions & 0 deletions .github/workflows/release.yml
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
@@ -0,0 +1,138 @@
name: Build Release Publish
on:
push:
branches:
- 'main'
workflow_dispatch:
permissions: {}
defaults:
run:
shell: bash
env:
target_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@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
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:
name: Build 🧱
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@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: 🟩 Set up Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ env.target_node_version }}
- name: 🧱 Install build dependencies
run: npm run setup
- name: 🧱 Build
run: npm pack
- name: 🆙 Upload dists
uses: actions/upload-artifact@83fd05a356d7e2593de66fc9913b3002723633cb # v3.1.1
with:
name: Package
path: pretty-ts-errors-*.tgz
if-no-files-found: error
release:
name: Release 🚰
needs: [build]
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: 🆒 Download dists
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: Package
- 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 "$(find . | grep -e pretty-ts-errors-*\.tgz)#Package" --generate-notes -t "v$VER"
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
publish-github:
name: Publish GitHub 🐱‍👤
needs: [release]
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: 🆒 Download dists
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: Package
- name: 🟩 Set up Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ env.target_node_version }}
registry-url: 'https://npm.pkg.github.com'
- name: 📦 Publish
run: npm run workflow_publishsh
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
name: Publish NPM 🟥
needs: [release]
runs-on: ubuntu-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: 🆒 Download dists
uses: actions/download-artifact@9782bd6a9848b53b110e712e20e42d89988822b7 # v3.0.1
with:
name: Package
- name: 🟩 Set up Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ env.target_node_version }}
registry-url: 'https://registry.npmjs.org'
- name: 📦 Publish
run: npm run workflow_publishsh
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
85 changes: 85 additions & 0 deletions .github/workflows/test.yml
@@ -0,0 +1,85 @@
name: CI
on:
push:
branches-ignore:
- 'main'
pull_request:
branches:
- 'main'
workflow_call:
permissions: {}
defaults:
run:
shell: bash
env:
target_node_version: 18.12.1
jobs:
# On a push to a non-trunk branch, do a "quick" test.
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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: 🟩 Set up Node
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: ${{ env.target_node_version }}
- name: 🧱 Install build dependencies
run: npm run setup
- name: 🦂 Test
run: npm run workflow_test
- name: 🧹 Lint
run: npm run lint
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
# On a push to the trunk branch, or a PR (or manual dispatch), run the full
# set of all 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', '17', '18', '19']
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
os: [ubuntu-latest] # TODO: stabilise macOS-latest, windows-latest
steps:
- name: 🏁 Checkout
uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2
- name: 🟩 Set up Node ${{ matrix.version }}
uses: actions/setup-node@8c91899e586c5b171469028077307d293428b516 # v3.5.1
with:
node-version: '${{ matrix.version }}'
- name: 🧱 Install build dependencies
run: npm run setup
- name: 🦂 Test
run: npm run workflow_test
- name: 🧹 Lint
run: npm run lint
# 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@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: 👨‍💻 Init CodeQL
uses: github/codeql-action/init@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
with:
languages: javascript
queries: +security-extended,security-and-quality
- name: 🧱 Autobuild
uses: github/codeql-action/autobuild@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
- name: 👨‍💻 Perform CodeQL Analysis
uses: github/codeql-action/analyze@c3b6fce4ee2ca25bc1066aa3bf73962fda0e8898 # v2.1.31
with:
category: "/language:javascript"
138 changes: 136 additions & 2 deletions .gitignore
Skenvy marked this conversation as resolved.
Show resolved Hide resolved
@@ -1,5 +1,139 @@
################################################################################
# Adopt ignore rules from the recommended GH default for Node, from;
# https://raw.githubusercontent.com/github/gitignore/main/Node.gitignore
################################################################################
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist
node_modules
.vscode-test/

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

################################################################################
# Additional ignore rules beyond the recommended.
################################################################################
*.vsix