Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #201 from commercetools/github_action
Browse files Browse the repository at this point in the history
Migration to gitHub action
  • Loading branch information
ahalberkamp authored Sep 20, 2021
2 parents df7642e + 288f09b commit 65775c1
Show file tree
Hide file tree
Showing 14 changed files with 125 additions and 198 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: CD

on:
push:
tags:
- '*.*.*'

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Set output
id: vars
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set up JDK 8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build with Gradle
run: ./gradlew clean build
env:
SPRING_APPLICATION_JSON: ${{ secrets.SPRING_APPLICATION_JSON }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: commercetoolsps/commercetools-paypal-plus-integration:${{ steps.vars.outputs.tag }}
26 changes: 26 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle

name: CI

on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: serializing workflow runs
uses: softprops/turnstyle@v1
with:
same-branch-only: false
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 8
- name: Build with Gradle
run: ./gradlew clean build
env:
SPRING_APPLICATION_JSON: ${{ secrets.SPRING_APPLICATION_JSON }}
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ out/
# gradle
gradle.properties
.gradle/
build/
build/
build-settings.sh
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

60 changes: 59 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[![Build Status](https://travis-ci.org/commercetools/commercetools-paypal-plus-integration.svg?branch=master)](https://travis-ci.org/commercetools/commercetools-paypal-plus-integration)

# commercetools _Paypal Plus_ Integration Service

[![CI](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/ci.yml/badge.svg)](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/ci.yml)
[![.github/workflows/cd.yml](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/cd.yml/badge.svg)](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/cd.yml)
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Expand All @@ -13,6 +14,8 @@
- [How to use](#how-to-use)
- [HTTP Responses](#http-responses)
- [Possible edge cases](#possible-edge-cases)
- [How to encrypt/decrypt files](#how-to-encryptdecrypt-files)
- [Build and deploy](#build-and-deploy)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand Down Expand Up @@ -227,3 +230,58 @@ Additionally, response can contain additional response body. All fields of the r

**Possible solution:** the backend has to compare total amount of the payment and total amount of payment's cart before calling `execute/payments` endpoint.
In case of differences, the whole payment process must be restarted.

## How to encrypt/decrypt files

1. Request Professional Services team to add you as an encryptor/decryptor to
`ps-keyring#commercetools-paypal-plus-integration` key.

1. [Install/update `gcloud` client (SDK)](https://cloud.google.com/sdk/gcloud/)

1. Navigate to [`root`](/) directory.

1. Run the following commands to:
- Encrypt `build-settings.sh` file (must be ignored by VCS):

```bash
gcloud kms encrypt \
--project=professionalserviceslabs \
--location=global \
--keyring=ps-keyring \
--key=commercetools-paypal-plus-integration \
--plaintext-file=build-settings.sh \
--ciphertext-file=build-settings.sh.enc
```

- Decrypt `build-settings.sh.enc`:

```bash
gcloud kms decrypt \
--project=professionalserviceslabs \
--location=global \
--keyring=ps-keyring \
--key=commercetools-paypal-plus-integration \
--plaintext-file=build-settings.sh \
--ciphertext-file=build-settings.sh.enc
```

## Build and deploy

- This module is deployed as docker image to dockerhub.

- The build and deployment of the docker are done using github actions.

- On each push to the remote github repository, the github action [ci](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/ci.yml) is triggered, which builds the project and
executes its tests.

- The github action [cd](https://github.com/commercetools/commercetools-paypal-plus-integration/actions/workflows/cd.yml) is used to create the docker-image and deploy it to dockerhub. This action is triggered when a git release tag is
created.

There are two ways to create the release-tag:
- via command line

```bash
git tag -a v1.0.1 -m "Minor text adjustments."
```

- via [Github UI](https://github.com/commercetools/commercetools-paypal-plus-integration/releases)
Binary file added build-settings.sh.enc
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@
@AutoConfigureMockMvc
public class CommercetoolsGetPaymentsControllerIT extends BasePaymentIT {

@BeforeAllMethods
@Override
public void setupBeforeAll() {
super.setupBeforeAll();
}

@AfterAllMethods
@Override
public void tearDownAfterAll() {
Expand All @@ -46,6 +40,7 @@ public void tearDownAfterAll() {
@Before
@Override
public void setUp() {
super.setupBeforeAll();
super.setUp();
}

Expand Down
63 changes: 0 additions & 63 deletions travis-build/TravisBuildConfiguration.md

This file was deleted.

12 changes: 0 additions & 12 deletions travis-build/configuration/.gitignore

This file was deleted.

Binary file not shown.
22 changes: 0 additions & 22 deletions travis-build/crypt-common.sh

This file was deleted.

18 changes: 0 additions & 18 deletions travis-build/decrypt.sh

This file was deleted.

18 changes: 0 additions & 18 deletions travis-build/encrypt.sh

This file was deleted.

14 changes: 0 additions & 14 deletions travis-build/travis-docker-publish.sh

This file was deleted.

0 comments on commit 65775c1

Please sign in to comment.