Skip to content

Commit

Permalink
Add CircleCI support
Browse files Browse the repository at this point in the history
  • Loading branch information
alexisluque committed Jul 23, 2018
1 parent 3925613 commit 6fc5f87
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 7 deletions.
90 changes: 90 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
# Common logic
defaults: &defaults
steps:
- attach_workspace:
at: ~/
- run:
name: Replace Auth0 test credentials
command: |
sed -i 's/{CLIENT_ID}/'$AUTH0_TEST_CLIENT_ID'/g' $AUTH0_CFG
sed -i 's/{DOMAIN}/'$AUTH0_TEST_DOMAIN'/g' $AUTH0_CFG
sed -i 's/{CLIENT_SECRET}/'$AUTH0_TEST_CLIENT_SECRET'/g' $AUTH0_CFG
- run:
name: Build pull request
command: |
docker build -t $CIRCLE_JOB ./$SAMPLE_PATH
docker run -d -p 3000:3000 --name $CIRCLE_SHA1 -e "ASPNETCORE_URLS=http://*:3000" $CIRCLE_JOB
background: true
- run:
name: Wait for app to be available
command: |
sleep 70
docker run --network host --rm appropriate/curl --retry 8 --retry-connrefused -v localhost:3000
- run:
name: Run tests
command: |
docker create --network host --name tester codeception/codeceptjs codeceptjs run-multiple --all --steps
docker cp $(pwd)/lock_login_test.js tester:/tests/lock_login_test.js
docker cp $(pwd)/codecept.conf.js tester:/tests/codecept.conf.js
docker start -i tester
working_directory: scripts
- run:
name: Copy app container logs
command: |
mkdir -p /tmp/out
docker logs $CIRCLE_SHA1 > /tmp/out/app_logs.log
docker cp tester:/tests/out /tmp/
when: on_fail
- store_artifacts:
path: /tmp/out

# Jobs and Workflows
version: 2
jobs:
checkout:
machine: true
steps:
- checkout
- run: git clone -b refactor-for-dotnetcore https://github.com/alexisluque/spa-quickstarts-tests scripts
- persist_to_workspace:
root: ~/
paths:
- project
- scripts
01-login:
machine: true
environment:
- AUTH0_CFG: Quickstart/01-Login/SampleMvcApp/appsettings.json
- SAMPLE_PATH: Quickstart/01-Login
<<: *defaults
02-user-profile:
machine: true
environment:
- AUTH0_CFG: Quickstart/02-User-Profile/SampleMvcApp/appsettings.json
- SAMPLE_PATH: Quickstart/01-Login
<<: *defaults
03-authorization:
machine: true
environment:
- AUTH0_CFG: Quickstart/03-Authorization/SampleMvcApp/appsettings.json
- SAMPLE_PATH: Quickstart/03-Authorization
<<: *defaults

workflows:
version: 2
quickstarts_login:
jobs:
- checkout:
context: Quickstart Web App Test
- 01-login:
context: Quickstart Web App Test
requires:
- checkout
- 02-user-profile:
context: Quickstart Web App Test
requires:
- checkout
- 03-authorization:
context: Quickstart Web App Test
requires:
- checkout
4 changes: 2 additions & 2 deletions Quickstart/01-Login/SampleMvcApp/Views/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
<ul class="nav navbar-nav navbar-right">
@if (User.Identity.IsAuthenticated)
{
<li><a asp-controller="Account" asp-action="Logout">Logout</a></li>
<li><a id="qsLogoutBtn" asp-controller="Account" asp-action="Logout">Logout</a></li>
}
else
{
<li><a asp-controller="Account" asp-action="Login">Login</a></li>
<li><a id="qsLoginBtn" asp-controller="Account" asp-action="Login">Login</a></li>
}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@
@if (User.Identity.IsAuthenticated)
{
<li><a asp-controller="Account" asp-action="Profile">Hello @User.Identity.Name!</a></li>
<li><a asp-controller="Account" asp-action="Logout">Logout</a></li>
<li><a id="qsLogoutBtn" asp-controller="Account" asp-action="Logout">Logout</a></li>
}
else
{
<li><a asp-controller="Account" asp-action="Login">Login</a></li>
<li><a id="qsLoginBtn" asp-controller="Account" asp-action="Login">Login</a></li>
}
</ul>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
@if (User.Identity.IsAuthenticated)
{
<li><a asp-controller="Account" asp-action="Profile">Hello @User.Identity.Name!</a></li>
<li><a asp-controller="Account" asp-action="Logout">Logout</a></li>
<li><a id="qsLogoutBtn" asp-controller="Account" asp-action="Logout">Logout</a></li>
}
else
{
<li><a asp-controller="Account" asp-action="Login">Login</a></li>
<li><a id="qsLoginBtn" asp-controller="Account" asp-action="Login">Login</a></li>
}
</ul>
</div>
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Auth0 ASP.NET Core MVC Samples

[![CircleCI](https://circleci.com/gh/auth0-samples/auth0-aspnetcore-mvc-samples.svg?style=svg)](https://circleci.com/gh/auth0-samples/auth0-aspnetcore-mvc-samples)

This repository contains all the samples for the [Auth0 ASP.NET Core MVC Quickstart](https://auth0.com/docs/quickstart/webapp/aspnet-core), as well as other samples demonstrating some specific use cases.

Please refer to the README files in the individual folders for more information.
Please refer to the README files in the individual folders for more information.

0 comments on commit 6fc5f87

Please sign in to comment.