-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (61 loc) · 2.05 KB
/
build-test.yml
File metadata and controls
63 lines (61 loc) · 2.05 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
name: Build & Test Docker Image
on:
# runs autonomously upon regular push
push:
branches:
- '**'
tags-ignore:
- 'v*'
# can be invoked by publish job
workflow_call:
# can be triggered manually
workflow_dispatch:
jobs:
build-test:
runs-on: ubuntu-latest
steps:
# set up build tools
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# build image with local caching
- name: Build image
uses: docker/build-push-action@v6
with:
tags: chgio/python4capella-docker:latest
load: true
cache-to: type=local,dest=/tmp/docker-cache
# run image test script in container, relaying exit code
# (test fails => step fails => job fails)
- name: Test image
run: |
docker run \
--name test_container \
chgio/python4capella-docker:latest \
sample/scripts/Python4Capella-Scripts/List_logical_components_in_console.py \
sample/models/In-Flight\ Entertainment\ System/In-Flight\ Entertainment\ System.aird \
> /tmp/out.txt
grep "In-Flight Entertainment System
- IFE System
- Passenger
- Cabin Crew
- Aircraft
- Ground Operator" \
/tmp/out.txt
exit $?
# upload Docker build cache for publish job
- name: Upload cache as artifact
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v4
with:
name: Docker Cache
path: /tmp/docker-cache
# extract and upload Docker image dependency versions for release job
- name: Extract dependency versions
if: ${{ github.ref_type == 'tag' }}
run: docker inspect --format '{{ join .Config.Env "\n" }}' test_container > /tmp/docker-env-vars.txt
- name: Upload dependency versions
if: ${{ github.ref_type == 'tag' }}
uses: actions/upload-artifact@v4
with:
name: Docker Environment Variables
path: /tmp/docker-env-vars.txt