Skip to content

Commit

Permalink
feat: ditch Travis-CI
Browse files Browse the repository at this point in the history
  • Loading branch information
alsami committed Dec 8, 2021
1 parent 7270577 commit 6316449
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 367 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
on: push
name: Build Application
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet: ['6.0.x']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}

- name: Build solution
run: dotnet build -c Release

- name: Start mongo-container
run: docker-compose -f "docker-compose.yml" up -d

- name: Test solution and upload code coverage
run: |
chmod +x test.sh
./test.sh
30 changes: 30 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on:
push:
tags:
- '*'
name: Build and deploy
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
allow-no-subscriptions: true

- name: Checkout
uses: actions/checkout@v1

- name: Azure CLI script
uses: azure/CLI@v1
with:
azcliversion: 2.30.0
inlineScript: |
export TAG=${{github.ref_name}}
az config set extension.use_dynamic_install=yes_without_prompt
export IOT_HUB_NAME=${{secrets.AZURE_IOT_HUB_NAME}}
export IOT_DEVICE_NAME=${{secrets.AZURE_IOT_DEVICE_NAME}}
export IOT_DEVICE_METHOD_NAME=${{secrets.AZURE_IOT_DEVICE_METHOD_NAME}}
chmod +x ./invoke-deployment.sh
./invoke-deployment.sh
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

18 changes: 1 addition & 17 deletions Covid19Api.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ ProjectSection(SolutionItems) = preProject
LICENSE = LICENSE
publish-docker.sh = publish-docker.sh
README.md = README.md
.travis.yml = .travis.yml
.gitignore = .gitignore
global.json = global.json
docker-compose.yml = docker-compose.yml
Expand Down Expand Up @@ -54,9 +53,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covid19Api.Mongo.Scaffolder
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EBCCA0C8-4218-490F-A131-E8DF265DC415}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covid19Api.Tests", "test\Covid19Api.Tests\Covid19Api.Tests.csproj", "{663655F5-2BFE-4154-AF3F-BB8BF36C2165}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covid19Api.Mongo.Migrator", "src\Covid19Api.Mongo.Migrator\Covid19Api.Mongo.Migrator.csproj", "{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covid19Api.Endpoints.Rest.Tests", "test\Covid19Api.Endpoints.Rest.Tests\Covid19Api.Endpoints.Rest.Tests.csproj", "{663655F5-2BFE-4154-AF3F-BB8BF36C2165}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Covid19Api.AutoMapper", "src\Covid19Api.AutoMapper\Covid19Api.AutoMapper.csproj", "{2DEC9058-1FD3-457F-A0B2-DF053371DF34}"
EndProject
Expand Down Expand Up @@ -275,18 +272,6 @@ Global
{663655F5-2BFE-4154-AF3F-BB8BF36C2165}.Release|x64.Build.0 = Release|Any CPU
{663655F5-2BFE-4154-AF3F-BB8BF36C2165}.Release|x86.ActiveCfg = Release|Any CPU
{663655F5-2BFE-4154-AF3F-BB8BF36C2165}.Release|x86.Build.0 = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|x64.ActiveCfg = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|x64.Build.0 = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|x86.ActiveCfg = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Debug|x86.Build.0 = Debug|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|Any CPU.Build.0 = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|x64.ActiveCfg = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|x64.Build.0 = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|x86.ActiveCfg = Release|Any CPU
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119}.Release|x86.Build.0 = Release|Any CPU
{2DEC9058-1FD3-457F-A0B2-DF053371DF34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2DEC9058-1FD3-457F-A0B2-DF053371DF34}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2DEC9058-1FD3-457F-A0B2-DF053371DF34}.Debug|x64.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -341,7 +326,6 @@ Global
{3FAF620F-B417-43EF-8540-B0DDBA932DC8} = {2A35F3E7-12D1-4F74-8867-F5882FB47009}
{CC6C9309-C452-4C12-9783-35B5298781AF} = {2A35F3E7-12D1-4F74-8867-F5882FB47009}
{663655F5-2BFE-4154-AF3F-BB8BF36C2165} = {EBCCA0C8-4218-490F-A131-E8DF265DC415}
{9C4F9DEA-77E9-42E7-8991-C5227AAC0119} = {2A35F3E7-12D1-4F74-8867-F5882FB47009}
{2DEC9058-1FD3-457F-A0B2-DF053371DF34} = {2A35F3E7-12D1-4F74-8867-F5882FB47009}
{7D85801F-6AF5-407B-B262-2F85E6D8CF7D} = {EBCCA0C8-4218-490F-A131-E8DF265DC415}
{0D3D25E7-6045-41C1-B63A-AFCCFE93C403} = {EBCCA0C8-4218-490F-A131-E8DF265DC415}
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.30.0.37606">
<PackageReference Include="SonarAnalyzer.CSharp" Version="8.33.0.40503">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Covid-19-API

