-
Notifications
You must be signed in to change notification settings - Fork 4
95 lines (77 loc) · 2.95 KB
/
build_and_test.yml
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
name: Build, Run and Test Docker Image
on: [push]
jobs:
build-run-test:
runs-on: ubuntu-latest
strategy:
matrix:
images:
- artifact: alfresco-elasticsearch-live-indexing-metadata
version: 4.0.1
name: alfresco-enterprise-search-metadata
path: search/enterprise/metadata
extension: -app.jar
group: org.alfresco
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- name: Setup .netrc
run: |
echo "machine nexus.alfresco.com" >> ~/.netrc
echo "login ${{ secrets.NEXUS_USERNAME }}" >> ~/.netrc
echo "password ${{ secrets.NEXUS_PASSWORD }}" >> ~/.netrc
- name: Fetch artifacts from nexus
run: bash ${{ github.workspace }}/scripts/fetch-artifact.sh ${{ matrix.images.artifact }} ${{ matrix.images.version }} ${{ matrix.images.extension }} ${{ matrix.images.group }} ${{ matrix.images.path }}
working-directory: ${{ github.workspace }}
- name: Build Docker image
uses: docker/build-push-action@v6
with:
context: .
tags: ${{ matrix.images.name }}:test
push: false
load: true
file: ${{ github.workspace }}/${{ matrix.images.path }}/Dockerfile
- name: Run Docker image
run: docker run -d -p 8080:8080 ${{ matrix.images.name }}:test
- name: Wait for container
run: sleep 30s
- uses: Alfresco/alfresco-build-tools/.github/actions/[email protected]
- name: Save Docker image
run: docker save ${{ matrix.images.name }}:test -o /tmp/${{ matrix.images.name }}.tar
- name: Upload image as a tar for next job
uses: actions/upload-artifact@v4
with:
name: images
path: /tmp/${{ matrix.images.name }}.tar
compose:
name: docker-compose
needs: build-run-test
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: images
path: /tmp
- name: Load Docker images
run: |
ls -1 /tmp/*.tar | xargs --no-run-if-empty -L 1 docker load -i
docker image ls -a
- name: Verify docker-compose
uses: Alfresco/alfresco-build-tools/.github/actions/dbp-charts/[email protected]
timeout-minutes: 10
with:
compose_file_path: docker-compose.yml
quay_username: ${{ secrets.QUAY_USERNAME }}
quay_password: ${{ secrets.QUAY_PASSWORD }}