Skip to content

Commit f4aa5c3

Browse files
Update App to iOS 15 and WebService to Apodini 0.3.0 (#2)
* Update App to iOS 15 and WebService to Apodini 0.3.0 * Improve Docker Compose files and add a Docker GitHub Action
1 parent fd80e59 commit f4aa5c3

34 files changed

Lines changed: 471 additions & 604 deletions

.github/pull_request_template.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# *Name of the PR*
2+
3+
## :recycle: Current situation
4+
*Describe the current situation (if possible with and exemplary (or real) code snippet and/or where this is used)*
5+
6+
## :bulb: Proposed solution
7+
*Describe the solution (if possible with and exemplary (or real) code snippet)*
8+
9+
### Problem that is solved
10+
*Provide a description and link issues that are solved*
11+
12+
### Implications
13+
*Describe the implications, e.g. refactoring*
14+
15+
## :heavy_plus_sign: Additional Information
16+
*Provide some additional information if possible*
17+
18+
### Related PRs
19+
*Reference the related PRs*
20+
21+
### Testing
22+
*Are there tests included? If yes, which situations are tested and which corner cases are missing?*
23+
24+
### Reviewer Nudging
25+
*Where should the reviewer start, where is a good entry point?*

.github/release-drafter.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
branches: [release]
2+
name-template: '$NEXT_PATCH_VERSION'
3+
tag-template: '$NEXT_PATCH_VERSION'
4+
categories:
5+
- title: '🚀 Features'
6+
labels:
7+
- 'feature'
8+
- 'enhancement'
9+
- title: '🐛 Bug Fixes'
10+
labels:
11+
- 'fix'
12+
- 'bugfix'
13+
- 'bug'
14+
- title: '🧰 Maintenance'
15+
label: 'chore'
16+
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
17+
template: |
18+
## Changes
19+
20+
$CHANGES

.github/workflows/build-and-test.yml

Lines changed: 58 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,68 @@ on:
44
push:
55
branches:
66
- develop
7-
- release
87
pull_request:
98
branches:
109
- develop
11-
- release
1210

1311
jobs:
14-
docker:
15-
name: Docker compose Build and Test
12+
macosclient:
13+
name: macOS Client
14+
runs-on: macos-11
15+
defaults:
16+
run:
17+
working-directory: ./App
18+
steps:
19+
- uses: actions/checkout@v2
20+
- uses: maxim-lobanov/setup-xcode@v1.1
21+
with:
22+
xcode-version: latest
23+
- name: Check Xcode version
24+
run: xcodebuild -version
25+
- name: Check Swift version
26+
run: swift --version
27+
- name: Build and test
28+
run: xcodebuild test -scheme App -destination 'platform=iOS Simulator,OS=15.0,name=iPhone 12'
29+
macoswebservices:
30+
name: macOS WebService
31+
runs-on: macos-11
32+
defaults:
33+
run:
34+
working-directory: ./WebService
35+
steps:
36+
- uses: actions/checkout@v2
37+
- uses: maxim-lobanov/setup-xcode@v1.1
38+
with:
39+
xcode-version: latest
40+
- name: Check Xcode version
41+
run: xcodebuild -version
42+
- name: Check Swift version
43+
run: swift --version
44+
- name: Build and test
45+
run: swift test
46+
linuxwebservices:
47+
name: Linux WebService ${{ matrix.linux }}
1648
runs-on: ubuntu-latest
17-
49+
container:
50+
image: swift:${{ matrix.linux }}
51+
strategy:
52+
matrix:
53+
linux: [latest, focal, amazonlinux2, centos8]
54+
defaults:
55+
run:
56+
working-directory: ./WebService
1857
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v2
21-
22-
- name: Start containers
23-
run: docker-compose up -d --build
24-
25-
- name: Test WebService and Traefik
26-
run: sleep 3 && curl -sSf http://localhost:80/v1/contacts && curl -sSf http://localhost:8080/dashboard/#/
27-
28-
- name: Stop containers
29-
if: always()
30-
run: docker-compose down
58+
- uses: actions/checkout@v2
59+
- name: Install libsqlite3
60+
if: ${{ !(startsWith( matrix.linux, 'centos' ) || startsWith( matrix.linux, 'amazonlinux' )) }}
61+
run: apt-get update && apt-get install -y --no-install-recommends libsqlite3-dev
62+
- name: Install libsqlite3
63+
if: startsWith( matrix.linux, 'amazonlinux' )
64+
run: yum update -y && yum install -y sqlite-devel
65+
- name: Install libsqlite3
66+
if: startsWith( matrix.linux, 'centos' )
67+
run: yum update -y --nobest && yum install -y sqlite-devel
68+
- name: Check Swift version
69+
run: swift --version
70+
- name: Build and test
71+
run: swift test -Xswiftc -Xfrontend -Xswiftc -sil-verify-none
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Build Docker Compose
2+
3+
on:
4+
push:
5+
branches:
6+
- develop
7+
pull_request:
8+
branches:
9+
- develop
10+
11+
jobs:
12+
dockercompose:
13+
name: Docker Compose Build and Test
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v2
18+
- name: Start containers
19+
run: docker-compose up -d --build
20+
- name: Test Gatway web service
21+
run: |
22+
sleep 3
23+
curl --fail http://localhost/v1/contacts
24+
- name: Stop containers
25+
if: always()
26+
run: docker-compose down

.github/workflows/docker.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
docker:
10+
name: Docker Build and Push Image
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v2
15+
- name: Get latest tag
16+
id: latesttag
17+
uses: WyriHaximus/github-action-get-previous-tag@v1
18+
with:
19+
fallback: latest
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v1
22+
- name: Set up docker buildx
23+
uses: docker/setup-buildx-action@v1
24+
with:
25+
install: true
26+
- name: Log in to the container registry
27+
uses: docker/login-action@v1
28+
with:
29+
registry: ghcr.io
30+
username: ${{ github.actor }}
31+
password: ${{ secrets.GITHUB_TOKEN }}
32+
- name: Build and push docker image
33+
id: buildandpush
34+
uses: docker/build-push-action@v2
35+
with:
36+
context: .
37+
file: ./WebService/Dockerfile
38+
push: true
39+
tags: ghcr.io/apodini/examplewebservice:latest,ghcr.io/apodini/examplewebservice:${{ steps.latesttag.outputs.tag }}
40+
- name: Image digest
41+
run: echo ${{ steps.buildandpush.outputs.digest }}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Release Drafter
2+
3+
on:
4+
push:
5+
branches:
6+
- release
7+
8+
jobs:
9+
update_release_draft:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: release-drafter/release-drafter@v5
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*.*.*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: GH Release
13+
uses: softprops/action-gh-release@v0.1.5
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }}

