-
Notifications
You must be signed in to change notification settings - Fork 2
133 lines (113 loc) · 3.91 KB
/
main.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
pull_request:
branches: [projects/piloting]
concurrency:
group: ${{ github.head_ref }}
cancel-in-progress: true
jobs:
linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Linting
run: |
pip install pre-commit
pre-commit run --all-files
deps:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Get changed base dependencies
id: changed-files
uses: tj-actions/[email protected]
with:
files: |
Dockerfile
moma_core.repos
moma_piloting.repos
install_dependencies.sh
**/requirements.txt
.github/workflows/**
- name: Early exit - Image up to date
if: steps.changed-files.outputs.any_changed == 'false'
run: echo "No image to be built"
- name: Set up Docker Buildx
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/login-action@v1
with:
username: ${{ secrets.PILOTING_DOCKERHUB_USERNAME }}
password: ${{ secrets.PILOTING_DOCKERHUB_TOKEN }}
- name: Get deps and push
if: steps.changed-files.outputs.any_changed == 'true'
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=registry,ref=${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-deps:buildcache
cache-to: type=registry,ref=${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-deps:buildcache,mode=max
push: true
target: deps
tags: ${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-deps:${{github.event.number}}
build:
needs: deps
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: "recursive"
lfs: true
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.PILOTING_DOCKERHUB_USERNAME }}
password: ${{ secrets.PILOTING_DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
builder: ${{ steps.buildx.outputs.name }}
cache-from: type=registry,ref=${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-deps:buildcache
cache-to: type=registry,ref=${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-deps:buildcache,mode=max
push: true
target: build
tags: ${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-dev:${{github.event.number}}
test:
needs: build
runs-on: ubuntu-latest
steps:
- name: Run docker test
run: |
export DISPLAY=:99
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 &
docker run -t --network host -e DISPLAY -v /tmp/.X11-unix ${{ secrets.PILOTING_DOCKERHUB_USERNAME }}/noetic-dev:${{github.event.number}} /bin/bash -c "rostest piloting_demo mission.test || (cat /tmp/piloting_mission.log && cat /tmp/piloting_mission.err && false)"
# test:
# needs: build
# runs-on: ubuntu-latest
# container:
# image: piloting/noetic-dev:latest
# options: --user root
# steps:
# - run: /ros_entrypoint.sh rostest piloting_demo mission.test
# test:
# needs: build
# runs-on: ubuntu-latest
#
# steps:
# - name: Run tests
# uses: docker://piloting/noetic-dev:latest
# with:
# args: rostest piloting_demo mission.test