-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTaskfile.yml
149 lines (134 loc) · 4.36 KB
/
Taskfile.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
146
147
148
149
---
version: 3
dotenv: [".env"]
# vars:
# FOO: bar
# env
vars:
CNTRCTL:
# sh: echo nerdctl
sh: which docker || which nerdctl
tasks:
docker:build:
desc: build docker builder image
cmds:
- |
{{ .CNTRCTL }} pull alpine:edge
{{ .CNTRCTL }} build --tag ghcr.io/atlascloud/aports-builder:edge .
docker:push:
desc: push builder image to github packages
cmds:
- |
{{- .CNTRCTL }} push ghcr.io/atlascloud/aports-builder:edge
docker:run:
desc: run the builder image
cmds:
- mkdir -p apkcache/ distfiles/ packages/ .ccache/ .abuild/
- |
{{- .CNTRCTL }} run -it --rm \
--env-file .env \
-v ${PWD}:/home/build \
-v ${PWD}/apkcache:/etc/apk/cache \
-v ${PWD}/distfiles:/var/cache/distfiles \
--name aports-builder ghcr.io/atlascloud/aports-builder:edge
docker:runshell:
desc: run a shell in the builder image (useful for debugging)
cmds:
- mkdir -p apkcache/ distfiles/ packages/ .ccache/ .abuild/
- |
{{- .CNTRCTL }} run -it --rm \
--env-file .env \
-v ${PWD}:/home/build \
-v ${PWD}/apkcache:/etc/apk/cache \
-v ${PWD}/distfiles:/var/cache/distfiles \
--entrypoint /bin/sh \
--network host \
--name aports-builder ghcr.io/atlascloud/aports-builder:edge
docker:checksum:
desc: generate checksums for a package, must specify 'PKG'
requires:
vars: [PKG]
cmds:
- |
{{- .CNTRCTL }} run --rm \
-v ${PWD}:/aports \
-v ${PWD}/apkcache:/etc/apk/cache \
-v ${PWD}/distfiles:/var/cache/distfiles \
--workdir /aports/{{ .PKG }} \
alpine:edge sh -c "apk add abuild ; abuild -F checksum"
docker:test:
desc: run tests in docker
cmds:
- |
{{- .CNTRCTL }} run
--workdir /src
-v ${PWD}:/src
alpine:edge
/bin/sh -c "wget -O /tmp/int.sh https://taskfile.dev/install.sh ; sh /tmp/int.sh -d -b /bin ; /bin/task test"
test:
desc: run tests
vars:
ABS:
sh: find . -name APKBUILD
cmds:
- apk add abuild atools
- cmd: |
{{range $i, $APKBUILD := .ABS | splitLines -}}
cd {{$APKBUILD | dir}}
abuild -F sanitycheck
apkbuild-lint APKBUILD
cd /src
{{end}}
ignore_error: true
upload-package:
desc: upload a package to packages server
# vars:
# PKG: should be set on command line
cmds:
- |
{{ $SL := splitList "/" .PKG -}}
{{ $vers := slice $SL 1 2 | first -}}
{{ $repo := slice $SL 2 3 | first -}}
{{ $arch := slice $SL 3 4 | first -}}
curl -v \
-H "Authorization: Bearer $PKGS_TOKEN" \
-F "package=@{{ .PKG }}" \
https://packages.atlascloud.xyz/api/atlascloud/alpine/{{ $vers }}/{{ $repo }}/{{ $arch }}/pkgs
# we used to do this automatically on the package server, but it can take a very long time and it was doing it
# on every package upload
sign-package-index:
desc: instruct the packages server to generate and sign the index with the packages that we've uploaded so far
# vars:
# PKG: should be set on command line - we aren't doing anything with the pkg, just extracting info from the path
cmds:
- |
{{ $SL := splitList "/" .PKG -}}
{{ $vers := slice $SL 1 2 | first -}}
{{ $repo := slice $SL 2 3 | first -}}
{{ $arch := slice $SL 3 4 | first -}}
{{ $arch := slice $SL 3 4 | first -}}
curl \
-X POST \
-H "Authorization: Bearer $PKGS_TOKEN" \
https://packages.atlascloud.xyz/api/atlascloud/alpine/{{ $vers }}/{{ $repo }}/{{ $arch }}/index
check-pkg-version:
desc: run checker scripts
cmds:
- |
pkg={{ .PKG | dir | base }}
echo "checking $pkg"
[ -f "./checkers/$pkg" ] || exit 0 # if we don't have a checker, skip
latest_version=$(./checkers/$pkg)
echo "latest version: $latest_version"
sed -i "s:pkgver=.*:pkgver=$latest_version:" main/$pkg/APKBUILD
sed -i "s:pkgrel=.*:pkgrel=0:" main/$pkg/APKBUILD
check-pkg-versions:
desc: run checker scripts for every APKBUILD
vars:
ABS:
sh: find . -name APKBUILD
cmds:
- for: { var: ABS }
task: check-pkg-version
vars:
PKG: "{{ .ITEM }}"