-
Notifications
You must be signed in to change notification settings - Fork 83
122 lines (114 loc) · 4.2 KB
/
mediator.pr.yml
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
name: CI mediator
on:
push:
branches:
- main
pull_request:
branches:
- "**"
paths:
- 'aries/agents/mediator/**'
env:
DOCKER_BUILDKIT: 1
MAIN_BRANCH: main
RUST_TOOLCHAIN_VERSION: 1.76.0
jobs:
setup-variables:
runs-on: ubuntu-22.04
outputs:
PUBLISH_VERSION: ${{ steps.run-info.outputs.publish-version }}
RELEASE: ${{ steps.run-info.outputs.release }}
PRERELEASE: ${{ steps.run-info.outputs.pre-release }}
BRANCH_NAME: ${{ steps.run-info.outputs.branch-name }}
IS_FORK: ${{ steps.run-info.outputs.is-fork }}
SKIP_CI: ${{ steps.skip-info.outputs.skip-ci }}
steps:
- name: "Git checkout"
uses: actions/checkout@v1
- name: "Construct CI run-info"
id: run-info
uses: ./.github/actions/construct-run-info
- name: "Detect CI skip steps"
id: skip-info
uses: ./.github/actions/detect-skip-info
check-variables:
runs-on: ubuntu-22.04
needs: setup-variables
steps:
- name: "Print outputs"
run: |
echo "PUBLISH_VERSION ${{ needs.setup-variables.outputs.PUBLISH_VERSION }}"
echo "RELEASE ${{ needs.setup-variables.outputs.RELEASE }}"
echo "PRERELEASE ${{ needs.setup-variables.outputs.PRERELEASE }}"
echo "BRANCH_NAME ${{ needs.setup-variables.outputs.BRANCH_NAME }}"
echo "IS_FORK ${{ needs.setup-variables.outputs.IS_FORK }}"
echo "SKIP_CI ${{ needs.setup-variables.outputs.SKIP_CI }}"
test-integration-mediator:
needs: [ setup-variables ]
if: ${{ needs.setup-variables.outputs.SKIP_CI != 'true' }}
runs-on: ubuntu-22.04
services:
mysql:
image: mysql:latest
env:
MYSQL_DATABASE: mediator-persistence.mysql
MYSQL_USER: admin
MYSQL_PASSWORD: github.ci.password.no.prod
MYSQL_ROOT_PASSWORD: github.ci.password.no.prod
ports:
- '3326:3306'
env:
MYSQL_URL: mysql://admin:github.ci.password.no.prod@localhost:3326/mediator-persistence.mysql
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- name: "Setup rust testing environment"
uses: ./.github/actions/setup-testing-rust
with:
rust-toolchain-version: ${{ env.RUST_TOOLCHAIN_VERSION }}
skip-docker-setup: true
skip-vdrproxy-setup: true
- name: Install prerequisites (sqlx)
# uses: Swatinem/rust-cache@v2
run: cargo install sqlx-cli
- name: Setup database
run: DATABASE_URL=${MYSQL_URL} sqlx migrate run --source aries/agents/mediator/migrations
- name: "Run mediator integration tests"
run: cargo run --bin mediator & sleep 5 && cargo test --verbose --package mediator -- --nocapture;
- name: "Collect docker logs on failure"
if: failure()
uses: ./.github/actions/upload-docker-logs
with:
name: "docker-services-${{ github.job }}"
docker-mediator-build:
needs: [ test-integration-mediator, setup-variables ]
if: ${{ needs.setup-variables.outputs.SKIP_CI != 'true' }}
runs-on: ubuntu-22.04
env:
DOCKER_IMAGE: mediator:${{ needs.setup-variables.outputs.BRANCH_NAME }}
outputs:
image-name: ${{ steps.meta.outputs.tags }}
steps:
- name: "Git checkout"
uses: actions/checkout@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Build and cache docker image"
uses: ./.github/actions/build-image
with:
docker-img: ${{ env.DOCKER_IMAGE }}
dockerfile-path: "aries/agents/mediator/Dockerfile"
branch-name: ${{ needs.setup-variables.outputs.BRANCH_NAME }}
branch-main: ${{ env.MAIN_BRANCH }}
docker-repo-local-name: mediator
- name: "Publish versioned docker image"
uses: ./.github/actions/publish-image
with:
docker-img: ${{ env.DOCKER_IMAGE }}
publish-version: ${{ needs.setup-variables.outputs.PUBLISH_VERSION }}
env:
URL_DOCKER_REGISTRY: ghcr.io # Required by .github/actions/publish-image