Skip to content
This repository has been archived by the owner on Apr 20, 2024. It is now read-only.

Commit

Permalink
Use Github Actions (#143)
Browse files Browse the repository at this point in the history
* Use Github Actions

* Add workaround for Swift 5.3 bug

* Fix braces

* Include dashboard route

* Don't forget the login controller routes!
  • Loading branch information
siemensikkema authored Oct 24, 2020
1 parent b403683 commit c110aad
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 118 deletions.
67 changes: 0 additions & 67 deletions .circleci/config.yml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: test
on:
pull_request:
push:
branches:
- master
jobs:
macos:
runs-on: macos-latest
env:
DEVELOPER_DIR: /Applications/Xcode_12.app/Contents/Developer
steps:
- uses: actions/checkout@v2
- run: brew install libressl
- run: xcrun swift test --enable-test-discovery --sanitize=thread -Xcxx "-I/usr/local/opt/openssl/include" -Xlinker "-L/usr/local/opt/openssl/lib"
linux-4_2:
runs-on: ubuntu-latest
container:
image: swift:4.2
steps:
- uses: actions/checkout@v2
- run: swift test
linux:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image:
- swift:5.2-focal
- swift:5.3-focal
container: ${{ matrix.image }}
steps:
- uses: actions/checkout@v2
- run: apt-get -qq update && apt-get install -y libssl-dev
- run: swift test --enable-test-discovery --sanitize=thread
91 changes: 40 additions & 51 deletions Sources/AdminPanel/routes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,65 +61,54 @@ public extension Router {
let endpoints = config.endpoints
let controllers = config.controllers

let loginController = controllers.loginController
let dashboardController = controllers.dashboardController
let adminPanelUserController = controllers.adminPanelUserController

// MARK: Login routes

unprotected.get(endpoints.login, use: controllers.loginController.renderLogin)
unprotected.post(endpoints.login, use: controllers.loginController.login)
unprotected.get(endpoints.logout, use: controllers.loginController.logout)
unprotected.get(endpoints.login) { req in
try loginController.renderLogin(req)
}
unprotected.post(endpoints.login) { req in
try loginController.login(req)
}
unprotected.get(endpoints.logout) { req in
try loginController.logout(req)
}

// MARK: Dashboard routes

protected.get(
endpoints.dashboard,
use: controllers.dashboardController.renderDashboard
)
protected.get(endpoints.dashboard) { req in
try dashboardController.renderDashboard(req)
}

// MARK: Admin Panel User routes

protected.get(
endpoints.adminPanelUserBasePath,
use: controllers.adminPanelUserController.renderList
)
protected.get(
endpoints.adminPanelUserBasePath,
endpoints.createSlug,
use: controllers.adminPanelUserController.renderCreate
)
protected.post(
endpoints.adminPanelUserBasePath,
endpoints.createSlug,
use: controllers.adminPanelUserController.create
)
protected.get(
endpoints.adminPanelUserBasePath,
U.parameter,
endpoints.editSlug,
use: controllers.adminPanelUserController.renderEditUser
)
protected.post(
endpoints.adminPanelUserBasePath,
U.parameter,
endpoints.editSlug,
use: controllers.adminPanelUserController.editUser
)
protected.post(
endpoints.adminPanelUserBasePath,
U.parameter,
endpoints.deleteSlug,
use: controllers.adminPanelUserController.delete
)
protected.get(
endpoints.adminPanelUserBasePath,
endpoints.meSlug,
endpoints.editSlug,
use: controllers.adminPanelUserController.renderEditMe
)
protected.post(
endpoints.adminPanelUserBasePath,
endpoints.meSlug,
endpoints.editSlug,
use: controllers.adminPanelUserController.editMe
)
protected.get(endpoints.adminPanelUserBasePath) { req in
try adminPanelUserController.renderList(req)
}
protected.get(endpoints.adminPanelUserBasePath, endpoints.createSlug) { req in
try adminPanelUserController.renderCreate(req)
}
protected.post(endpoints.adminPanelUserBasePath, endpoints.createSlug) { req in
try adminPanelUserController.create(req)
}
protected.get(endpoints.adminPanelUserBasePath, U.parameter, endpoints.editSlug) { req in
try adminPanelUserController.renderEditUser(req)
}
protected.post(endpoints.adminPanelUserBasePath, U.parameter, endpoints.editSlug) { req in
try adminPanelUserController.editUser(req)
}
protected.post(endpoints.adminPanelUserBasePath, U.parameter, endpoints.deleteSlug) { req in
try adminPanelUserController.delete(req)
}
protected.get(endpoints.adminPanelUserBasePath, endpoints.meSlug, endpoints.editSlug) { req in
try adminPanelUserController.renderEditMe(req)
}
protected.post(endpoints.adminPanelUserBasePath, endpoints.meSlug, endpoints.editSlug) { req in
try adminPanelUserController.editMe(req)
}

// MARK: Reset routes

Expand Down

0 comments on commit c110aad

Please sign in to comment.