From 370d76e2aa994514874e83b0877b5d548f535eee Mon Sep 17 00:00:00 2001 From: Ayrat Hudaygulov Date: Fri, 14 Jun 2024 16:33:10 +0100 Subject: [PATCH] added gh wf --- .github/workflows/build-and-test.yml | 19 +++++++++++++++++++ .github/workflows/deploy-azure-acr.yml | 9 ++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..b13bfc2 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,19 @@ +name: Build and test + +on: + pull_request: + branches: [ "main" ] + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + - run: dotnet test -c Release diff --git a/.github/workflows/deploy-azure-acr.yml b/.github/workflows/deploy-azure-acr.yml index 8759135..34ff941 100644 --- a/.github/workflows/deploy-azure-acr.yml +++ b/.github/workflows/deploy-azure-acr.yml @@ -21,7 +21,14 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - name: Apply migrations + # run tests + - uses: actions/setup-dotnet@v4 + with: + global-json-file: global.json + - run: dotnet test -c Release + + # if tests are ok, deploy to production + - name: Apply migrations to production DB run: >- docker run --rm --volume ${{ github.workspace }}/src/migrations:/flyway/sql:ro