Skip to content

Commit

Permalink
WIP test release
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Mirić committed Sep 25, 2020
1 parent 902c3fc commit 8187dea
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 129 deletions.
256 changes: 128 additions & 128 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,135 +19,135 @@ env:
GODEBUG: netdns=go+1

jobs:
deps:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
- name: Check dependencies
run: |
go version
test -z "$(go mod vendor && git status --porcelain)"
go mod verify
# deps:
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install Go
# uses: actions/setup-go@v2
# with:
# go-version: 1.14.x
# - name: Check dependencies
# run: |
# go version
# test -z "$(go mod vendor && git status --porcelain)"
# go mod verify

lint:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
env:
GOLANGCI_VERSION: v1.31
GO111MODULE: 'on'
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Lint
# Why is `go mod vendor` needed here!? If it's not run then
# golangci-lint fails because of inconsistent vendoring...
run: |
go get github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_VERSION
BASEREV=$(git merge-base HEAD origin/master)
echo "Base revision: $BASEREV"
export PATH="$HOME/go/bin:$PATH"
go mod vendor
golangci-lint run --out-format=tab --new-from-rev "$BASEREV" ./...
# lint:
# runs-on: ubuntu-latest
# defaults:
# run:
# shell: bash
# env:
# GOLANGCI_VERSION: v1.31
# GO111MODULE: 'on'
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# with:
# fetch-depth: 0
# - name: Lint
# # Why is `go mod vendor` needed here!? If it's not run then
# # golangci-lint fails because of inconsistent vendoring...
# run: |
# go get github.com/golangci/golangci-lint/cmd/golangci-lint@$GOLANGCI_VERSION
# BASEREV=$(git merge-base HEAD origin/master)
# echo "Base revision: $BASEREV"
# export PATH="$HOME/go/bin:$PATH"
# go mod vendor
# golangci-lint run --out-format=tab --new-from-rev "$BASEREV" ./...

test:
strategy:
matrix:
go-version: [1.14.x, 1.15.x]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Run tests with code coverage
run: |
go version
export GOMAXPROCS=2
export PATH=$GOPATH/bin:$PATH
echo "mode: set" > coverage.txt
for pkg in $(go list ./... | grep -v vendor); do
list=$(go list -test -f '{{ join .Deps "\n"}}' $pkg | grep github.com/loadimpact/k6 | grep -v vendor || true)
if [ -n "$list" ]; then
list=$(echo "$list" | cut -f1 -d ' ' | sort -u | paste -sd, -)
fi
# test:
# strategy:
# matrix:
# go-version: [1.14.x, 1.15.x]
# platform: [ubuntu-latest, windows-latest]
# runs-on: ${{ matrix.platform }}
# defaults:
# run:
# shell: bash
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Install Go
# uses: actions/setup-go@v2
# with:
# go-version: ${{ matrix.go-version }}
# - name: Run tests with code coverage
# run: |
# go version
# export GOMAXPROCS=2
# export PATH=$GOPATH/bin:$PATH
# echo "mode: set" > coverage.txt
# for pkg in $(go list ./... | grep -v vendor); do
# list=$(go list -test -f '{{ join .Deps "\n"}}' $pkg | grep github.com/loadimpact/k6 | grep -v vendor || true)
# if [ -n "$list" ]; then
# list=$(echo "$list" | cut -f1 -d ' ' | sort -u | paste -sd, -)
# fi

