Skip to content

Commit

Permalink
Bamboo specs for CSS Tokenizer lib
Browse files Browse the repository at this point in the history
  • Loading branch information
scripthunter7 committed Oct 16, 2023
1 parent 184c4f8 commit 5623797
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bamboo-specs/bamboo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,18 @@

---
!include 'agtree-permissions.yaml'

---
!include 'css-tokenizer-test.yaml'

---
!include 'css-tokenizer-increment.yaml'

---
!include 'css-tokenizer-build.yaml'

---
!include 'css-tokenizer-deploy.yaml'

---
!include 'css-tokenizer-permissions.yaml'
93 changes: 93 additions & 0 deletions bamboo-specs/css-tokenizer-build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
version: 2
plan:
project-key: AJL
key: CSSTOKENIZERBUILD
name: CSS Tokenizer - build
variables:
dockerContainer: adguard/node-ssh:16.17--1

stages:
- Build:
manual: 'false'
final: 'false'
jobs:
- Build

Build:
key: BUILD
other:
clean-working-dir: true
docker:
image: "${bamboo.dockerContainer}"
volumes:
"${system.YARN_DIR}": "${bamboo.cacheYarn}"
tasks:
- checkout:
force-clean-build: 'true'
- script:
interpreter: SHELL
scripts:
- |-
set -e
set -x
# Fix mixed logs
exec 2>&1
ls -alt
# Bootstrap the package with Lerna
npx lerna@6 bootstrap --scope @adguard/css-tokenizer --include-dependencies
# Build CSS Tokenizer with Rollup
npx lerna@6 run --scope @adguard/css-tokenizer build
# Pack the CSS Tokenizer package into a tarball
cd packages/css-tokenizer/
yarn pack --filename css-tokenizer.tgz
cd ../../
# Cleanup parent
rm -rf node_modules
# Cleanup child packages
npx lerna@6 clean -y
- inject-variables:
file: ./packages/css-tokenizer/dist/build.txt
scope: RESULT
namespace: inject
- any-task:
plugin-key: com.atlassian.bamboo.plugins.vcs:task.vcs.tagging
configuration:
selectedRepository: defaultRepository
tagName: css-tokenizer-v${bamboo.inject.version}
# Store the CSS Tokenizer package tarball as an artifact
artifacts:
- name: css-tokenizer.tgz
location: packages/css-tokenizer/
pattern: css-tokenizer.tgz
shared: true
required: true
requirements:
- adg-docker: 'true'

triggers: []

branches:
create: manually
delete: never
link-to-jira: 'true'

notifications:
- events:
- plan-status-changed
recipients:
- webhook:
name: Build webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo

labels: []

other:
concurrent-build-plugin: system-default
47 changes: 47 additions & 0 deletions bamboo-specs/css-tokenizer-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
version: 2
deployment:
name: CSS Tokenizer - deploy
source-plan: AJL-CSSTOKENIZERBUILD
release-naming: ${bamboo.inject.version}
environments:
- npmjs

npmjs:
docker:
image: adguard/node-ssh:16.17--1
volumes:
${system.YARN_DIR}: "${bamboo.cacheYarn}"
triggers: [ ]
tasks:
- checkout:
force-clean-build: 'true'
# Download previously built tarball from Bamboo artifacts
- artifact-download:
artifacts:
- name: css-tokenizer.tgz
- script:
interpreter: SHELL
scripts:
- |-
set -e
set -x
# Fix mixed logs
exec 2>&1
ls -alt
# Publish tarball to NPM package registry
export NPM_TOKEN=${bamboo.npmSecretToken}
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish css-tokenizer.tgz --access public
requirements:
- adg-docker: 'true'
notifications:
- events:
- deployment-started-and-finished
recipients:
- webhook:
name: Deploy webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo
65 changes: 65 additions & 0 deletions bamboo-specs/css-tokenizer-increment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
version: 2
plan:
project-key: AJL
key: CSSTOKENIZERINCR
name: CSS Tokenizer - increment
variables:
dockerContainer: adguard/node-ssh:16.17--1

stages:
- Increment:
manual: 'true'
final: 'false'
jobs:
- Increment

Increment:
key: INCRCSSTOKENIZER
docker:
image: "${bamboo.dockerContainer}"
volumes:
"${system.YARN_DIR}": "${bamboo.cacheYarn}"
tasks:
- checkout:
force-clean-build: 'true'
- script:
interpreter: SHELL
scripts:
- |-
branch="${bamboo.planRepository.branchName}"
# Throw error if current branch is not "master",
# because we do not deploy changes from other branches
if [ $branch != "master" ]
then
echo "increment is not supported on branch ${branch}"
exit 1;
fi
set -e
set -x
# Fix mixed logs
exec 2>&1
ls -alt
npx lerna@6 run --scope @adguard/css-tokenizer increment
- any-task:
plugin-key: com.atlassian.bamboo.plugins.vcs:task.vcs.commit
configuration:
commitMessage: 'skipci: Automatic increment build number'
selectedRepository: defaultRepository
requirements:
- adg-docker: 'true'

branches:
create: manually
delete: never
link-to-jira: 'true'

labels: [ ]

other:
concurrent-build-plugin: system-default
16 changes: 16 additions & 0 deletions bamboo-specs/css-tokenizer-permissions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
version: 2
deployment:
name: CSS Tokenizer - deploy
deployment-permissions:
- groups:
- extensions-developers
permissions:
- view
environment-permissions:
- npmjs:
- groups:
- extensions-developers
permissions:
- view
- deploy
78 changes: 78 additions & 0 deletions bamboo-specs/css-tokenizer-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
version: 2
plan:
project-key: AJL
key: CSSTOKENIZERTEST
name: CSS Tokenizer - tests
variables:
dockerContainer: adguard/node-ssh:16.17--1

stages:
- Test:
manual: 'false'
final: 'false'
jobs:
- Test

Test:
key: TEST
docker:
image: "${bamboo.dockerContainer}"
volumes:
"${system.YARN_DIR}": "${bamboo.cacheYarn}"
tasks:
- checkout:
force-clean-build: 'true'
- script:
interpreter: SHELL
scripts:
- |-
set -e
set -x
# Fix mixed logs
exec 2>&1
ls -alt
# Bootstrap the package
npx lerna@6 bootstrap --scope @adguard/css-tokenizer --include-dependencies
# Check TypeScript types with TSC
npx lerna@6 run --scope @adguard/css-tokenizer check-types
# ESLint & Markdownlint
npx lerna@6 run --scope @adguard/css-tokenizer lint
# Run tests with Jest
npx lerna@6 run --scope @adguard/css-tokenizer test
# cleanup parent
rm -rf node_modules
# cleanup child packages
npx lerna@6 clean -y
final-tasks:
- clean
requirements:
- adg-docker: 'true'

branches:
create: for-pull-request
delete:
after-deleted-days: '1'
after-inactive-days: '5'
link-to-jira: 'true'

notifications:
- events:
- plan-status-changed
recipients:
- webhook:
name: Build webhook
url: http://prod.jirahub.service.eu.consul/v1/webhook/bamboo

labels: [ ]

other:
concurrent-build-plugin: system-default

0 comments on commit 5623797

Please sign in to comment.