-
Notifications
You must be signed in to change notification settings - Fork 8
78 lines (71 loc) · 2.27 KB
/
docker.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
name: Dockerized toolchain
on:
push:
branches:
- master
- 'docker/**'
tags:
- '**'
pull_request:
branches:
- master
env:
TOOLCHAIN_NAME: gcc-v850-elf-toolchain
DOCKER_IMAGE: dkulacz/gcc-v850-elf-toolchain
DOCKER_TAG: test-${{ github.sha }}
jobs:
build-docker:
name: "Build and Publish to Docker Hub. Extract toolchain and archive it."
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/build-push-action@v1
with:
username: dkulacz
password: ${{ secrets.dkulacz_dockerhub }}
repository: ${{ env.DOCKER_IMAGE }}
build_args: UBUNTU_VERSION=20.04
tag_with_ref: true
tags: ${{ env.DOCKER_TAG }}
- name: Extract toolchain
run: |
docker create --name ${IMG_NAME} ${DOCKER_IMAGE}:${DOCKER_TAG}
docker cp ${IMG_NAME}:/opt/gcc-v850-elf-master /tmp
docker rm -f ${IMG_NAME}
tar -czvf ${TOOLCHAIN_NAME}-x86_64-linux.tar.gz -C /tmp gcc-v850-elf-master
env:
IMG_NAME: toolchain_extract
- uses: actions/upload-artifact@v2
with:
name: ${{ env.TOOLCHAIN_NAME }}-x86_64-linux.tar.gz
path: ${{ env.TOOLCHAIN_NAME }}-x86_64-linux.tar.gz
test-archive:
name: Test archived toolchain
needs: build-docker
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
with:
name: ${{ env.TOOLCHAIN_NAME }}-x86_64-linux.tar.gz
path: /tmp/
- name: Extract toolchain
run: tar -xf /tmp/${TOOLCHAIN_NAME}-x86_64-linux.tar.gz -C /opt
- name: Install tools
run: sudo apt-get update && sudo apt-get -y install make cmake
- name: Test
run: |
export PATH=/opt/gcc-v850-elf-master/bin:${PATH}
cd test
./test_rh850.sh
test-docker:
name: Test toolchain Docker image
needs: build-docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get updated docker image
run: docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
- name: Test
run: |
docker run --rm --volume $(pwd):$(pwd) -w $(pwd) ${DOCKER_IMAGE}:${DOCKER_TAG} /bin/bash -c "cd test && ./test_rh850.sh"