-
Notifications
You must be signed in to change notification settings - Fork 3
144 lines (132 loc) · 6.39 KB
/
test_deploy_samplesite.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Run unit and ui tests, deploy samplesite
on:
workflow_run:
workflows: ["Dev", "Uat"]
types:
- completed
env:
dotnetVersion: |
6.x
7.x
8.x
jobs:
test-unit-ui:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
environment: ${{ github.event.workflow_run.name }}
env:
uitestUrlSubdomain: uitest-${{ github.event.workflow_run.id }}-svea-webpay-sdk
outputs:
sourceHeadRepo: ${{ steps.source-run-info.outputs.sourceHeadRepo }}
sourceHeadBranch: ${{ steps.source-run-info.outputs.sourceHeadBranch }}
sourceHeadSha: ${{ steps.source-run-info.outputs.sourceHeadSha }}
mergeCommitSha: ${{ steps.source-run-info.outputs.mergeCommitSha }}
targetCommitSha: ${{ steps.source-run-info.outputs.targetCommitSha }}
pullRequestNumber: ${{ steps.source-run-info.outputs.pullRequestNumber }}
pullRequestLabels: ${{ steps.source-run-info.outputs.pullRequestLabels }}
targetBranch: ${{ steps.source-run-info.outputs.targetBranch }}
sourceEvent: ${{ steps.source-run-info.outputs.sourceEvent }}
steps:
- name: "Get information about the origin 'CI' run"
uses: potiuk/get-workflow-origin@v1_1
id: source-run-info
with:
token: ${{ secrets.GITHUB_TOKEN }}
sourceRunId: ${{ github.event.workflow_run.id }}
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
- name: Variable Substitution
uses: microsoft/variable-substitution@v1
with:
# comma separated list of XML/JSON/YAML files in which tokens are to be substituted. Files names must be specified relative to the folder-path.
files: 'Sample.AspNetCore/ngrok.yml'
env:
authtoken: ${{ secrets.NGROK_AUTHTOKEN }}
tunnels.uitestGithub.subdomain: ${{ env.uitestUrlSubdomain }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.dotnetVersion }}
- name: Run Unit Tests
run: dotnet test Sdk.UnitTests/Svea.WebPay.SDK.Tests.dll
env:
Credentials:0:MerchantId: ${{ secrets.SWEDEN_MERCHANT_ID}}
Credentials:0:Secret: ${{ secrets.SWEDEN_MERCHANT_SECRET }}
Credentials:1:MerchantId: ${{ secrets.NORWAY_MERCHANT_ID}}
Credentials:1:Secret: ${{ secrets.NORWAY_MERCHANT_SECRET }}
Credentials:2:MerchantId: ${{ secrets.FINNISH_MERCHANT_ID }}
Credentials:2:Secret: ${{ secrets.FINNISH_MERCHANT_SECRET }}
# - name: Setup ngrok
# run: |
# wget https://bin.equinox.io/c/4VmDzA7iaHb/ngrok-stable-linux-amd64.zip
# jar xvf ngrok-stable-linux-amd64.zip
# chmod +x ngrok
#
# - name: Start ngrok
# run: ./ngrok start -config Sample.AspNetCore/ngrok.yml uitestGithub &
#
# - name: Start SDK Sample project
# working-directory: Sample.AspNetCore
# run:
# dotnet Sample.AspNetCore.dll &
# env:
# Credentials:0:MerchantId: ${{ secrets.SWEDEN_MERCHANT_ID}}
# Credentials:0:Secret: ${{ secrets.SWEDEN_MERCHANT_SECRET }}
# Credentials:1:MerchantId: ${{ secrets.NORWAY_MERCHANT_ID}}
# Credentials:1:Secret: ${{ secrets.NORWAY_MERCHANT_SECRET }}
# Credentials:2:MerchantId: ${{ secrets.FINNISH_MERCHANT_ID }}
# Credentials:2:Secret: ${{ secrets.FINNISH_MERCHANT_SECRET }}
# MerchantSettings:PushUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/api/svea/push/{checkout.order.uri}/?marketId={marketId}
# MerchantSettings:TermsUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/terms
# MerchantSettings:CheckoutUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/CheckOut/LoadPaymentMenu
# MerchantSettings:ConfirmationUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/checkout/thankyou
# MerchantSettings:CheckoutValidationCallbackUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/api/svea/validation/{checkout.order.uri}/?marketId={marketId}
# MerchantSettings:WebhookUri: https://${{ env.uitestUrlSubdomain }}.eu.ngrok.io/api/svea/shippingvalidation/?marketId={marketId}
#
# - name: Run SDK UI tests
# run: dotnet test Sample.AspNetCore.SystemTests/Sample.AspNetCore.SystemTests.dll
# env:
# Credentials:0:MerchantId: ${{ secrets.SWEDEN_MERCHANT_ID}}
# Credentials:0:Secret: ${{ secrets.SWEDEN_MERCHANT_SECRET }}
# Credentials:1:MerchantId: ${{ secrets.NORWAY_MERCHANT_ID}}
# Credentials:1:Secret: ${{ secrets.NORWAY_MERCHANT_SECRET }}
# Credentials:2:MerchantId: ${{ secrets.FINNISH_MERCHANT_ID }}
# Credentials:2:Secret: ${{ secrets.FINNISH_MERCHANT_SECRET }}
# SampleWebsite:Url: https://localhost:5001
- name: Commit Action Status
if: ${{ always() }}
uses: LouisBrunner/checks-action@v2.0.0
with:
sha: ${{ steps.source-run-info.outputs.sourceHeadSha }}
token: ${{ secrets.GITHUB_TOKEN }}
name: Run Unit and UI tests
conclusion: ${{ job.status }}
publish_alpha_nuget:
needs: [test-unit-ui]
if: ${{ needs.test-unit-ui.outputs.sourceEvent != 'pull_request' && github.event.workflow_run.name == 'Dev' }}
name: Publish alpha nuget
runs-on: ubuntu-latest
environment: ${{ github.event.workflow_run.name }}
steps:
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@v3
with:
workflow_conclusion: success
run_id: ${{ github.event.workflow_run.id }}
name: packages
path: packages
- name: Publish test package to GitHub Package Registry
run: dotnet nuget push "packages/*.nupkg" --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/sveawebpay/index.json --skip-duplicate
publish_sample_site:
needs: [test-unit-ui]
if: ${{ needs.test-unit-ui.outputs.sourceEvent != 'pull_request' }}
uses: ./.github/workflows/template_publish_webapp.yml
secrets: inherit
with:
Environment: ${{ github.event.workflow_run.name }}
WorkflowRunId: ${{ github.event.workflow_run.id }}