-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
251 additions
and
214 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
name: Pip.Services AWS Node.js Delivery | ||
|
||
# Configure trigger rules | ||
on: | ||
push: | ||
paths: | ||
- '**' | ||
- '!README.md' | ||
|
||
jobs: | ||
# Setup job | ||
setup: | ||
runs-on: ubuntu-20.04 | ||
if: "!contains(github.event.head_commit.message, '[skip-ci]')" | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@main | ||
|
||
- name: Pull delivery scripts | ||
shell: bash | ||
run: | | ||
rm -rf script-delivery-ps | ||
git clone ${{ secrets.SCRIPTS_DELIVERY_PS_GIT_URL }} script-delivery-ps | ||
- name: Execute increment script | ||
shell: bash | ||
run: ./script-delivery-ps/setup/increment/increment.ps1 | ||
|
||
- name: Execute prerequisites script | ||
shell: bash | ||
run: ./script-delivery-ps/setup/prereqs/prereqs.ps1 | ||
|
||
- name: Cache intermediate data | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
script-delivery-ps | ||
component*.json | ||
key: delivery-${{ github.run_id }}-${{ github.run_attempt }} | ||
|
||
# Authoring job | ||
authoring: | ||
needs: setup | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@main | ||
|
||
- name: Get cached intermediate data | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
script-delivery-ps | ||
component*.json | ||
key: delivery-${{ github.run_id }}-${{ github.run_attempt }} | ||
|
||
- name: Execute build script | ||
shell: bash | ||
run: script-delivery-ps/authoring/build/build.ps1 | ||
|
||
- name: Execute test script | ||
shell: bash | ||
run: ./script-delivery-ps/authoring/test/test.ps1 | ||
|
||
- name: Execute package script | ||
shell: bash | ||
run: ./script-delivery-ps/authoring/package/package.ps1 | ||
|
||
- name: Execute publish script | ||
shell: bash | ||
run: ./script-delivery-ps/authoring/publish/publish.ps1 | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Execute tag script | ||
shell: bash | ||
run: ./script-delivery-ps/authoring/tag/tag.ps1 | ||
|
||
- name: Execute clean script | ||
if: always() | ||
shell: bash | ||
run: ./script-delivery-ps/authoring/clean/clean.ps1 | ||
|
||
# Measure job | ||
measure: | ||
needs: authoring | ||
if: always() | ||
runs-on: ubuntu-20.04 | ||
|
||
steps: | ||
- name: Get cached intermediate data | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
script-delivery-ps | ||
component*.json | ||
key: delivery-${{ github.run_id }}-${{ github.run_attempt }} | ||
|
||
- name: Execute measure script | ||
env: | ||
name: $(echo '${{ github.repository }}' | awk -F '/' '{print $2}') | ||
run: ./script-delivery-ps/measure/measure.ps1 ${{ github.repository_owner }} ${{ env.name }} ${{ secrets.AWS_ACCESS_KEY_ID }} ${{ secrets.AWS_SECRET_ACCESS_KEY }} ${{ secrets.AWS_S3_BUCKET }} ${{ secrets.GITHUB_TOKEN }} | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,32 @@ | ||
#!/usr/bin/env pwsh | ||
|
||
# Get component data and set necessary variables | ||
$component = Get-Content -Path "component.json" | ConvertFrom-Json | ||
$buildImage="$($component.registry)/$($component.name):$($component.version)-$($component.build)-build" | ||
$docsImage="$($component.registry)/$($component.name):$($component.version)-$($component.build)-docs" | ||
$testImage="$($component.registry)/$($component.name):$($component.version)-$($component.build)-test" | ||
|
||
# Clean up build directories | ||
Get-ChildItem -Path "." -Include "obj" -Recurse | foreach($_) { Remove-Item -Force -Recurse $_.FullName } | ||
Get-ChildItem -Path "." -Include "node_modules" -Recurse | foreach($_) { Remove-Item -Force -Recurse $_.FullName } | ||
# Recreate image names using the data in the "$PSScriptRoot/component.json" file | ||
$component = Get-Content -Path "$PSScriptRoot/component.json" | ConvertFrom-Json | ||
$buildImage = "$($component.registry)/$($component.name):$($component.version)-$($component.build)-build" | ||
$testImage = "$($component.registry)/$($component.name):$($component.version)-$($component.build)-test" | ||
$docsImage = "$($component.registry)/$($component.name):$($component.version)-$($component.build)-docs" | ||
|
||
# Remove docker images | ||
docker rmi $buildImage --force | ||
docker rmi $docsImage --force | ||
docker rmi $testImage --force | ||
docker image prune --force | ||
docker rmi -f $(docker images -f "dangling=true" -q) # remove build container if build fails | ||
docker image prune --force | ||
|
||
# Remove existed containers | ||
$exitedContainers = docker ps -a | Select-String -Pattern "Exit" | ||
foreach($c in $exitedContainers) { docker rm $c.ToString().Split(" ")[0] } | ||
|
||
# Remove unused volumes | ||
docker volume rm -f $(docker volume ls -f "dangling=true") | ||
|
||
# Clean up build directories | ||
if (Test-Path -Path "$PSScriptRoot/obj") { | ||
Remove-Item -Recurse -Force "$PSScriptRoot/obj" | ||
} | ||
if (Test-Path -Path "$PSScriptRoot/node_modules") { | ||
Remove-Item -Recurse -Force "$PSScriptRoot/node_modules" | ||
} | ||
if (Test-Path -Path "$PSScriptRoot/package-lock.json") { | ||
Remove-Item -Recurse -Force "$PSScriptRoot/package-lock.json" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
{ | ||
"name": "pip-services3-aws-node", | ||
"registry": "pipdevs", | ||
"name": "pip-services3-aws-node", | ||
"type": "microservice", | ||
"language": "node", | ||
"version": "3.1.0", | ||
"build": "0" | ||
"build": 0, | ||
"registry": "pipdevs", | ||
"artifacts": [ | ||
{ | ||
"name": "<name>", | ||
"type": "npm" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,30 @@ | ||
FROM node:8 | ||
FROM node:14 | ||
|
||
# Copy npm config | ||
COPY docker/.npmrc /root/.npmrc | ||
|
||
# Copy local ssh keys | ||
COPY docker/id_rsa /root/.ssh/ | ||
|
||
# Setup ssh access to git repositories | ||
RUN chmod 600 /root/.ssh/id_rsa* \ | ||
&& ssh-keyscan github.com >> ~/.ssh/known_hosts \ | ||
&& ssh-keyscan gitlab.com >> ~/.ssh/known_hosts | ||
|
||
# Set working directory | ||
WORKDIR /app | ||
|
||
# Install development tools | ||
RUN npm install typescript -g | ||
|
||
# set working directory | ||
WORKDIR /app | ||
# copy project file | ||
# Copy project file | ||
COPY package.json . | ||
# install ALL node_modules, including 'devDependencies' | ||
|
||
# Install ALL node_modules, including 'devDependencies' | ||
RUN npm install | ||
|
||
# copy all project | ||
# Copy entire project | ||
COPY . . | ||
|
||
# compile source code | ||
# Compile source in typescript | ||
RUN tsc |
Oops, something went wrong.