Compare commits
4 Commits
895f8d2f34
...
e5a2ec8d51
Author | SHA1 | Date | |
---|---|---|---|
e5a2ec8d51 | |||
96da109ac1 | |||
f376be9e7a | |||
97c2cfeef6 |
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,2 +1,5 @@
|
||||
/vendor
|
||||
/bin
|
||||
/bin
|
||||
/release
|
||||
*-packr.go
|
||||
packrd
|
13
Makefile
Normal file
13
Makefile
Normal file
@ -0,0 +1,13 @@
|
||||
build: pack
|
||||
CGO_ENABLED=0 go build -mod vendor -v -o bin/junit2md ./cmd/junit2md
|
||||
|
||||
pack:
|
||||
cd cmd/junit2md && packr2 -v
|
||||
|
||||
watch:
|
||||
modd
|
||||
|
||||
release: pack
|
||||
script/release
|
||||
|
||||
.PHONY: build pack watch release
|
33
README.md
33
README.md
@ -2,6 +2,39 @@
|
||||
|
||||
Utilitaire de transformation de rapport de tests [JUnit](https://junit.org/) (un format courrant dans les frameworks de test) au format [Markdown](https://en.wikipedia.org/wiki/Markdown) via un template personnalisable.
|
||||
|
||||
## Usage
|
||||
|
||||
```
|
||||
junit2md <raport_junit1.xml> <raport_junit1.xml> <etc>
|
||||
```
|
||||
|
||||
La version Markdown sera envoyée sur la sortie standard.
|
||||
|
||||
## Démarrer avec les sources
|
||||
|
||||
### Dépendances de développement
|
||||
|
||||
- [Go >= 1.13.4](https://golang.org/)
|
||||
- [modd](https://github.com/cortesi/modd)
|
||||
- [packr2](https://github.com/gobuffalo/packr)
|
||||
|
||||
### Procédure d'amorçage
|
||||
|
||||
```
|
||||
git clone https://forge.cadoles.com/Cadoles/junit2md.git
|
||||
cd junit2md
|
||||
make watch
|
||||
```
|
||||
|
||||
### Générer une release
|
||||
|
||||
```
|
||||
make release
|
||||
```
|
||||
|
||||
Les archives contenant les releases seront disponibles dans le répertoire `release/`.
|
||||
|
||||
|
||||
## Licence
|
||||
|
||||
[GPL-3.0](./LICENSE)
|
@ -13,7 +13,8 @@
|
||||
|
||||
**Total duration**: {{ .Totals.Duration }}
|
||||
|
||||
### Details
|
||||
<details>
|
||||
<summary>See details</summary>
|
||||
|
||||
| Status | Name | Class |
|
||||
|--------|------|-------|
|
||||
@ -27,6 +28,8 @@
|
||||
{{- end -}}
|
||||
{{end}}
|
||||
|
||||
</details>
|
||||
|
||||
{{if or (gt .Totals.Error 0) (gt .Totals.Failed 0) }}
|
||||
#### Errors
|
||||
{{end}}
|
||||
|
@ -1,5 +1,4 @@
|
||||
**/*.go
|
||||
modd.conf {
|
||||
prep: packr2 -v
|
||||
prep: go build -mod vendor -v -o bin/junit2md ./cmd/junit2md
|
||||
prep: make build
|
||||
}
|
102
script/release
Executable file
102
script/release
Executable file
@ -0,0 +1,102 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
OS_TARGETS=(linux)
|
||||
ARCH_TARGETS=${ARCH_TARGETS:-amd64 arm 386}
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
|
||||
function build {
|
||||
|
||||
local name=$1
|
||||
local srcdir=$2
|
||||
local os=$3
|
||||
local arch=$4
|
||||
|
||||
local dirname="$name-$os-$arch"
|
||||
local destdir="$DIR/../release/$dirname"
|
||||
|
||||
rm -rf "$destdir"
|
||||
mkdir -p "$destdir"
|
||||
|
||||
echo "building $dirname..."
|
||||
|
||||
CGO_ENABLED=0 GOOS="$os" GOARCH="$arch" go build \
|
||||
-mod=vendor \
|
||||
-ldflags="-s -w -X main.GitCommit=$(current_commit_ref) -X main.ProjectVersion=$(current_version)" \
|
||||
-gcflags=-trimpath="${PWD}" \
|
||||
-asmflags=-trimpath="${PWD}" \
|
||||
-o "$destdir/$name" \
|
||||
"$srcdir"
|
||||
|
||||
if [ ! -z "$(which upx)" ]; then
|
||||
upx --best "$destdir/$name"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function current_commit_ref {
|
||||
git rev-list -1 HEAD
|
||||
}
|
||||
|
||||
function current_version {
|
||||
local latest_tag=$(git describe --abbrev=0 2>/dev/null)
|
||||
echo ${latest_tag:-0.0.0}
|
||||
}
|
||||
|
||||
function copy {
|
||||
|
||||
local name=$1
|
||||
local os=$2
|
||||
local arch=$3
|
||||
local src=$4
|
||||
local dest=$5
|
||||
|
||||
local dirname="$name-$os-$arch"
|
||||
local destdir="$DIR/../release/$dirname"
|
||||
|
||||
echo "copying '$src' to '$destdir/$dest'..."
|
||||
|
||||
mkdir -p "$(dirname $destdir/$dest)"
|
||||
|
||||
cp -rfL $src "$destdir/$dest"
|
||||
|
||||
}
|
||||
|
||||
function compress {
|
||||
|
||||
local name=$1
|
||||
local os=$2
|
||||
local arch=$3
|
||||
|
||||
local dirname="$name-$os-$arch"
|
||||
local destdir="$DIR/../release/$dirname"
|
||||
|
||||
echo "compressing $dirname..."
|
||||
tar -czf "$destdir.tar.gz" -C "$destdir/../" "$dirname"
|
||||
}
|
||||
|
||||
function release_junit2md {
|
||||
|
||||
local os=$1
|
||||
local arch=$2
|
||||
|
||||
build 'junit2md' "$DIR/../cmd/junit2md" $os $arch
|
||||
|
||||
copy 'junit2md' $os $arch "$DIR/../README.md" "README.md"
|
||||
copy 'junit2md' $os $arch "$DIR/../LICENSE" "LICENSE"
|
||||
|
||||
compress 'junit2md' $os $arch
|
||||
|
||||
}
|
||||
|
||||
function main {
|
||||
for os in ${OS_TARGETS[@]}; do
|
||||
for arch in ${ARCH_TARGETS[@]}; do
|
||||
release_junit2md $os $arch
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
main
|
Reference in New Issue
Block a user