-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9909026
commit f3ff5fb
Showing
19 changed files
with
406 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# *Name of the PR* | ||
|
||
## :recycle: Current situation | ||
*Describe the current situation (if possible with and exemplary (or real) code snippet and/or where this is used)* | ||
|
||
## :bulb: Proposed solution | ||
*Describe the solution (if possible with and exemplary (or real) code snippet)* | ||
|
||
### Problem that is solved | ||
*Provide a description and link issues that are solved* | ||
|
||
### Implications | ||
*Describe the implications, e.g. refactoring* | ||
|
||
## :heavy_plus_sign: Additional Information | ||
*Provide some additional information if possible* | ||
|
||
### Related PRs | ||
*Reference the related PRs* | ||
|
||
### Testing | ||
*Are there tests included? If yes, which situations are tested and which corner cases are missing?* | ||
|
||
### Reviewer Nudging | ||
*Where should the reviewer start, where is a good entry point?* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
branches: [release] | ||
name-template: '$NEXT_PATCH_VERSION' | ||
tag-template: '$NEXT_PATCH_VERSION' | ||
categories: | ||
- title: '🚀 Features' | ||
labels: | ||
- 'feature' | ||
- 'enhancement' | ||
- title: '🐛 Bug Fixes' | ||
labels: | ||
- 'fix' | ||
- 'bugfix' | ||
- 'bug' | ||
- title: '🧰 Maintenance' | ||
label: 'chore' | ||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)' | ||
template: | | ||
## Changes | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,47 +4,45 @@ on: | |
push: | ||
branches: | ||
- develop | ||
- release | ||
pull_request: | ||
branches: | ||
- develop | ||
- release | ||
|
||
jobs: | ||
linux: | ||
name: Linux ${{ matrix.linux }} ${{ matrix.configuration }} | ||
container: | ||
image: swift:5.3-${{ matrix.linux }} | ||
macoswebservices: | ||
name: macOS | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: maxim-lobanov/[email protected] | ||
with: | ||
xcode-version: latest | ||
- name: Check Xcode version | ||
run: xcodebuild -version | ||
- name: Check Swift version | ||
run: swift --version | ||
- name: Build and test | ||
run: swift test | ||
linuxwebservices: | ||
name: Linux ${{ matrix.linux }} | ||
runs-on: ubuntu-latest | ||
container: | ||
image: swift:${{ matrix.linux }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
linux: [bionic, xenial, focal, amazonlinux2, centos8] | ||
configuration: [debug, release, release_testing] | ||
linux: [focal, bionic, amazonlinux2, centos8] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install libsqlite3, lsof and zsh | ||
- name: Install libsqlite3 | ||
if: ${{ !(startsWith( matrix.linux, 'centos' ) || startsWith( matrix.linux, 'amazonlinux' )) }} | ||
run: apt-get update && apt-get install -y --no-install-recommends libsqlite3-dev lsof zsh | ||
run: apt-get update && apt-get install -y --no-install-recommends libsqlite3-dev | ||
- name: Install libsqlite3 | ||
if: startsWith( matrix.linux, 'amazonlinux' ) | ||
run: yum update -y && yum install -y sqlite-devel lsof zsh | ||
run: yum update -y && yum install -y sqlite-devel | ||
- name: Install libsqlite3 | ||
if: startsWith( matrix.linux, 'centos' ) | ||
run: yum update -y --nobest && yum install -y sqlite-devel lsof zsh | ||
- uses: actions/cache@v2 | ||
with: | ||
path: .build | ||
key: ${{ runner.os }}-${{matrix.linux}}-spm-${{ hashFiles('Package.resolved') }} | ||
run: yum update -y --nobest && yum install -y sqlite-devel | ||
- name: Check Swift version | ||
run: swift --version | ||
|
||
- name: Release Build # Ensuring release build runs successfully without -enable-testing flag | ||
if: matrix.configuration == 'release' | ||
run: swift build -c release | ||
- name: Release Build & Test | ||
if: matrix.configuration == 'release_testing' | ||
run: swift test -c release --enable-test-discovery -Xswiftc -enable-testing -Xswiftc -DRELEASE_TESTING | ||
- name: Debug Build & Test | ||
if: matrix.configuration == 'debug' | ||
run: swift test -c debug --enable-test-discovery | ||
- name: Build and test | ||
run: swift test -Xswiftc -Xfrontend -Xswiftc -sil-verify-none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Build Docker Compose | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
pull_request: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
dockercompose: | ||
name: Docker Compose Build and Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Start containers | ||
run: docker-compose -f docker-compose-development.yml up -d --build | ||
- name: Test web service | ||
run: | | ||
sleep 3 | ||
curl --fail http://localhost/v1/ | ||
- name: Stop containers | ||
if: always() | ||
run: docker-compose down |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: Build Docker Image | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
docker: | ||
name: Docker Build and Push Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Get latest tag | ||
id: latesttag | ||
uses: WyriHaximus/github-action-get-previous-tag@v1 | ||
with: | ||
fallback: latest | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
- name: Set up docker buildx | ||
uses: docker/setup-buildx-action@v1 | ||
with: | ||
install: true | ||
- name: Log in to the container registry | ||
uses: docker/login-action@v1 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Build and push docker image | ||
id: buildandpush | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/apodini/template:latest,ghcr.io/apodini/template:${{ steps.latesttag.outputs.tag }} | ||
- name: Image digest | ||
run: echo ${{ steps.buildandpush.outputs.digest }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Release Drafter | ||
|
||
on: | ||
push: | ||
branches: | ||
- release | ||
|
||
jobs: | ||
update_release_draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- '*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: GH Release | ||
uses: softprops/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
name: SwiftLint | ||
|
||
on: pull_request | ||
on: | ||
pull_request: | ||
paths: | ||
- '.github/workflows/swiftlint.yml' | ||
- '.swiftlint.yml' | ||
- '**/*.swift' | ||
|
||
jobs: | ||
swiftlint: | ||
|
@@ -11,3 +16,5 @@ jobs: | |
uses: norio-nomura/[email protected] | ||
with: | ||
args: --strict | ||
env: | ||
DIFF_BASE: ${{ github.base_ref }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# ================================ | ||
# Build image | ||
# ================================ | ||
FROM swift:5.4-focal as build | ||
|
||
# Install OS updates and, if needed, sqlite3 | ||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ | ||
&& apt-get -q update \ | ||
&& apt-get -q dist-upgrade -y \ | ||
&& apt-get install -y libsqlite3-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Set up a build area | ||
WORKDIR /build | ||
|
||
# Copy all source files | ||
COPY . . | ||
|
||
# Build everything, with optimizations | ||
RUN swift build -Xswiftc -Xfrontend -Xswiftc -sil-verify-none -c release | ||
|
||
# Switch to the staging area | ||
WORKDIR /staging | ||
|
||
# Copy main executable to staging area | ||
RUN cp "$(swift build --package-path /build -c release --show-bin-path)/WebService" ./ | ||
|
||
# Copy resources from the resources directory if the directories exist | ||
# Ensure that by default, neither the directory nor any of its contents are writable. | ||
RUN [ -d "$(swift build --package-path /build -c release --show-bin-path)/Apodini_ApodiniOpenAPI.resources" ] \ | ||
&& mv "$(swift build --package-path /build -c release --show-bin-path)/Apodini_ApodiniOpenAPI.resources" ./ \ | ||
&& chmod -R a-w ./Apodini_ApodiniOpenAPI.resources \ | ||
|| echo No resources to copy | ||
RUN [ -d "$(swift build --package-path /build -c release --show-bin-path)/WebService_ApodiniTemplate.resources" ] \ | ||
&& mv "$(swift build --package-path /build -c release --show-bin-path)/WebService_ApodiniTemplate.resources" ./ \ | ||
&& chmod -R a-w ./WebService_ApodiniTemplate.resources \ | ||
|| echo No resources to copy | ||
|
||
# ================================ | ||
# Run image | ||
# ================================ | ||
FROM swift:5.4-focal-slim | ||
|
||
# Make sure all system packages are up to date. | ||
RUN export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ | ||
&& apt-get -q update \ | ||
&& apt-get -q dist-upgrade -y \ | ||
&& rm -r /var/lib/apt/lists/* | ||
|
||
# Create a apodini user and group with /app as its home directory | ||
RUN useradd --user-group --create-home --system --skel /dev/null --home-dir /app apodini | ||
|
||
# Switch to the new home directory | ||
WORKDIR /app | ||
|
||
# Copy built executable and any staged resources from builder | ||
COPY --from=build --chown=apodini:apodini /staging /app | ||
|
||
# Ensure all further commands run as the apodini user | ||
USER apodini:apodini | ||
|
||
# Start the Apodini service when the image is run. | ||
# The default port is 80. Can be adapted using the `--port` argument | ||
ENTRYPOINT ["./WebService"] |
Oops, something went wrong.