This repository has been archived by the owner on May 27, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 22
145 lines (129 loc) · 4.93 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
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
134
135
136
137
138
139
140
141
142
143
144
145
name: Build OSGeo4A
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
release:
types:
- published
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
arch: [armeabi-v7a, arm64-v8a, x86, x86_64]
steps:
- name: Checkout
uses: actions/checkout@master
- name: Extract Qt Version
id: qt_version
run: |
QT_VERSION=$(cat qt_version.txt)
echo "::set-output name=version::${QT_VERSION}"
- name: Build qt base docker
uses: whoan/[email protected]
with:
username: opengisch
password: "${{ secrets.GITHUB_TOKEN }}"
registry: docker.pkg.github.com
image_name: qt-ndk
context: .docker/qt-ndk
image_tag: ${{ steps.qt_version.outputs.version }}
build_extra_args: "--build-arg QT_VERSION=${{ steps.qt_version.outputs.version }}"
- name: Build
env:
ARCH: ${{ matrix.arch }}
run: |
docker tag docker.pkg.github.com/opengisch/osgeo4a/qt-ndk:${{ steps.qt_version.outputs.version }} qt-ndk
docker build --build-arg ARCHES="${ARCH}" -t opengisch/qfield-sdk:latest .
- name: Create target specific SDK
if: ${{ github.event_name != 'pull_request' }}
run: |
mkdir /tmp/osgeo4a
docker run --rm --entrypoint tar opengisch/qfield-sdk:latest czC /home/osgeo4a . > /tmp/osgeo4a-${{ matrix.arch }}.tar.gz
- uses: actions/upload-artifact@master
if: ${{ github.event_name != 'pull_request' }}
with:
name: sdk-${{ matrix.arch }}
path: /tmp/osgeo4a-${{ matrix.arch }}.tar.gz
deploy:
if: ${{ github.event_name != 'pull_request' }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
- name: Extract branch or tag name
id: extract_ref
run: echo ::set-output name=ref::${GITHUB_REF#refs/*/}
- uses: actions/download-artifact@master
with:
name: sdk-armeabi-v7a
path: /tmp/workspace
- uses: actions/download-artifact@master
with:
name: sdk-arm64-v8a
path: /tmp/workspace
- uses: actions/download-artifact@master
with:
name: sdk-x86
path: /tmp/workspace
- uses: actions/download-artifact@master
with:
name: sdk-x86_64
path: /tmp/workspace
- name: Recreate qt base image
run: |
docker build --build-arg QT_VERSION=$(cat qt_version.txt) -t qt-ndk .docker/qt-ndk
- name: Recreate docker image
run: |
cp .docker/assemble/Dockerfile /tmp/workspace
docker build -t opengisch/qfield-sdk:latest /tmp/workspace
- name: Deploy to dockerhub
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
echo "$DOCKERHUB_TOKEN" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin
docker push opengisch/qfield-sdk:latest
docker tag opengisch/qfield-sdk:latest opengisch/qfield-sdk:${{ steps.extract_ref.outputs.ref }}
docker push opengisch/qfield-sdk:${{ steps.extract_ref.outputs.ref }}
- name: Free additional space
run: |
df -h
rm -rf /tmp/workspace
rm -rf /usr/share/dotnet/sdk
sudo apt remove llvm-* ghc-* google-chrome-* dotnet-sdk-*
dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -n | tail -n 100
du -a /usr/share | sort -n -r | head -n 10
du -a /usr/local/share | sort -n -r | head -n 10
df -h
sudo apt clean
df -h
- name: Create release sdk package
run: |
docker run --rm --entrypoint tar opengisch/qfield-sdk:latest czC /opt/ . > buildchain.tar.gz
docker run --rm --entrypoint tar opengisch/qfield-sdk:latest czC /home/ . > qfield-sdk.tar.gz
- name: Deploy buildchain to github release
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: buildchain.tar.gz
asset_name: buildchain-${{ steps.extract_ref.outputs.ref }}.tar.gz
asset_content_type: application/gzip
- name: Deploy qfield-sdk to github release
if: ${{ github.event_name == 'release' && github.event.action == 'published' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: qfield-sdk.tar.gz
asset_name: qfield-sdk-${{ steps.extract_ref.outputs.ref }}.tar.gz
asset_content_type: application/gzip