-
Notifications
You must be signed in to change notification settings - Fork 158
132 lines (130 loc) · 4.17 KB
/
build_from_source.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
name: build from source
on:
push:
branches:
- master
schedule:
- cron: '0 3 * * MON'
jobs:
docker:
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- arm64
stage:
- 1
- 2
- 3
max-parallel: 1
steps:
-
name: Checkout
uses: actions/checkout@v2
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build CI builder image
if: matrix.stage == 1
uses: docker/build-push-action@v2
with:
file: Dockerfile.build_from_source
platforms: linux/${{ matrix.platform }}
load: true
tags: ci-builder
target: ci-builder
-
name: Create output directory
if: matrix.stage == 1
run: mkdir -p wine-build/wine-install
-
name: Calculate previous stage number
id: previous_stage
if: matrix.stage > 1
run: |
PREV_STAGE=$(expr ${{ matrix.stage }} - 1)
echo "Previous stage number: '${PREV_STAGE}'"
echo "::set-output name=value::${PREV_STAGE}"
-
name: Restore checkpoint cache
if: matrix.stage > 1
uses: actions/cache@v2
with:
path: wine-build
key: ${{ runner.os }}-${{ matrix.platform }}-${{ steps.previous_stage.outputs.value }}-${{ github.run_id }}-${{ hashFiles('**/lockfiles') }}
-
name: Load CI builder image checkpoint
if: matrix.stage > 1
run: docker load -i wine-build/checkpoint.tar.gz
-
name: Run CI builder container
run: docker run --name=ci-builder --platform=linux/${{ matrix.platform }} --volume=$(pwd)/wine-build/wine-install:/wine-dirs/wine-install ci-builder
-
name: Create checkpoint image
if: matrix.stage < 3
run: docker commit ci-builder ci-builder
-
name: Delete old checkpoint
if: matrix.stage == 2
run: rm -f wine-build/checkpoint.tar.gz
-
name: Save checkpoint image to file
if: matrix.stage < 3
run: docker save ci-builder -o wine-build/checkpoint.tar.gz
-
name: List files in build cache
run: ls -laR wine-build
-
name: Cache checkpoint
if: matrix.stage < 3
uses: actions/cache@v2
with:
path: wine-build
key: ${{ runner.os }}-${{ matrix.platform }}-${{ matrix.stage }}-${{ github.run_id }}-${{ hashFiles('**/lockfiles') }}
-
name: Login to DockerHub
if: matrix.stage == 3
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Extract wine version
id: wine_ver
if: matrix.stage == 3
run: |
git clone --depth=1 --shallow-submodules git://source.winehq.org/git/wine.git
WINE_VER="$(awk '{print $3}' wine/VERSION)"
if echo "${WINE_VER}" | grep -q -E "^[0-9]+(\.[0-9]+)+(-\S+)*$"; then
echo "Found wine version '${WINE_VER}'"
echo "::set-output name=value::${WINE_VER}"
else
echo "ERROR: Unable to determine wine version"
exit 1
fi
-
name: Generate timestamp
id: timestamp
if: matrix.stage == 3
run: |
TIMESTAMP="$(date +"%Y%m%d")"
echo "Timestamp: ${TIMESTAMP}"
echo "::set-output name=value::${TIMESTAMP}"
-
name: Build final image and push
if: matrix.stage == 3
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.build_from_source
platforms: linux/${{ matrix.platform }}
push: true
tags:
scottyhardy/docker-wine:${{ matrix.platform }},
scottyhardy/docker-wine:devel-${{ steps.wine_ver.outputs.value }}-${{ matrix.platform }},
scottyhardy/docker-wine:devel-${{ steps.wine_ver.outputs.value }}-${{ matrix.platform }}-${{ steps.timestamp.outputs.value }}
target: ci-final