go test -v -race -timeout 800s --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg
done
grep -h -v "^mode:" *.coverage >> coverage.txt
rm -f *.coverage
bash <(curl --fail -s https://codecov.io/bash)
go tool cover -html=coverage.txt -o coverage.html
- name: Upload coverage report
uses: actions/upload-artifact@v2
with:
name: test-coverage-report
path: coverage.html
# go test -v -race -timeout 800s --coverpkg="$list" -coverprofile=$(echo $pkg | tr / -).coverage $pkg
# done
# grep -h -v "^mode:" *.coverage >> coverage.txt
# rm -f *.coverage
# bash <(curl --fail -s https://codecov.io/bash)
# go tool cover -html=coverage.txt -o coverage.html
# - name: Upload coverage report
# uses: actions/upload-artifact@v2
# with:
# name: test-coverage-report
# path: coverage.html

docker:
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build
run: docker build -t $DOCKER_IMAGE_ID .
- name: Check
run: |
docker run $DOCKER_IMAGE_ID version
docker run $DOCKER_IMAGE_ID --help
docker run $DOCKER_IMAGE_ID help
docker run $DOCKER_IMAGE_ID run --help
docker run $DOCKER_IMAGE_ID inspect --help
docker run $DOCKER_IMAGE_ID status --help
docker run $DOCKER_IMAGE_ID stats --help
docker run $DOCKER_IMAGE_ID scale --help
docker run $DOCKER_IMAGE_ID pause --help
docker run $DOCKER_IMAGE_ID resume --help
- name: Publish
if: github.event_name != 'pull_request'
run: |
echo "REF=${{ github.ref }}"
echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID"
#
# Log into registry
echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo "$VERSION" | sed -e 's/^v//')
echo "VERSION=$VERSION"
docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:$VERSION"
docker push "$DOCKER_IMAGE_ID:$VERSION"
# We also want to tag the latest stable version as latest
if [[ "$VERSION" != "master" ]] && [[ ! "$VERSION" =~ (RC|rc) ]]; then
docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:latest"
docker push "$DOCKER_IMAGE_ID:latest"
fi
# docker:
# runs-on: ubuntu-latest
# needs: [lint, test]
# steps:
# - name: Checkout code
# uses: actions/checkout@v2
# - name: Build
# run: docker build -t $DOCKER_IMAGE_ID .
# - name: Check
# run: |
# docker run $DOCKER_IMAGE_ID version
# docker run $DOCKER_IMAGE_ID --help
# docker run $DOCKER_IMAGE_ID help
# docker run $DOCKER_IMAGE_ID run --help
# docker run $DOCKER_IMAGE_ID inspect --help
# docker run $DOCKER_IMAGE_ID status --help
# docker run $DOCKER_IMAGE_ID stats --help
# docker run $DOCKER_IMAGE_ID scale --help
# docker run $DOCKER_IMAGE_ID pause --help
# docker run $DOCKER_IMAGE_ID resume --help
# - name: Publish
# if: github.event_name != 'pull_request'
# run: |
# echo "REF=${{ github.ref }}"
# echo "DOCKER_IMAGE_ID=$DOCKER_IMAGE_ID"
# #
# # Log into registry
# echo "${{ secrets.DOCKER_PASS }}" | docker login -u "${{ secrets.DOCKER_USER }}" --password-stdin
# # Strip git ref prefix from version
# VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# # Strip "v" prefix from tag name
# [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo "$VERSION" | sed -e 's/^v//')
# echo "VERSION=$VERSION"
# docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:$VERSION"
# docker push "$DOCKER_IMAGE_ID:$VERSION"
# # We also want to tag the latest stable version as latest
# if [[ "$VERSION" != "master" ]] && [[ ! "$VERSION" =~ (RC|rc) ]]; then
# docker tag "$DOCKER_IMAGE_ID" "$DOCKER_IMAGE_ID:latest"
# docker push "$DOCKER_IMAGE_ID:latest"
# fi

release:
runs-on: ubuntu-latest
defaults:
run:
shell: bash
needs: [lint, test]
# needs: [lint, test]
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Checkout code
Expand All @@ -157,23 +157,23 @@ jobs:
with:
go-version: 1.14.x
- name: Install package builders
# Needed so that `go get` doesn't try to install glide as as a k6
# dependency, which would fail if run from the k6 directory because of
# Go modules.
working-directory: /tmp
run: |
pushd .
tmpdir=$(mktemp -d)
cd "$tmpdir"
gopath="$(go env GOPATH)"
go get github.com/Masterminds/glide
go get -d github.com/mh-cbon/go-bin-deb \
&& (cd $GOPATH/src/github.com/mh-cbon/go-bin-deb \
&& (cd "$gopath/src/github.com/mh-cbon/go-bin-deb" \
&& glide install \
&& go install)
go get -d github.com/mh-cbon/go-bin-rpm \
&& (cd $GOPATH/src/github.com/mh-cbon/go-bin-rpm \
&& (cd "$gopath/src/github.com/mh-cbon/go-bin-rpm" \
&& glide install \
&& go install)
apt-get update -y
apt-get install -y fakeroot rpm
popd
rm -rf "$tmpdir"
sudo apt-get update -y
sudo apt-get install -y fakeroot rpm
- name: Build
run: |
go version
Expand Down
4 changes: 3 additions & 1 deletion build-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ package() {
deb|rpm)
# The go-bin-* tools expect the binary in /tmp/
[ ! -r /tmp/k6 ] && cp "dist/${NAME}/k6" /tmp/k6
"go-bin-${FMT}" generate --file "packaging/${FMT}.json" -a amd64 --version $VERSION -o "dist/k6-v${VERSION}-amd64.${FMT}"
"go-bin-${FMT}" generate --file "packaging/${FMT}.json" -a amd64 \
--version "${VERSION#v}" -o "dist/k6-${VERSION}-amd64.${FMT}"
;;
tgz)
tar -C "${OUT_DIR}" -zcf "${OUT_DIR}/${NAME}.tar.gz" "$NAME"
Expand Down Expand Up @@ -75,6 +76,7 @@ checksum() {

cleanup() {
find "$OUT_DIR" -mindepth 1 -maxdepth 1 -type d -exec rm -rf {} \;
rm -f /tmp/k6
echo "--- Cleaned ${OUT_DIR}"
}
trap cleanup EXIT
Expand Down
5 changes: 5 additions & 0 deletions release notes/v0.29.0-test2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
k6 v0.29.0 is here! :tada:

## New features and enhancements!

- [k6](https://github.com/loadimpact/k6/) ...

0 comments on commit 8187dea

Please sign in to comment.