Merge pull request from scratchfoundation/rd/ENG-41/move-to-gha

Move scratch-parser to GitHub Actions
This commit is contained in:
Ron de las Alas 2023-10-18 08:28:14 -04:00 committed by GitHub
commit 8aa528867c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18316 additions and 107 deletions

View file

@ -1,105 +0,0 @@
version: 2.1
orbs:
commitlint: conventional-changelog/commitlint@1.0.0
executors:
default-executor:
docker:
- image: "cimg/node:lts"
working_directory: ~/project
resource_class: medium
commands:
restore_test_cache:
steps:
- restore_cache:
keys:
- v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}
- v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}
- v1-deps-
save_test_cache:
steps:
- save_cache:
key: v1-deps-{{ .Environment.CIRCLE_JOB }}-{{ .Branch }}-{{ .Revision }}
paths:
- node_modules
- ~/.npm
setup:
steps:
- run:
name: Setup
command: |
npm prune
test:
steps:
- run:
name: Test
command: |
npm run test
deploy:
steps:
- run:
name: Deploy
command: |
npm run semantic-release
jobs:
build-and-test:
executor: default-executor
steps:
- checkout
- restore_test_cache
- setup
- save_test_cache
- test
- persist_to_workspace:
root: ~/project
paths: .
deploy:
executor: default-executor
steps:
- attach_workspace:
at: ~/project
- deploy
workflows:
commitlint:
when:
not:
or:
- equal: [ master, <<pipeline.git.branch>> ]
- equal: [ develop, <<pipeline.git.branch>> ]
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
jobs:
- commitlint/lint:
target-branch: master
build-and-test-workflow:
when:
not:
or:
- equal: [ master, <<pipeline.git.branch>> ]
- equal: [ develop, <<pipeline.git.branch>> ]
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
jobs:
- build-and-test
deploy-workflow:
when:
or:
- equal: [ master, <<pipeline.git.branch>> ]
- equal: [ develop, <<pipeline.git.branch>> ]
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
- matches: { pattern: "^v[0-9]*.[0-9]*.[0-9]*$", value: <<pipeline.git.branch>> }
jobs:
- build-and-test
- deploy:
context:
- scratch-npm-creds
requires:
- build-and-test

1
.github/CODEOWNERS.md vendored Normal file
View file

@ -0,0 +1 @@
@scratchfoundation/scratch-engineering

47
.github/workflows/deploy.yml vendored Normal file
View file

@ -0,0 +1,47 @@
name: Scratch Parser CI-CD
on:
pull_request: # Runs whenever a pull request is created or updated
push: # Runs whenever a commit is pushed to the repository...
branches: [master] # ...on any of these branches
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
permissions:
contents: write
pages: write
issues: write
pull-requests: write
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: wagoid/commitlint-github-action@v5
- uses: actions/setup-node@v3
with:
cache: "npm"
node-version-file: ".nvmrc"
- name: Info
run: |
cat <<EOF
Node version: $(node --version)
NPM version: $(npm --version)
GitHub ref: ${{ github.ref }}
GitHub head ref: ${{ github.head_ref }}
EOF
- name: Install NPM Dependencies
run: |
npm ci
- name: Lint
run: npm run test:lint
- name: Run All Tests
run: npm run test
- name: Semantic Release
if: github.ref == 'master'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: npx --no -- semantic-release

1
.gitignore vendored
View file

@ -4,7 +4,6 @@
# NPM
/node_modules
npm-*
package-lock.json
# Testing
/.nyc_output

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
v18

18266
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,7 @@
"test:integration": "tap test/integration/*.js",
"test:coverage": "tap test/{unit,integration}/*.js --coverage --coverage-report=lcov",
"test:benchmark": "node test/benchmark/performance.js",
"test": "npm run test:lint && npm run test:unit && npm run test:integration",
"test": "npm run test:unit && npm run test:integration",
"semantic-release": "semantic-release"
},
"dependencies": {