Skip to content

Commit

Permalink
Switch CI to use pnpm
Browse files Browse the repository at this point in the history
Signed-off-by: Ed Cook <edward@boclips.com>
  • Loading branch information
Adrian Andrzejewski authored and edwardecook committed Sep 27, 2024
1 parent 766ceb5 commit 18301d4
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 141 deletions.
240 changes: 120 additions & 120 deletions pipeline/pipeline.yml
Original file line number Diff line number Diff line change
@@ -1,137 +1,137 @@
---
groups:
- name: all
jobs:
- test
- pre-release
- major
- minor
- release
- name: develop
jobs:
- test
- pre-release
- name: release
jobs:
- major
- minor
- release
- name: all
jobs:
- test
- pre-release
- major
- minor
- release
- name: develop
jobs:
- test
- pre-release
- name: release
jobs:
- major
- minor
- release

jobs:
- name: test
plan:
- get: once-per-weekday
trigger: true
- get: source
trigger: true
- task: test
file: source/pipeline/test.yml
- name: test
plan:
- get: once-per-weekday
trigger: true
- get: source
trigger: true
- task: test
file: source/pipeline/test.yml

- name: pre-release
plan:
- get: source
passed: [test]
trigger: true
- put: version
params:
pre: dev
- task: release
file: source/pipeline/release.yml
- put: npm-registry
params:
version: version/version
path: dist
tag: dev
- put: version
params:
file: version/version
- name: pre-release
plan:
- get: source
passed: [test]
trigger: true
- put: version
params:
pre: dev
- task: release
file: source/pipeline/release.yml
- put: npm-registry
params:
version: version/version
path: dist
tag: dev
- put: version
params:
file: version/version

- name: major
plan:
- put: version
params:
bump: major
- name: major
plan:
- put: version
params:
bump: major

- name: minor
plan:
- put: version
params:
bump: minor
- name: minor
plan:
- put: version
params:
bump: minor

- name: release
plan:
- get: source
passed: [pre-release]
- get: version
params:
bump: final
- task: release
file: source/pipeline/release.yml
- put: npm-registry
params:
version: version/version
path: dist
- in_parallel:
- put: github-release
params:
name: release/name
tag: release/name
body: release/notes
commitish: source/.git/ref
- put: version
params:
bump: patch
- name: release
plan:
- get: source
passed: [pre-release]
- get: version
params:
bump: final
- task: release
file: source/pipeline/release.yml
- put: npm-registry
params:
version: version/version
path: dist
- in_parallel:
- put: github-release
params:
name: release/name
tag: release/name
body: release/notes
commitish: source/.git/ref
- put: version
params:
bump: patch

resources:
- name: source
type: git
source:
branch: main
private_key: ((boclips-player.repo-key))
uri: git@github.com:boclips/boclips-player.git
- name: source
type: git
source:
branch: main
private_key: ((boclips-player.repo-key))
uri: git@github.com:boclips/boclips-player.git

- name: version
type: semver
source:
initial_version: "0.1.0"
driver: git
uri: git@github.com:boclips/versions.git
branch: main
file: boclips-player
private_key: |
((versions.repo-key))
- name: version
type: semver
source:
initial_version: '0.1.0'
driver: git
uri: git@github.com:boclips/versions.git
branch: main
file: boclips-player
private_key: |
((versions.repo-key))
- name: npm-registry
type: npm-resource
source:
package: boclips-player
registry:
token: ((npm.automation-token))
- name: npm-registry
type: npm-resource
source:
package: boclips-player
registry:
token: ((npm.automation-token))

- name: once-per-weekday
type: time
source:
start: 09:30 AM
stop: 06:30 PM
days: [Monday, Tuesday, Wednesday, Thursday, Friday]
location: Europe/London
- name: once-per-weekday
type: time
source:
start: 09:30 AM
stop: 06:30 PM
days: [Monday, Tuesday, Wednesday, Thursday, Friday]
location: Europe/London

- name: github-release
type: github-release
source:
owner: boclips
repository: boclips-player
access_token: ((boclips-player.github-access-token))
- name: github-release
type: github-release
source:
owner: boclips
repository: boclips-player
access_token: ((boclips-player.github-access-token))

resource_types:
- name: npm-resource
type: docker-image
source:
repository: boclipsconcourse/npm-resource
tag: 0.6.0
- name: npm-resource
type: registry-image
source:
repository: boclipsconcourse/npm-resource
tag: 0.6.0

- name: github-release
type: registry-image
source:
repository: concourse/github-release-resource
tag: "1.6.4-ubuntu-20210922"
- name: github-release
type: registry-image
source:
repository: concourse/github-release-resource
tag: '1.6.4-ubuntu-20210922'
17 changes: 11 additions & 6 deletions pipeline/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,22 @@ echo "$release_name" \
> release/name
echo "This is $release_name" \
> release/notes
npm="npm --prefix $app"

if [[ ! ${version} =~ "dev" && -z $(grep -F "## [${version}]" ${app}/CHANGELOG.md) ]]; then
echo "Changelog does not have an entry for this version"
exit 1
fi

$npm ci
$npm run build
$npm version "$version" \
--no-git-tag-version \
--force
corepack enable
corepack prepare pnpm@latest-9 --activate
pnpm config set store-dir ../../../root/.pnpm-store

pushd $app
pnpm install --frozen-lockfile
pnpm run build
pnpm version "$version" \
--no-git-tag-version \
--force
popd

cp -R ${app}/dist/ ${app}/package.json ${app}/README.md dist/
16 changes: 8 additions & 8 deletions pipeline/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@
platform: linux

image_resource:
type: docker-image
type: registry-image
source:
repository: node
tag: '16.16-slim'
tag: '20.17-slim'

inputs:
- name: source
- name: version
- name: source
- name: version

outputs:
- name: dist
- name: release
- name: dist
- name: release

run:
path: source/pipeline/release.sh

caches:
- path: ../../../root/.cache
- path: ../../../root/.npm
- path: ../../../root/.cache
- path: ../../../root/.pnpm-store
10 changes: 7 additions & 3 deletions pipeline/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ set -x -e

app=source
(
corepack enable
corepack prepare pnpm@latest-9 --activate
pnpm config set store-dir ../../../root/.pnpm-store

cd ${app}

npm ci
npm run build
npm run test
pnpm install --frozen-lockfile
pnpm run build
pnpm run test
)
8 changes: 4 additions & 4 deletions pipeline/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
platform: linux

image_resource:
type: docker-image
type: registry-image
source:
repository: node
tag: '16.16-slim'
tag: '20.17-slim'

inputs:
- name: source
- name: source

run:
path: source/pipeline/test.sh

caches:
- path: ../../../root/.cache
- path: ../../../root/.npm
- path: ../../../root/.pnpm-store

0 comments on commit 18301d4

Please sign in to comment.