Repository navigation
130 lines (110 loc) · 4.02 KB
/
Copy pathmaven_docker.yml
File metadata and controls
130 lines (110 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
name: Java CICD with push to ecs
on:
push:
branches:
- master
- 'release-**'
jobs:
# Wait for up to a minute for previous run to complete, abort if not done by then
pre-ci:
runs-on: ubuntu-latest
timeout-minutes: 100
outputs:
diff: ${{ steps.git-diff.outputs.diff }}
steps:
- name: 'Block Concurrent Executions'
uses: softprops/turnstyle@v1
with:
poll-interval-seconds: 60
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- uses: actions/checkout@v2
# Get source code diff
- uses: technote-space/get-diff-action@v4
id: git-diff
with:
PATTERNS: |
src/**/*.+(java|yml|xml)
FILES:
pom.xml
build:
needs: pre-ci
# Run only if there are differences in the source code
if: needs.pre-ci.outputs.diff
runs-on: ubuntu-latest
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:12
# Provide the password for postgres
env:
POSTGRES_PASSWORD: harvest
POSTGRES_USER: harvest
POSTGRES_DB: harvest
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.11
uses: actions/setup-java@v1
with:
java-version: 1.11
- name: Build with Maven
run: >
mvn
-Dethparser.eth.web3Url="${{secrets.ETH_WEB3}}"
-Dethparser.bsc.web3Url="${{secrets.BSC_WEB3}}"
-Dethparser.eth.abiProviderKey=${{secrets.ETHERSCAN_TOKEN}}
-Dethparser.bsc.abiProviderKey=${{secrets.BSCSCAN_TOKEN}}
-Dspring.datasource.url=jdbc:postgresql://localhost:5432/harvest
-Dspring.datasource.username=harvest
-Dspring.datasource.password=harvest
-B package -ff -T 1 --file pom.xml
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v1
if: always()
with:
files: target/surefire-reports/**/*.xml
- name: Publish report to codecov
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
directory: target/site/jacoco/ # optional
name: codecov-ethparser # optional
fail_ci_if_error: true # optional (default = false)
verbose: true # optional (default = false)
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF##*/})"
id: extract_branch
- name: Get short SHA
id: sha
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-west-1
- name: Build and Push to ECR public
id: build-and-push
uses: pahud/ecr-public-action@8cd826db40befb59b0cd0b60b22a7ba72d06a7f7
with:
tags: |
public.ecr.aws/q3j2h8t6/ethparser:${{ steps.extract_branch.outputs.branch }}-${{ steps.sha.outputs.sha7 }}
- name: Prepare note to server
uses: hughcube/deploy-action@1.0.0
with:
ssh_private_key: ${{ secrets.SSH_KEY }}
- name: Note image tag
run: |
ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} 'echo "$(date +"%Y-%m-%d %H:%M") ${{ steps.extract_branch.outputs.branch }}-${{ steps.sha.outputs.sha7 }}" >> images.txt'