[![Build Status](https://travis-ci.com/alsami/Covid-19-API.svg?branch=main)](https://travis-ci.com/alsami/Covid-19-API)
[![Build Application](https://github.com/alsami/Covid-19-API/actions/workflows/push.yml/badge.svg)](https://github.com/alsami/Covid-19-API/actions/workflows/push.yml) [![codecov](https://codecov.io/gh/alsami/Covid-19-API/branch/main/graph/badge.svg?token=UDYQ2H8MV8)](https://codecov.io/gh/alsami/Covid-19-API)

Covid19Api serving most recent data related to corona virus based on the data available on [worldometers](https://www.worldometers.info/coronavirus/).

Expand Down
4 changes: 2 additions & 2 deletions deploy-app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ function authenticate() {


function set_container() {
echo updating container to version ${TRAVIS_TAG}
az webapp config container set -c "${REGISTRY}/covid-19-api:${TRAVIS_TAG}" -r https://${REGISTRY} -u ${REGISTRY_USER} -p "${REGISTRY_PASSWORD}" -n ${COVID19API_SERVICE_NAME} -g ${COVID19API_RESOURCE_NAME}
echo updating container to version ${TAG}
az webapp config container set -c "${REGISTRY}/covid-19-api:${TAG}" -r https://${REGISTRY} -u ${REGISTRY_USER} -p "${REGISTRY_PASSWORD}" -n ${COVID19API_SERVICE_NAME} -g ${COVID19API_RESOURCE_NAME}
}

function restart_app() {
Expand Down
6 changes: 1 addition & 5 deletions invoke-deployment.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/usr/bin/env bash
function authenticate() {
az login --service-principal -u ${SERVICE_PRINCIPAL_USER} -p ${SERVICE_PRINCIPAL_PASSWORD} --tenant ${SERVICE_PRINCIPAL_TENANT}
}

function invoke() {
az iot hub invoke-device-method -n ${IOT_HUB_NAME} -d ${IOT_DEVICE_NAME} --mn ${IOT_DEVICE_METHOD_NAME} --mp '{ "tag": "'${TRAVIS_TAG}'" }' --to 60
az iot hub invoke-device-method -n ${IOT_HUB_NAME} -d ${IOT_DEVICE_NAME} --mn ${IOT_DEVICE_METHOD_NAME} --mp '{ "tag": "'${TAG}'" }' --to 60
}

authenticate
invoke
8 changes: 4 additions & 4 deletions publish-docker.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
function create_image() {
if [[ -z ${TRAVIS_TAG} ]]; then
if [[ -z ${TAG} ]]; then
docker build -t covid-19-api:latest -t ${REGISTRY}/covid-19-api:latest -f ./src/Covid19Api/Dockerfile .
else
docker build -t ${REGISTRY}/covid-19-api:${TRAVIS_TAG} -f ./src/Covid19Api/Dockerfile .
docker build -t ${REGISTRY}/covid-19-api:${TAG} -f ./src/Covid19Api/Dockerfile .
fi
}

function publish_image() {
if [[ -n ${TRAVIS_TAG} ]]; then
docker push ${REGISTRY}/covid-19-api:${TRAVIS_TAG}
if [[ -n ${TAG} ]]; then
docker push ${REGISTRY}/covid-19-api:${TAG}
fi

#docker push ${REGISTRY}/covid-19-api:latest
Expand Down
4 changes: 2 additions & 2 deletions src/Covid19Api.IoC/Covid19Api.IoC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.1.0" />
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="7.3.0" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
<PackageReference Include="MediatR.Extensions.Autofac.DependencyInjection" Version="7.4.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
Expand Down
28 changes: 0 additions & 28 deletions src/Covid19Api.Mongo.Migrator/Abstractions/DatabaseMigration.cs

This file was deleted.

This file was deleted.

This file was deleted.

38 changes: 0 additions & 38 deletions src/Covid19Api.Mongo.Migrator/Covid19Api.Mongo.Migrator.csproj

This file was deleted.

This file was deleted.

Loading

0 comments on commit 6316449

Please sign in to comment.