-
Notifications
You must be signed in to change notification settings - Fork 1
158 lines (131 loc) · 4.54 KB
/
ci-cd.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Continuous Integration / Continuous Delivery Workflow for the Parameter Page web application
on:
push:
branches:
- "main"
pull_request:
branches:
- "main"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
Integration-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
test:
- smoke_test
- display_parameter_page_test
- delete_entry_from_page_test
- add_comment_to_page_test
- reorganize_parameters_test
- cancel_page_edits_test
- add_parameter_to_page_test
- clear_all_entries_test
- create_new_parameter_page_test
- change_display_units_test
- display_parameter_alarms_test
- display_digital_status_detail_test
- recall_parameter_page_test
- write_to_parameter_test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: flutter-install-cache
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Install Chrome beta
id: setup-chrome
uses: browser-actions/setup-chrome@v1
with:
chrome-version: beta
- name: Installing chromedriver (needed for Integration tests)
uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: "116.0.5845.49"
- name: Starting chromedriver and executing integration test
run: |
chromedriver --port=4444 &
flutter drive --chrome-binary=${{ steps.setup-chrome.outputs.chrome-path }} --driver=test_driver/integration_test.dart --target=test/integration_tests/${{ matrix.test }}.dart -d web-server --dart-define=USE_MOCK_SERVICES=true
Linter-UnitTest-SmokeTest:
runs-on: ubuntu-latest
steps:
- name: Checking out source code
uses: actions/checkout@v3
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: flutter-install-cache
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Resolving dependencies
run: flutter pub get
- name: Linting
run: flutter analyze .
- name: Running unit tests
run: |
flutter test test/unit_tests
- name: Running widget tests
run: |
flutter test test/widget_tests
Build-Dockerize-Push:
runs-on: ubuntu-latest
needs: [ Linter-UnitTest-SmokeTest, Integration-tests]
steps:
- name: Checking out source code
uses: actions/checkout@v3
- name: Cache Flutter dependencies
uses: actions/cache@v3
with:
path: /opt/hostedtoolcache/flutter
key: flutter-install-cache
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Resolving dependencies
run: flutter pub get
- name: Building web application
run: |
flutter build web
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: adregistry.fnal.gov/applications/parameter-page
tags: |
# This is the default tag for the last commit of the default branch
type=edge
# This is used on a push event and requires a valid semver Git tag
type=semver,pattern={{version}}
# This tags PRs with the PR number. E.g., refs/pull/2/merge -> pr-2
type=ref,event=pr
# This sets the latest tag for default branch
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ github.run_number }},enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to AD Registry, Harbor
uses: docker/login-action@v2
with:
registry: adregistry.fnal.gov
username: ${{ secrets.ADREGISTRY_USERNAME }}
password: ${{ secrets.ADREGISTRY_SECRET }}
- name: Building Docker image and pushing to adregistry
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}