[OP-62] release job (#117)

pull/121/head
Chris Mckay 5 years ago committed by GitHub
parent b021d0edd6
commit 0d3dab84ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      .yarnrc
  2. 12
      Jenkinsfile
  3. 88
      Jenkinsfile.release
  4. 44
      src/containers/Layout/__test__/Initializer.test.tsx

@ -0,0 +1,2 @@
version-tag-prefix v
version-git-message v%s

12
Jenkinsfile vendored

@ -7,7 +7,7 @@ pipeline {
}
stages {
stage('Contracts: Setup') {
stage('Setup') {
steps {
sh 'apk add git python make g++'
}
@ -34,11 +34,11 @@ pipeline {
sh './node_modules/.bin/istanbul report cobertura --root .'
}
}
stage('Dapp: Lint') {
steps {
sh 'yarn run lint:app'
}
}
stage('Dapp: Lint') {
steps {
sh 'yarn run lint:app'
}
}
stage('Dapp: Test') {
steps {
sh 'yarn run test:app:ci'

@ -0,0 +1,88 @@
void tryAddKnownHost(String hostUrl){
// ssh-keygen -F ${hostUrl} will fail (in bash that means status code != 0) if ${hostUrl} is not yet a known host
def statusCode = sh script:"ssh-keygen -F ${hostUrl}", returnStatus:true
if(statusCode != 0){
sh "mkdir -p ~/.ssh"
sh "ssh-keyscan ${hostUrl} >> ~/.ssh/known_hosts"
}
}
pipeline {
agent {
docker { image 'node:10-alpine' }
}
environment {
CI = 'true'
}
parameters {
string(name: 'RELEASE_VERSION', description: '[MANDATORY] The version you are deploying e.g. 1.0.0')
}
stages {
stage('Setup') {
steps {
sh 'apk add git python make g++ libc6-compat zip openssh'
sh 'yarn install'
}
}
stage('Test') {
steps {
sh 'yarn build:contracts'
sh 'yarn test:contracts'
sh 'yarn test:app:ci'
}
}
stage('Bump Version') {
steps {
sshagent(
credentials: ['pegasys-admin-github-ssh-private-key']
) {
withEnv([
'GIT_COMMITTER_NAME="PegaSys Admin"',
'GIT_COMMITTER_EMAIL="admin@pegasys.tech"',
'GIT_AUTHOR_NAME="PegaSys Admin"',
'GIT_AUTHOR_EMAIL="admin@pegasys.tech"'
]) {
sh "yarn version --new-version ${params.RELEASE_VERSION}"
}
}
}
}
stage('Build') {
steps {
sh 'yarn run build'
}
}
stage('Prep bundles') {
steps {
sh "cd build && tar -czvf ../permissioning-smart-contracts-v${params.RELEASE_VERSION}.tar.gz * && cd .."
sh "cd build && zip -r ../permissioning-smart-contracts-v${params.RELEASE_VERSION}.zip * && cd .."
}
}
stage('Create Release') {
steps {
sshagent(
credentials: ['pegasys-admin-github-ssh-private-key']
) {
withEnv([
'GIT_COMMITTER_NAME="PegaSys Admin"',
'GIT_COMMITTER_EMAIL="admin@pegasys.tech"',
'GIT_AUTHOR_NAME="PegaSys Admin"',
'GIT_AUTHOR_EMAIL="admin@pegasys.tech"'
]) {
tryAddKnownHost('github.com')
sh "git push --set-upstream origin master"
sh "git push --tags"
}
}
}
}
}
post {
always {
junit 'test-results/**/*.xml'
junit 'junit.xml'
archiveArtifacts 'permissioning-smart-contracts-v*'
}
}
}

@ -21,10 +21,13 @@ describe('<Initializer />', () => {
let wrapper: ReactWrapper<any, any, any>;
beforeAll(() => {
mocked(useNetwork).mockImplementation(() => ({
networkId: undefined,
isCorrectNetwork: null
}));
mocked(useNetwork).mockImplementation(
() =>
({
networkId: undefined,
isCorrectNetwork: null
} as any)
);
});
beforeEach(() => {
@ -55,10 +58,13 @@ describe('<Initializer />', () => {
describe('isCorrectNetwork=true, networkId=undefined', () => {
beforeAll(() => {
mocked(useNetwork).mockImplementation(() => ({
networkId: undefined,
isCorrectNetwork: undefined
}));
mocked(useNetwork).mockImplementation(
() =>
({
networkId: undefined,
isCorrectNetwork: undefined
} as any)
);
});
it('does not render children when passed in', () => {
@ -80,10 +86,13 @@ describe('<Initializer />', () => {
describe('networkId=0, isCorrectNetwork=false', () => {
beforeAll(() => {
mocked(useNetwork).mockImplementation(() => ({
networkId: 0,
isCorrectNetwork: false
}));
mocked(useNetwork).mockImplementation(
() =>
({
networkId: 0,
isCorrectNetwork: false
} as any)
);
});
it('does not render children when passed in', () => {
@ -105,10 +114,13 @@ describe('<Initializer />', () => {
describe('networkId=0, isCorrectNetwork=true', () => {
beforeAll(() => {
mocked(useNetwork).mockImplementation(() => ({
networkId: 0,
isCorrectNetwork: true
}));
mocked(useNetwork).mockImplementation(
() =>
({
networkId: 0,
isCorrectNetwork: true
} as any)
);
});
it('render children when passed in', () => {

Loading…
Cancel
Save