diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..8a5d623 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,65 @@ +version: 2 + +defaults: &defaults + working_directory: "/opt/dotnet/project" + docker: + - image: blockmason/dotnet:2.2 + +workflows: + version: 2 + default: + jobs: + - build-sources: + requires: + - initialize + - build-tests: + requires: + - build-sources + - initialize + - test: + requires: + - build-tests + +jobs: + initialize: + <<: *defaults + steps: + - checkout + - persist_to_workspace: + root: /opt/dotnet + paths: + - project + build-sources: + <<: *defaults + steps: + - attach_workspace: + at: /opt/dotnet + - run: + name: Building sources + command: dotnet publish --configuration Release Link/Link.csproj + - persist_to_workspace: + root: /opt/dotnet + paths: + - project/Link/obj + - project/Link/bin + build-tests: + <<: *defaults + steps: + - attach_workspace: + at: /opt/dotnet + - run: + name: Building tests + command: dotnet publish --configuration Release Link.Tests/Link.Tests.csproj + - persist_to_workspace: + root: /opt/dotnet + paths: + - project/Link.Tests/obj + - project/Link.Tests/bin + test: + <<: *defaults + steps: + - attach_workspace: + at: /opt/dotnet + - run: + name: Testing + command: dotnet test --configuration Release Link.Tests/Link.Tests.csproj diff --git a/.gitignore b/Blockmason.Link.Tests/.gitignore similarity index 100% rename from .gitignore rename to Blockmason.Link.Tests/.gitignore diff --git a/Link.Tests/Link.Tests.csproj b/Blockmason.Link.Tests/Blockmason.Link.Tests.csproj similarity index 84% rename from Link.Tests/Link.Tests.csproj rename to Blockmason.Link.Tests/Blockmason.Link.Tests.csproj index ae234b1..f23af5d 100644 --- a/Link.Tests/Link.Tests.csproj +++ b/Blockmason.Link.Tests/Blockmason.Link.Tests.csproj @@ -8,6 +8,6 @@ - + diff --git a/Link.Tests/Project_HappyPath.cs b/Blockmason.Link.Tests/Project_HappyPath.cs similarity index 96% rename from Link.Tests/Project_HappyPath.cs rename to Blockmason.Link.Tests/Project_HappyPath.cs index 846139f..1f52f2a 100644 --- a/Link.Tests/Project_HappyPath.cs +++ b/Blockmason.Link.Tests/Project_HappyPath.cs @@ -1,5 +1,5 @@ using Xunit; -using Link; +using Blockmason.Link; using System.Collections.Generic; namespace Link.UnitTests { diff --git a/Link.sln b/Blockmason.Link.sln similarity index 100% rename from Link.sln rename to Blockmason.Link.sln diff --git a/Blockmason.Link/.gitignore b/Blockmason.Link/.gitignore new file mode 100644 index 0000000..f255020 --- /dev/null +++ b/Blockmason.Link/.gitignore @@ -0,0 +1,5 @@ +# Generated by `dotnet build` +/bin/ + +# Generated by `dotnet build` +/obj/ diff --git a/Link/Link.csproj b/Blockmason.Link/Blockmason.Link.csproj similarity index 100% rename from Link/Link.csproj rename to Blockmason.Link/Blockmason.Link.csproj diff --git a/Link/OAuth2/Credential.cs b/Blockmason.Link/OAuth2/Credential.cs similarity index 98% rename from Link/OAuth2/Credential.cs rename to Blockmason.Link/OAuth2/Credential.cs index 8a22d0b..6a1928b 100644 --- a/Link/OAuth2/Credential.cs +++ b/Blockmason.Link/OAuth2/Credential.cs @@ -1,6 +1,6 @@ using Newtonsoft.Json; -namespace Link.OAuth2 { +namespace Blockmason.Link.OAuth2 { public class Credential { public class Contract { public string access_token; diff --git a/Link/OAuth2/Grant/ClientCredentialsGrant.cs b/Blockmason.Link/OAuth2/Grant/ClientCredentialsGrant.cs similarity index 95% rename from Link/OAuth2/Grant/ClientCredentialsGrant.cs rename to Blockmason.Link/OAuth2/Grant/ClientCredentialsGrant.cs index 6f97bd9..8322852 100644 --- a/Link/OAuth2/Grant/ClientCredentialsGrant.cs +++ b/Blockmason.Link/OAuth2/Grant/ClientCredentialsGrant.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using System; -namespace Link.OAuth2.Grant { +namespace Blockmason.Link.OAuth2.Grant { public class ClientCredentialsGrant { public class Contract { public string client_id; diff --git a/Link/OAuth2/Grant/RefreshTokenGrant.cs b/Blockmason.Link/OAuth2/Grant/RefreshTokenGrant.cs similarity index 93% rename from Link/OAuth2/Grant/RefreshTokenGrant.cs rename to Blockmason.Link/OAuth2/Grant/RefreshTokenGrant.cs index f46d35c..25884fe 100644 --- a/Link/OAuth2/Grant/RefreshTokenGrant.cs +++ b/Blockmason.Link/OAuth2/Grant/RefreshTokenGrant.cs @@ -1,7 +1,7 @@ using Newtonsoft.Json; using System; -namespace Link.OAuth2.Grant { +namespace Blockmason.Link.OAuth2.Grant { public class RefreshTokenGrant { public class Contract { public string grant_type; diff --git a/Link/OAuth2/Session.cs b/Blockmason.Link/OAuth2/Session.cs similarity index 98% rename from Link/OAuth2/Session.cs rename to Blockmason.Link/OAuth2/Session.cs index fe6d3f3..7b8ac79 100644 --- a/Link/OAuth2/Session.cs +++ b/Blockmason.Link/OAuth2/Session.cs @@ -1,4 +1,4 @@ -using Link.OAuth2.Grant; +using Blockmason.Link.OAuth2.Grant; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -9,7 +9,7 @@ using System.Text; using System.Threading.Tasks; -namespace Link.OAuth2 { +namespace Blockmason.Link.OAuth2 { public class Session { public const string DEFAULT_BASE_URL = "https://api.block.mason.link"; diff --git a/Link/Project.cs b/Blockmason.Link/Project.cs similarity index 95% rename from Link/Project.cs rename to Blockmason.Link/Project.cs index b0b791f..6df1f89 100644 --- a/Link/Project.cs +++ b/Blockmason.Link/Project.cs @@ -1,4 +1,4 @@ -using Link.OAuth2; +using Blockmason.Link.OAuth2; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Link { +namespace Blockmason.Link { public class Project { public static async Task Create(string clientId, string clientSecret) { Session session = await Session.Create(clientId, clientSecret); diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 19e9ca5..0000000 --- a/Dockerfile +++ /dev/null @@ -1,32 +0,0 @@ -FROM debian:stretch - -ENV DOTNET_CLI_TELEMETRY_OPTOUT=1 - -RUN set -o nounset -o errexit;\ - apt-get update;\ - apt-get upgrade -y;\ - apt-get install apt-transport-https curl gnupg zlibc zlib1g zlib1g-dev -y;\ - curl -sSL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.gpg;\ - curl -sSL https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/microsoft.list;\ - chown root:root /etc/apt/trusted.gpg.d/microsoft.gpg /etc/apt/sources.list.d/microsoft.list;\ - chmod 0444 /etc/apt/trusted.gpg.d/microsoft.gpg /etc/apt/sources.list.d/microsoft.list;\ - apt-get update;\ - apt-get install dotnet-sdk-2.2 -y;\ - apt-get autoremove -y;\ - rm -vfR /var/lib/apt/lists/*;\ - addgroup --system --gid 1337 link;\ - adduser --system --gid 1337 --uid 1337 --home /opt/link --gecos '' --shell /bin/bash --disabled-login link; - -COPY . /opt/link - -RUN set -o nounset -o errexit;\ - chmod -fR ug+rwX,o-rwx /opt/link;\ - chown -fR link:link /opt/link; - -USER link - -WORKDIR /opt/link - -RUN dotnet publish --configuration Release Link/Link.csproj -RUN dotnet publish --configuration Release Link.Tests/Link.Tests.csproj -RUN dotnet test --configuration Release Link.Tests/Link.Tests.csproj diff --git a/Makefile b/Makefile deleted file mode 100644 index a4f0f32..0000000 --- a/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -.PHONY: default build docker - -default: docker - -build: - dotnet build - -docker: - docker build -t blockmason/link-sdk.cs:latest .