-
Notifications
You must be signed in to change notification settings - Fork 3
130 lines (124 loc) · 3.64 KB
/
dotnet6.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
name: dotnet6
on:
push:
paths:
- "samples/dotnet6/**"
- ".github/workflows/dotnet6.yml"
- "restarter/**"
schedule:
- cron: '0 7 * * *'
env:
REGISTRY: ghcr.io
IMAGE_NAME: miracl/oidc-samples/samples/dotnet6
DOCKER_BUILD_CONTEXT: samples/dotnet6
SAMPLE_IMAGE: ghcr.io/miracl/oidc-samples/samples/dotnet6:${{ github.sha }}
PROXY_IMAGE: ghcr.io/miracl/oidc-samples/proxy:latest
TESTS_IMAGE: ghcr.io/miracl/oidc-samples/integration-tests:latest
CLIENT_ID: ${{ vars.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
PROJECT_ID: ${{ vars.PROJECT_ID }}
jobs:
lint-dotnet6:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-dotnet@v1
with:
dotnet-version: "6.0"
- name: .NET Core lint
run: dotnet build samples/dotnet6/OidcSample.csproj
build-docker:
needs: lint-dotnet6
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v3
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}
tags: |
type=raw,value=${{ github.sha }}
- uses: docker/build-push-action@v2
with:
context: ${{ env.DOCKER_BUILD_CONTEXT }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
run-integration-tests:
needs: build-docker
runs-on: ubuntu-latest
steps:
- name: Pull images
run: |
docker pull --quiet $SAMPLE_IMAGE
docker pull --quiet $TESTS_IMAGE
- name: Start the sample
run: docker run
--detach
--network host
--publish 8000
--env CLIENT_ID
--env CLIENT_SECRET
$SAMPLE_IMAGE
- name: Sleep for a seconds
run: sleep 1s
shell: bash
- name: Run integration tests
run: docker run
--network host
$TESTS_IMAGE
--client-id $CLIENT_ID
--client-secret $CLIENT_SECRET
--project-id $PROJECT_ID
run-integration-tests-with-proxy:
needs: build-docker
runs-on: ubuntu-latest
steps:
- name: Pull images
run: |
docker pull --quiet $PROXY_IMAGE
docker pull --quiet $SAMPLE_IMAGE
docker pull --quiet $TESTS_IMAGE
- name: Start the proxy
run: docker run
--detach
--network host
--publish 8080
$PROXY_IMAGE
- name: Checkout repository content
uses: actions/checkout@v2
- name: Run the restarter
run: go run ./restarter/main.go &
- name: Start the sample
run: docker run
--detach
--network host
--publish 8080
--name sample
--env CLIENT_ID
--env CLIENT_SECRET
--env PROXY_HOST=127.0.0.1
--env PROXY_PORT=8080
$SAMPLE_IMAGE
- name: Sleep for a seconds
run: sleep 1s
shell: bash
- name: Run integration tests
run: docker run
--network host
$TESTS_IMAGE
--client-id $CLIENT_ID
--client-secret $CLIENT_SECRET
--project-id $PROJECT_ID
--sample-name sample
--proxy-host 127.0.0.1
--proxy-port 8080
--skip-modify-tests false