-
Notifications
You must be signed in to change notification settings - Fork 32
/
.justfile
128 lines (97 loc) · 5.02 KB
/
.justfile
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
# For use with the just command runner, https://just.systems/
export LLVM_PROFILE_FILE := 'coverage/cargo-test-%p-%m.profraw'
default:
@just --list
version := `git describe --tags`
grcov:
@echo 'Running tests for coverage with grcov'
rm -rf ${CARGO_TARGET_DIR}/coverage
CARGO_INCREMENTAL=0 RUSTFLAGS='-Cinstrument-coverage' cargo test
grcov . --binary-path ${CARGO_TARGET_DIR}/debug/deps/ \
-s . -t html \
--branch \
--ignore-not-existing --ignore '../*' --ignore "/*" \
-o ${CARGO_TARGET_DIR}/coverage
@echo grcov report in file://${CARGO_TARGET_DIR}/coverage/index.html
coverage-tarpaulin:
@echo 'Running tests for coverage with tarpaulin'
mkdir /tmp/tarpaulin
cargo tarpaulin --engine llvm --line --out html --output-dir /tmp/tarpaulin
setup-coverage-tools:
rustup component add llvm-tools-preview
cargo install grcov
cargo install cargo-tarpaulin
duplicates:
cargo tree --duplicates
termux:
cargo update
cargo test --no-default-features -- --show-output
# Build with the UCRT64 enviroment of MSYS, using a restricted PATH to limit the possibility of
# conflicts with non-mingw applications (in particular for autoconf and the C compiler that are
# needed to build the protobuf-src crate).
mingw:
PATH=/ucrt64/bin:/usr/local/bin:/usr/bin:/bin:/c/windows/System32:/c/ProgramData/chocolatey/bin cargo build --release
podman:
podman run -ti -v /tmp:/tmp -v .:/content ghcr.io/emarsden/dash-mpd-cli "$@"
# Build our container for Linux/AMD64, Linux/arm64, Linux/arm/v7 and Linux/riscv64 and push to the
# GitHub Container Registry.
#
# Needs the package qemu-user-static installed to cross-build the various architectures.
podman-build-multiarch:
#!/usr/bin/env bash
echo First need to "podman login ghcr.io"
podman manifest create \
--annotation org.opencontainers.image.description="Download media content from a DASH-MPEG or DASH-WebM MPD manifest." \
--annotation org.opencontainers.image.title="dash-mpd-cli" \
--annotation org.opencontainers.image.url="https://github.com/emarsden/dash-mpd-cli" \
--annotation org.opencontainers.image.source="https://github.com/emarsden/dash-mpd-cli" \
--annotation org.opencontainers.image.version={{version}} \
--annotation org.opencontainers.image.authors="[email protected]" \
--annotation org.opencontainers.image.licenses="MIT" \
dash-mpd-cli
echo === Build container for AMD64
podman build -f etc/Containerfile_linux_amd64 --arch amd64 --tag dash-mpd-cli-linux-amd64 --manifest dash-mpd-cli .
podman manifest push --all localhost/dash-mpd-cli ghcr.io/emarsden/dash-mpd-cli
echo === Build container for ARM64
podman build -f etc/Containerfile_linux_aarch64 --arch arm64 --tag dash-mpd-cli-linux-aarch64 --manifest dash-mpd-cli .
podman manifest push --all localhost/dash-mpd-cli ghcr.io/emarsden/dash-mpd-cli
echo === Build container for ARMv7
podman build -f etc/Containerfile_linux_armv7 --arch arm/v7 --tag dash-mpd-cli-linux-armv7 --manifest dash-mpd-cli .
podman manifest push --all localhost/dash-mpd-cli ghcr.io/emarsden/dash-mpd-cli
echo === Build container for RISCV64
podman build -f etc/Containerfile_linux_riscv64 --arch riscv64 --tag dash-mpd-cli-linux-riscv64 --manifest dash-mpd-cli .
podman manifest push --all localhost/dash-mpd-cli ghcr.io/emarsden/dash-mpd-cli
echo === Build container for PPC64LE
podman build -f etc/Containerfile_linux_ppc64le --arch ppc64le --tag dash-mpd-cli-linux-ppc64le --manifest dash-mpd-cli .
echo === Push container to registry
podman manifest push --all localhost/dash-mpd-cli ghcr.io/emarsden/dash-mpd-cli
test-annotate-manifest:
DIGEST=`podman manifest create test-annotation`
podman build -f etc/Containerfile_linux_amd64 --arch amd64 --tag test-annotation-linux-amd64 --manifest test-annotation .
podman manifest push --format oci --all localhost/test-annotation ttl.sh/test-annotation
list-docker-platforms:
podman run --rm docker.io/mplatform/mquery ghcr.io/emarsden/dash-mpd-cli:latest
# Run a trivy vulnerability scan of our container image
# https://github.com/aquasecurity/trivy
trivy-container:
podman run --rm --pull=newer docker.io/aquasec/trivy image ghcr.io/emarsden/dash-mpd-cli:latest
trivy-repository:
podman run --rm --pull=newer -v $PWD:/myapp docker.io/aquasec/trivy fs --scanners vuln,secret,misconfig .
# Run a grype vulnerability scan of our container image
# https://github.com/anchore/grype
grype-container:
podman run --rm -it docker.io/anchore/grype ghcr.io/emarsden/dash-mpd-cli:latest
# Using cargo-zigbuild from https://github.com/rust-cross/cargo-zigbuild
macos-AMD64:
podman run --rm -it \
-v $(pwd):/io \
-w /io docker.io/messense/cargo-zigbuild \
cargo zigbuild --release --target x86_64-apple-darwin
macos-universal:
podman run --rm -it \
-v $(pwd):/io \
-w /io docker.io/messense/cargo-zigbuild \
cargo zigbuild --release --target universal2-apple-darwin
publish:
cargo test
cargo publish