-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
107 lines (89 loc) · 3.46 KB
/
Makefile.toml
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
[config]
skip_core_tasks = true
[tasks.ci-check]
script_runner = "sh"
script = '''
cargo fmt --check
cargo clippy
cargo clippy --no-default-features
cargo doc --no-deps --document-private-items
cargo test --verbose
'''
[tasks.ci-ubuntu]
# doing cross-compiles this way is really stupid but I didn't find a good way to parametrize this
run_task = { name = ["release-deb-x86", "release-deb-arm", "release-tar-x86", "release-tar-arm"] }
[tasks.ci-arch]
run_task = { name = ["release-archpkg"] }
[tasks.patch-version]
script_runner = "sh"
script = '''
sha=$(git rev-parse --short HEAD)
tag=$(git describe --tags --abbrev=0 --match 'v*' | sed 's/^v//')
sed -i "s/0.0.0-dev/$tag+$sha/" Cargo.toml
sed -i "s/0.0.0_dev/$(echo $tag | sed 's/-/_/g')/" package/arch/PKGBUILD
sed -i "s/0.0.0-dev/$tag/" package/debian/control
'''
[tasks.artifact-dropoff]
script_runner = "sh"
script = "mkdir -p target/artifacts"
[tasks.release-deb-x86]
dependencies = ["artifact-dropoff", "patch-version"]
condition = { platforms = ["linux"] }
script_runner = "sh"
script = '''
cargo build --release --target x86_64-unknown-linux-musl
sed -i "s/Architecture:.*/Architecture: amd64/" package/debian/control
rm -rf "package/debian/pkg" "package/debian/*.deb"
install -Dm755 "target/x86_64-unknown-linux-musl/release/rolr" "package/debian/pkg/usr/bin/rolr"
install -Dm644 "package/debian/control" "package/debian/pkg/DEBIAN/control"
(cd package/debian && dpkg-deb --build --root-owner-group pkg)
cp -a package/debian/*.deb target/artifacts/rolr-x86_64.deb
'''
[tasks.release-deb-arm]
dependencies = ["artifact-dropoff", "patch-version"]
condition = { platforms = ["linux"] }
script_runner = "sh"
script = '''
CC=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc \
cargo build --release --target aarch64-unknown-linux-musl
sed -i "s/Architecture:.*/Architecture: arm64/" package/debian/control
rm -rf "package/debian/pkg" "package/debian/*.deb"
install -Dm755 "target/aarch64-unknown-linux-musl/release/rolr" "package/debian/pkg/usr/bin/rolr"
install -Dm644 "package/debian/control" "package/debian/pkg/DEBIAN/control"
(cd package/debian && dpkg-deb --build --root-owner-group pkg)
cp -a package/debian/*.deb target/artifacts/rolr-aarch64.deb
'''
[tasks.release-tar-x86]
dependencies = ["artifact-dropoff", "patch-version"]
condition = { platforms = ["linux"] }
script_runner = "sh"
script = '''
cargo build --release --target x86_64-unknown-linux-musl
mkdir -p target/tmp/tar
cp LICENSE target/tmp/tar/LICENSE
cp target/x86_64-unknown-linux-musl/release/rolr target/tmp/tar/rolr
(cd target/tmp/tar && tar czf ../../artifacts/rolr-x86_64.tar.gz .)
'''
[tasks.release-tar-arm]
dependencies = ["artifact-dropoff", "patch-version"]
condition = { platforms = ["linux"] }
script_runner = "sh"
script = '''
CC=aarch64-linux-gnu-gcc \
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc \
cargo build --release --target aarch64-unknown-linux-musl
mkdir -p target/tmp/tar
cp LICENSE target/tmp/tar/LICENSE
cp target/aarch64-unknown-linux-musl/release/rolr target/tmp/tar/rolr
(cd target/tmp/tar && tar czf ../../artifacts/rolr-aarch64.tar.gz .)
'''
[tasks.release-archpkg]
dependencies = ["patch-version", "artifact-dropoff"]
condition = { platforms = ["linux"] }
script_runner = "sh"
script = '''
cargo build --release --target x86_64-unknown-linux-musl
(cd package/arch && makepkg -Cf)
cp -a package/arch/*.pkg.tar.zst target/artifacts/rolr-x86_64.pkg.tar.zst
'''