-
-
Notifications
You must be signed in to change notification settings - Fork 26
105 lines (102 loc) · 3.2 KB
/
requests-by-account.yaml
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
name: requests-by-account
on:
push:
paths:
- 'services/requests-by-account/**'
- 'crates/**'
- 'migrations/schema/*'
branches-ignore:
- 'master'
- 'develop'
jobs:
lint_test:
name: lint test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: linting
run: |
cargo fmt -- --check
cargo clippy -- -Dwarnings
unit_test:
name: unit test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: unit test
run: cargo test
database_test:
name: database test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: test database
run: make -C crates/pg test-db
integration_test:
name: integration test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy, rustfmt
- name: install latest psql client
run: |
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install --yes --no-install-recommends postgresql-client
- name: install golang-migrate
run: |
curl -LO https://github.com/golang-migrate/migrate/releases/download/v4.15.2/migrate.linux-amd64.deb
sudo dpkg -i migrate.linux-amd64.deb
rm migrate.linux-amd64.deb
- name: start services
run: make start
- name: test service integration
run: make -C ./tests test-local
- name: clean up
run: make stop
client_test:
name: client test in local docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: start services
run: make start
- name: e2e test client
run: make -C ./client test-ci
- name: clean up
run: make stop
push_image:
name: push image to dev ecr
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
APP_DIR: services/requests-by-account
needs: [lint_test, unit_test, database_test, integration_test, client_test]
steps:
- uses: actions/checkout@v4
- name: mask values
run: echo "::add-mask::${{ secrets.AWS_ACCOUNT_ID }}"
- name: build image
run: make -C $APP_DIR build-image
- name: tag image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR tag-dev-image
- name: push image
run: ENV_ID=${{ secrets.DEV_ENV_ID }} make -C $APP_DIR push-dev-image