-
-
Notifications
You must be signed in to change notification settings - Fork 6
105 lines (94 loc) · 3.58 KB
/
Copy pathlexbox-api.yaml
File metadata and controls
105 lines (94 loc) · 3.58 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
name: Build lexbox API
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
on:
workflow_call:
inputs:
version:
description: 'The version of the image to build'
required: true
type: string
label-latest:
description: 'The label to apply to the latest image'
type: boolean
default: false
env:
IMAGE_NAME: ghcr.io/sillsdev/lexbox-api
jobs:
publish-api:
timeout-minutes: 60
runs-on: ubuntu-latest
# postgres db is for automated tests
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_PASSWORD: 972b722e63f549938d07bd8c4ee5086c
POSTGRES_DB: lexbox-tests
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5433:5432
env:
# https://docs.docker.com/develop/develop-images/build_enhancements/
DOCKER_BUILDKIT: 1
steps:
- uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
- uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0
with:
dotnet-version: '10.x'
- name: Install Task
uses: arduino/setup-task@b91d5d2c96a56797b48ac1e0e89220bf64044611 # v2.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Dotnet build
run: dotnet build LexBoxOnly.slnf
- name: Check for pending EF model changes
run: task api:has-pending-model-changes
- name: Unit tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #used for the FwLiteReleaseServiceTests so they don't get rate limited
run: dotnet test LexBoxOnly.slnf --logger:"xunit;LogFileName={assembly}.results.xml" --results-directory ./test-results --filter "Category!=Integration&Category!=FlakyIntegration" --blame-hang-timeout 10m
- name: Publish unit test results
uses: EnricoMi/publish-unit-test-result-action@8885e273a4343cd7b48eaa72428dea0c3067ea98 # v2.14.0
if: always()
with:
check_name: C# Unit Tests
files: ./test-results/*.xml
comment_mode: off
- name: Upload test results
if: always()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: dotnet-unit-test-results
path: ./test-results
- name: Docker meta
id: meta
if: ${{ !env.ACT }}
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: ${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=raw,enable=${{ inputs.label-latest }},value=latest
type=raw,value=${{ inputs.version }}
- name: ghcr.io login
uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 # v3.1.0
if: ${{ !env.ACT }}
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0
with:
context: backend
build-args: |
APP_VERSION=${{ inputs.version }}
push: ${{ !env.ACT && github.repository == 'sillsdev/languageforge-lexbox' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}