Mixonomer.NET/.github/workflows/ci.yml

89 lines
2.7 KiB
YAML
Raw Normal View History

2022-08-03 22:57:39 +01:00
name: ci
on: [push]
2023-10-12 21:17:32 +01:00
env:
2024-01-21 20:50:51 +00:00
dotnet-version: '8.0.x'
2023-10-12 21:17:32 +01:00
2022-08-03 22:57:39 +01:00
jobs:
build:
runs-on: ubuntu-latest
2023-10-12 21:17:32 +01:00
name: Build & Unit Test
2022-08-03 22:57:39 +01:00
steps:
2023-09-03 19:50:01 +01:00
- uses: actions/checkout@v3
2023-10-12 21:17:32 +01:00
- name: Setup .NET Core SDK ${{ env.dotnet-version }}
2023-09-03 19:50:01 +01:00
uses: actions/setup-dotnet@v3.2.0
2022-08-03 22:57:39 +01:00
with:
2023-10-12 21:17:32 +01:00
dotnet-version: ${{ env.dotnet-version }}
2022-08-03 22:57:39 +01:00
- name: Install Dependencies
run: dotnet restore
- name: Build
run: dotnet build --configuration Release --no-restore
2023-10-12 21:17:32 +01:00
- 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: Set up Cloud SDK
uses: google-github-actions/auth@v0.7.3
2023-10-12 21:17:32 +01:00
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
export_environment_variables: true
create_credentials_file: true
- name: Deploy RunUserPlaylist
run: |
gcloud functions deploy RunUserPlaylist \
--region europe-west2 \
--gen2 \
2024-01-21 20:50:51 +00:00
--runtime=dotnet8 \
2023-10-12 23:41:07 +01:00
--entry-point Mixonomer.Func.RunUserPlaylist \
--trigger-topic run_user_playlist \
--set-env-vars GOOGLE_CLOUD_PROJECT=${{ vars.GCP_PROJECT }} \
2023-10-12 23:33:15 +01:00
--service-account runuserplaylist-func@${{ vars.GCP_PROJECT }}.iam.gserviceaccount.com \
--set-build-env-vars=GOOGLE_BUILDABLE=Mixonomer.Func
shell: bash
2023-10-12 23:50:27 +01:00
deployprod:
runs-on: ubuntu-latest
name: Deploy Production
environment:
name: prod
url: https://mixonomer.sarsoo.xyz
needs: deploytest # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3 # get source
- name: Set up Cloud SDK
uses: google-github-actions/auth@v0.7.3
with:
credentials_json: '${{ secrets.GCP_SA_KEY }}'
export_environment_variables: true
create_credentials_file: true
- name: Deploy RunUserPlaylist
run: |
gcloud functions deploy RunUserPlaylist \
--region europe-west2 \
--gen2 \
2024-01-21 20:50:51 +00:00
--runtime=dotnet8 \
2023-10-12 23:50:27 +01:00
--entry-point Mixonomer.Func.RunUserPlaylist \
--trigger-topic run_user_playlist \
--set-env-vars GOOGLE_CLOUD_PROJECT=${{ vars.GCP_PROJECT }} \
--service-account runuserplaylist-func@${{ vars.GCP_PROJECT }}.iam.gserviceaccount.com \
--set-build-env-vars=GOOGLE_BUILDABLE=Mixonomer.Func
shell: bash