fix: check for errors on ElasticsearchClient #90
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker Image CI | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: ghcr.io/klantinteractie-servicesysteem/kiss-elastic-sync # lowercase | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build only | |
if: github.event_name == 'pull_request' | |
uses: docker/build-push-action@v4 | |
with: | |
file: src/Kiss.Elastic.Sync/Dockerfile | |
push: false | |
load: false | |
tags: user/app:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- name: Get date | |
if: github.event_name != 'pull_request' | |
id: date | |
run: | | |
echo "DATE=$(date +'%Y%m%d%H%M%S')-$(echo $GITHUB_SHA | head -c 7)" >> $GITHUB_ENV | |
- name: Get branch name | |
if: github.event_name != 'pull_request' | |
id: branch | |
run: | | |
BRANCH_NAME="${{ github.head_ref }}" | |
if [[ -z "$BRANCH_NAME" ]]; then | |
BRANCH_NAME="${{ github.ref }}" | |
BRANCH_NAME="${BRANCH_NAME#refs/heads/}" | |
fi | |
BRANCH_NAME=$(echo $BRANCH_NAME | tr / -) | |
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV | |
- name: Set release code | |
if: github.event_name != 'pull_request' | |
id: releasecode | |
run: | | |
RELEASE=$BRANCH_NAME-$DATE | |
echo "RELEASE=$RELEASE" >> $GITHUB_ENV | |
- name: Login to GitHub Container Registry | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
if: github.event_name != 'pull_request' | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
file: src/Kiss.Elastic.Sync/Dockerfile | |
tags: ${{env.IMAGE_NAME}}:${{ env.RELEASE }},${{env.IMAGE_NAME}}:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
test: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: read | |
checks: write | |
pull-requests: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.x' | |
- run: dotnet test test/Kiss.Elastic.Sync.IntegrationTest -c Release --logger trx --results-directory ./testresults -v n /p:CollectCoverage=true /p:CoverletOutput=./testresults/ /p:CoverletOutputFormat=lcov | |
- name: Publish Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
if: always() | |
with: | |
action_fail: true | |
files: | | |
testresults/*.trx | |
testresults/*.xml | |
# - name: Publish Coverage | |
# if: github.event_name == 'pull_request' | |
# uses: romeovs/[email protected] | |
# with: | |
# lcov-file: ./testresults/coverage.info | |
# github-token: ${{ secrets.GITHUB_TOKEN }} |