deploying to test

This commit is contained in:
Andy Pack 2023-10-12 21:17:32 +01:00
parent 2112c1de0e
commit 65331501ae
Signed by: sarsoo
GPG Key ID: A55BA3536A5E0ED7
2 changed files with 39 additions and 10 deletions

View File

@ -2,26 +2,53 @@ name: ci
on: [push] on: [push]
env:
dotnet-version: '6.0.x'
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: name: Build & Unit Test
fail-fast: false
matrix:
dotnet-version: [ '6.0.x' ]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
- name: Setup .NET Core SDK ${{ env.dotnet-version }}
uses: actions/setup-dotnet@v3.2.0 uses: actions/setup-dotnet@v3.2.0
with: with:
dotnet-version: ${{ matrix.dotnet-version }} dotnet-version: ${{ env.dotnet-version }}
- name: Install Dependencies - name: Install Dependencies
run: dotnet restore run: dotnet restore
- name: Build - name: Build
run: dotnet build --configuration Release --no-restore run: dotnet build --configuration Release --no-restore
# - name: Test
# run: dotnet test --no-restore --verbosity normal - name: Test
run: dotnet test --no-restore --verbosity normal
deploytest:
runs-on: ubuntu-latest
name: Deploy Test
environment:
name: test
url: https://test.mixonomer.sarsoo.xyz
needs: build # for ignoring bad builds
if: github.event_name == 'push'
steps:
- uses: actions/checkout@v3 # get source
- name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
- uses: 'google-github-actions/deploy-cloud-functions@v1'
with:
name: 'RunUserPlaylist'
runtime: 'dotnet6'
entry_point: 'Mixonomer.Func.RunUserPlaylist'
source_dir: 'Mixonomer.Func'
env_vars: 'GOOGLE_CLOUD_PROJECT=${{ vars.GCP_PROJECT }}'
service_account_email: 'runuserplaylist-func@${{ vars.GCP_PROJECT }}.iam.gserviceaccount.com'
event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish
event_trigger_resource: projects/${{ vars.GCP_PROJECT }}/topics/run_user_playlist

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using CloudNative.CloudEvents; using CloudNative.CloudEvents;
@ -21,6 +22,7 @@ namespace Mixonomer.Func
public Task HandleAsync(CloudEvent cloudEvent, MessagePublishedData data, CancellationToken cancellationToken) public Task HandleAsync(CloudEvent cloudEvent, MessagePublishedData data, CancellationToken cancellationToken)
{ {
_logger.LogInformation($"Received message in C# {data.Message}, {cloudEvent.GetPopulatedAttributes()}");
return Task.CompletedTask; return Task.CompletedTask;
} }