Skip to content

Commit a126e9b

Browse files
authored
Merge pull request #999 from meyerhot95/tsm/circleci
[IBE-566] Migrate to circleci
2 parents 791b275 + c7555ca commit a126e9b

File tree

3 files changed

+120
-59
lines changed

3 files changed

+120
-59
lines changed

.circleci/config.yml

+118
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
version: 2.1
2+
executors:
3+
default-executor:
4+
docker:
5+
- image: "cimg/node:16.16.0-browsers"
6+
working_directory: ~/project
7+
resource_class: medium
8+
9+
commands:
10+
restore_test_cache:
11+
steps:
12+
- restore_cache:
13+
keys:
14+
- v1-deps-{{ checksum "package-lock.json" }}
15+
- v1-deps-
16+
save_test_cache:
17+
steps:
18+
- save_cache:
19+
key: v1-deps-{{ checksum "package-lock.json" }}
20+
paths:
21+
- node_modules
22+
- ~/.cache/ms-playwright
23+
24+
setup:
25+
steps:
26+
- run:
27+
name: Install dependencies
28+
command: |
29+
npm --production=false install
30+
npm --production=false update
31+
npx playwright install
32+
33+
test:
34+
steps:
35+
- run:
36+
name: Test
37+
command: |
38+
npm run test
39+
40+
setup_deploy:
41+
steps:
42+
- run:
43+
name: Setup Deploy
44+
command: |
45+
export NODE_ENV=production
46+
export RELEASE_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
47+
echo "export NPM_TAG=latest" >> $BASH_ENV
48+
npm run build
49+
if [ -z "$BEFORE_DEPLOY_RAN" ]; then
50+
VPKG=$($(npm bin)/json -f package.json version)
51+
VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}
52+
echo "export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}" >> $BASH_ENV
53+
npm --no-git-tag-version version $VERSION
54+
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard
55+
echo "export NPM_TAG=hotfix" >> $BASH_ENV
56+
fi
57+
git config --global user.email "$(git log --pretty=format:"%ae" -n1)"
58+
git config --global user.name "$(git log --pretty=format:"%an" -n1)"
59+
echo "export BEFORE_DEPLOY_RAN=true" >> $BASH_ENV
60+
fi
61+
62+
deploy:
63+
steps:
64+
- run:
65+
name: Deploy
66+
command: |
67+
echo "Deploying version $RELEASE_VERSION to $NPM_TAG"
68+
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
69+
npm publish --tag $NPM_TAG
70+
if npm info | grep -q $RELEASE_VERSION; then git tag $RELEASE_VERSION && git push https://${GH_TOKEN}@github.com/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}.git $RELEASE_VERSION; fi
71+
72+
jobs:
73+
build-and-test:
74+
executor: default-executor
75+
steps:
76+
- checkout
77+
- restore_test_cache
78+
- setup
79+
- save_test_cache
80+
- test
81+
- persist_to_workspace:
82+
root: ~/project
83+
paths: .
84+
deploy:
85+
executor: default-executor
86+
steps:
87+
- attach_workspace:
88+
at: ~/project
89+
- setup_deploy
90+
- deploy
91+
- save_test_cache
92+
93+
workflows:
94+
build-and-test-workflow:
95+
when:
96+
not:
97+
or:
98+
- equal: [ master, <<pipeline.git.branch>> ]
99+
- equal: [ develop, <<pipeline.git.branch>> ]
100+
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
101+
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
102+
jobs:
103+
- build-and-test
104+
105+
deploy-workflow:
106+
when:
107+
or:
108+
- equal: [ master, <<pipeline.git.branch>> ]
109+
- equal: [ develop, <<pipeline.git.branch>> ]
110+
- matches: { pattern: "^hotfix.*", value: <<pipeline.git.branch>> }
111+
- matches: { pattern: "^release.*", value: <<pipeline.git.branch>> }
112+
jobs:
113+
- build-and-test
114+
- deploy:
115+
context:
116+
- scratch-npm-creds
117+
requires:
118+
- build-and-test

.travis.yml

-58
This file was deleted.

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
## scratch-render
22
#### WebGL-based rendering engine for Scratch 3.0
33

4-
[![Build Status](https://travis-ci.org/LLK/scratch-render.svg?branch=develop)](https://travis-ci.org/LLK/scratch-render)
4+
[![CircleCI](https://circleci.com/gh/LLK/scratch-render/tree/develop.svg?style=shield&circle-token=310da166a745295d515b3b90f3bad10f23b84405)](https://circleci.com/gh/LLK/scratch-render?branch=develop)
5+
56
[![Greenkeeper badge](https://badges.greenkeeper.io/LLK/scratch-render.svg)](https://greenkeeper.io/)
67

78
## Installation

0 commit comments

Comments
 (0)