Skip to content

Commit

Permalink
Merge pull request #1 from alekskulakov/kulakov-hw-9
Browse files Browse the repository at this point in the history
Kulakov hw 9
  • Loading branch information
alekskulakov authored Nov 12, 2024
2 parents be26a3c + fc4d76e commit c3a4d25
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 23 deletions.
27 changes: 27 additions & 0 deletions .github/actions/notify-action/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: 'notify'
description: 'this action notify about workflow status'
inputs:
build-result:
description: Build result
required: true
runs:
using: composite
steps:
- name: Notify failure
if: ${{ inputs.build-result == 'failure' }}
uses: rtCamp/action-slack-notify@v2.3.2
env:
SLACK_TITLE: BUILD FAILED
SLACK_COLOR: "#f50057"
SLACK_MESSAGE: |
${{ format('Author: {0}', github.actor) }}
${{ format('Commit: {0}', github.event.head_commit.message) }}
- name: Notify on success
if: ${{ inputs.build-result == 'success' && github.ref == 'refs/heads/main' }}
uses: rtCamp/action-slack-notify@v2.3.2
env:
SLACK_TITLE: BUILD SUCCEEDED
SLACK_COLOR: "#00e676"
SLACK_MESSAGE: |
${{ format('Author: {0}', github.actor) }}
${{ format('Commit: {0}', github.event.head_commit.message) }}
65 changes: 42 additions & 23 deletions .github/workflows/build-something.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,31 +12,50 @@ jobs:
with:
dotnet-version: '8.0.100'
- name: build
uses: ./.github/actions/build-app
uses: ./.github/actions/build-app/
with:
build-number: ${{github.run_number}}
- name: publish artifacts
run: dotnet publish --no-restore --no-build --configuration Release --output artifacts/backend src/devschool-ci-test.csproj
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: selfdeceited
password: ${{ secrets.GHCR_PUBLISH_TOKEN }}
- name: Build and push image
uses: docker/build-push-action@v5
- name: Run unit tests
run: dotnet test
notify:
name: notifications
runs-on: ubuntu-latest
needs: build
if: always()
steps:
- name: Checkout
uses: actions/checkout@v4
- name: notify
uses: ./.github/actions/notify-action/
env:
SLACK_USERNAME: Donald Trump
SLACK_CHANNEL: devschool-test-notifications
SLACK_ICON: ':sad-frog:'
SLACK_WEBHOOK: ${{ secrets.LOOP_WEBHOOK }}
with:
file: ./artifacts/backend/Dockerfile
github-token: ${{ secrets.GHCR_PUBLISH_TOKEN }}
push: true
context: .
tags: ghcr.io/selfdeceited/devschool-ci-test:${{ github.run_number }}-post
build-args: |
"GH_BUILD_NUMBER=${{ github.run_number }}"
deploy:
needs: [build]
if: ${{ github.ref == 'refs/heads/main' }}
uses: ./.github/workflows/deploy-app.yml
with:
image_number: ${{ github.run_number }}
secrets: inherit
build-result: ${{ needs.build.result }}
# - name: Login to GitHub container registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: selfdeceited
# password: ${{ secrets.GHCR_PUBLISH_TOKEN }}
# - name: Build and push image
# uses: docker/build-push-action@v5
# with:
# file: ./artifacts/backend/Dockerfile
# github-token: ${{ secrets.GHCR_PUBLISH_TOKEN }}
# push: true
# context: .
# tags: ghcr.io/selfdeceited/devschool-ci-test:${{ github.run_number }}-post
# build-args: |
# "GH_BUILD_NUMBER=${{ github.run_number }}"
# deploy:
# needs: [build]
# if: ${{ github.ref == 'refs/heads/main' }}
# uses: ./.github/workflows/deploy-app.yml
# with:
# image_number: ${{ github.run_number }}
# secrets: inherit
6 changes: 6 additions & 0 deletions tests/UnitTest1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,10 @@ public void Test1()
{
Assert.Pass();
}

[Test]
public void Test2()
{
Assert.Pass();
}
}

0 comments on commit c3a4d25

Please sign in to comment.