.github/workflows/swiftlint.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
name: SwiftLint
22

3-
on: pull_request
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/workflows/swiftlint.yml'
7+
- '.swiftlint.yml'
8+
- '**/*.swift'
49

510
jobs:
611
swiftlint:
712
runs-on: ubuntu-latest
813
steps:
914
- uses: actions/checkout@v1
1015
- name: GitHub Action for SwiftLint
11-
uses: norio-nomura/action-swiftlint@3.2.1
16+
uses: norio-nomura/action-swiftlint@3.1.0
1217
with:
1318
args: --strict
1419
env:
15-
WORKING_DIRECTORY: WebService
20+
DIFF_BASE: ${{ github.base_ref }}
21+

.swiftlint.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ only_rules:
165165
- multiline_parameters
166166
# Functions and methods parameters should be either on the same line, or one per line.
167167
- nesting
168-
# Types and functions should only be nested to a certain level deep.
168+
# Types and statements should only be nested to a certain level deep.
169169
# See nesting below for the exact configuration.
170170
- nimble_operator
171171
# Prefer Nimble operator overloads over free matcher functions.
@@ -309,7 +309,7 @@ only_rules:
309309
# Don’t include vertical whitespace (empty line) after opening braces.
310310
- void_return
311311
# Prefer -> Void over -> ().
312-
# - weak_delegate (we don't really use the delegate pattern anywhere and the name-collision with our own 'Delegate' is annoying)
312+
- weak_delegate
313313
# Delegates should be weak to avoid reference cycles.
314314
- xctfail_message
315315
# An XCTFail call should include a description of the assertion.
@@ -346,10 +346,6 @@ identifier_name:
346346
- id
347347
- ok
348348
- or
349-
- p8
350-
- of
351-
- s3
352-
- at
353349

354350
large_tuple: # Tuples shouldn't have too many members. Create a custom type instead.
355351
- 2 # warning - default: 2
@@ -363,10 +359,10 @@ line_length: # Lines should not span too many characters.
363359
ignores_function_declarations: false # default: false
364360
ignores_interpolated_strings: true # default: false
365361

366-
nesting: # Types should be nested at most 2 level deep, and functions should be nested at most 5 levels deep.
362+
nesting: # Types should be nested at most 2 level deep, and statements should be nested at most 5 levels deep.
367363
type_level:
368364
warning: 2 # warning - default: 1
369-
function_level:
365+
statement_level:
370366
warning: 5 # warning - default: 5
371367

372368
trailing_closure:
@@ -388,4 +384,4 @@ unused_optional_binding:
388384
ignore_optional_try: true
389385

390386
vertical_whitespace: # Limit vertical whitespace to a single empty line.
391-
max_empty_lines: 2 # warning - default: 1
387+
max_empty_lines: 2 # warning - default: 1

0 commit comments

Comments
 (0)