Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 34 additions & 12 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
- 'deploy/**'
- '.github/workflows/**'
workflow_dispatch:

jobs:
build-context:
runs-on: ubuntu-latest
Expand All @@ -22,6 +21,10 @@ jobs:
runs-on: ubuntu-latest
env:
PLATFORMS: "linux/amd64,linux/arm64"
permissions:
pull-requests: write # Required to post comments
contents: read
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -32,6 +35,8 @@ jobs:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
with:
strip_tag_prefix: 'v'

- name: Current branch name
run: |
Expand All @@ -43,7 +48,7 @@ jobs:
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
echo "TAG_LATEST=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}

- name: Running on a branch and merge.
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
Expand Down Expand Up @@ -93,6 +98,17 @@ jobs:
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-chatbot image
uses: docker/build-push-action@v3
with:
context: ./services/chatbot
tags: crapi/crapi-chatbot:${{ env.TAG_LATEST }},crapi/crapi-chatbot:${{ env.TAG_NAME }}
push: false
load: true
platforms: linux/amd64
cache-from: type=gha,scope==chatbot-service
cache-to: type=gha,mode=max,scope=chatbot-service

- name: Build crapi-community image
uses: docker/build-push-action@v3
with:
Expand Down Expand Up @@ -146,10 +162,12 @@ jobs:
- name: Cleanup docker before running
if: always()
continue-on-error: true
run: docker-compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
run: docker compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans

- name: Run crAPI using built images
run: VERSION=${{ env.TAG_NAME }} docker-compose -f deploy/docker/docker-compose.yml --compatibility up -d
run: |
cd deploy/docker
VERSION=${{ env.TAG_NAME }} docker compose -f docker-compose.yml --compatibility up -d

- name: Install Node
uses: actions/setup-node@v3
Expand All @@ -168,20 +186,24 @@ jobs:

- name: Cleanup docker
if: always()
run: docker-compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans
run: docker compose -f deploy/docker/docker-compose.yml down --volumes --remove-orphans


tests:
needs: build-context
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
checks: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: '3.11'

- name: Setup Java
uses: actions/setup-java@v4
Expand All @@ -192,10 +214,10 @@ jobs:
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: '1.23'

- name: Start the database
run: docker-compose -f services/docker-database.yml up -d
run: docker compose -f services/docker-database.yml up -d

- name: Run identity tests
run: |
Expand All @@ -210,12 +232,12 @@ jobs:
go run gotest.tools/gotestsum@latest --format testname --junitfile test-results/unit-tests.xml

- name: golangci-lint
uses: golangci/golangci-lint-action@v3
uses: golangci/golangci-lint-action@v8.0.0
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.54
version: v2.2.1
working-directory: services/community


Expand Down Expand Up @@ -249,7 +271,7 @@ jobs:
coverage xml -o coverage.xml

- name: Publish Coverage for workshop
uses: orgoro/coverage@v3.1
uses: orgoro/coverage@v3.2
with:
coverageFile: services/workshop/coverage.xml
token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -258,4 +280,4 @@ jobs:
run: |
cd services/web
npm install
npm run lint
npm run lint
14 changes: 13 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ jobs:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v8
with:
strip_tag_prefix: 'v'

- name: Current branch name
run: |
Expand All @@ -48,7 +50,7 @@ jobs:
if: steps.branch-name.outputs.is_tag == 'true'
run: |
echo "TAG_NAME=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}
echo "TAG_LATEST=latest" >> ${GITHUB_ENV}
echo "TAG_LATEST=${{ steps.branch-name.outputs.tag }}" >> ${GITHUB_ENV}

- name: Running on a branch and merge.
if: steps.branch-name.outputs.is_tag != 'true' && github.event_name == 'push' && steps.branch-name.outputs.current_branch != 'main'
Expand Down Expand Up @@ -102,6 +104,16 @@ jobs:
cache-from: type=gha,scope=workshop-service
cache-to: type=gha,mode=max,scope=workshop-service

- name: Build crapi-chatbot all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
context: ./services/chatbot
tags: crapi/crapi-chatbot:${{ env.TAG_LATEST }},crapi/crapi-chatbot:${{ env.TAG_NAME }}
platforms: ${{ env.PLATFORMS }}
push: true
cache-from: type=gha,scope=chatbot-service
cache-to: type=gha,mode=max,scope=chatbot-service

- name: Build crapi-community all platforms and push to Docker Hub
uses: docker/build-push-action@v3
with:
Expand Down
Loading