-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* redo github workflows; simplify make * fix workflow * fix buildx and test results * add missing checkout for job * fix release workflow * use local registry for testing * run docker from image tar
- Loading branch information
1 parent
f3f7422
commit 0f5ba80
Showing
13 changed files
with
192 additions
and
987 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
.idea | ||
.vscode | ||
.github | ||
.test | ||
|
||
.gitignore | ||
.env | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,72 @@ | ||
name: "Continuous Integration" | ||
name: "Build and Test" | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
pull_request: | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'deploy/**' | ||
- 'examples/**' | ||
- '*.md' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
|
||
buildx: | ||
test: | ||
name: "lint and test" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
permissions: | ||
checks: write | ||
pull-requests: write | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v1 | ||
|
||
- name: Set up Docker buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Cache Docker layers | ||
uses: actions/cache@v2 | ||
id: cache | ||
- name: setup Go | ||
uses: actions/setup-go@v3 | ||
with: | ||
path: /tmp/.buildx-cache | ||
key: ${{ runner.os }}-buildx-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-buildx- | ||
go-version: 1.19 | ||
|
||
- name: Build, lint and test | ||
env: | ||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }} | ||
uses: docker/build-push-action@v2 | ||
with: | ||
file: docker/Dockerfile | ||
context: . | ||
build-args: | | ||
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} | ||
VCS_COMMIT_ID=${{ github.sha }} | ||
VCS_BRANCH_NAME=${{ steps.tagger.outputs.tag }} | ||
VCS_SLUG=${{ github.repository }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
load: true | ||
tags: pumba/build-and-test | ||
target: build-and-test | ||
- name: lint and test | ||
shell: sh | ||
run: | | ||
make lint | ||
make test-coverage | ||
- name: Build integration tests image | ||
env: | ||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }} | ||
uses: docker/build-push-action@v2 | ||
- name: publish test results | ||
uses: EnricoMi/publish-unit-test-result-action@v2 | ||
if: always() | ||
with: | ||
file: docker/Dockerfile | ||
context: . | ||
build-args: | | ||
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} | ||
VCS_COMMIT_ID=${{ github.sha }} | ||
VCS_BRANCH_NAME=${{ steps.tagger.outputs.tag }} | ||
VCS_SLUG=${{ github.repository }} | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
load: true | ||
tags: pumba/integration-tests | ||
target: integration-tests | ||
junit_files: ".cover/tests.xml" | ||
|
||
- name: Run integration tests | ||
run: | | ||
docker run -i --rm --name integration-tests -v /var/run/docker.sock:/var/run/docker.sock pumba/integration-tests | ||
- name: upload coverage | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ".cover/coverage.xml" | ||
|
||
- name: Upload coverage report | ||
run: | | ||
CI_BUILD_URL=https://github.com/${{ github.repository }}/commit/${{ github.sha }}/checks | ||
docker run -i --rm --name upload-coverage -e CI_BUILD_URL=${CI_BUILD_URL} -e CI_BUILD_ID=${RUNNER_TRACKING_ID} pumba/build-and-test | ||
integration: | ||
name: "integration tests" | ||
runs-on: ubuntu-latest | ||
|
||
- name: Decide on tag | ||
id: tagger | ||
run: | | ||
tag=$(echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///g' -e 's/^refs\/tags\///g' -e 's/^refs\/pull\///g' -e 's/\/merge$//g' | sed -e 's/master/latest/g') | ||
echo "::set-output name=tag::${tag}" | ||
echo "::debug::docker image tag ${tag}" | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
- name: setup buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_ACCOUNT }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
driver-opts: network=host | ||
|
||
- name: Build and push Docker image | ||
if: github.event_name != 'pull_request' | ||
env: | ||
DOCKER_ORG: ${{ secrets.DOCKER_ORG }} | ||
uses: docker/build-push-action@v2 | ||
- name: build image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
build-args: SKIP_TESTS=true | ||
file: docker/Dockerfile | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
build-args: | | ||
CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} | ||
VCS_COMMIT_ID=${{ github.sha }} | ||
VCS_BRANCH_NAME=${{ steps.tagger.outputs.tag }} | ||
VCS_SLUG=${{ github.repository }} | ||
SKIP_TESTS=true | ||
cache-from: type=local,src=/tmp/.buildx-cache | ||
cache-to: type=local,dest=/tmp/.buildx-cache | ||
push: true | ||
tags: ${{ secrets.DOCKER_ORG }}/pumba:${{ steps.tagger.outputs.tag }} | ||
tags: pumba:test | ||
target: integration-tests | ||
outputs: type=docker,dest=/tmp/image.tar | ||
|
||
- name: integration tests | ||
run: | | ||
docker load -i /tmp/image.tar | ||
docker run -i --rm --name integration-tests -v /var/run/docker.sock:/var/run/docker.sock pumba:test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,94 @@ | ||
name: "Release to GitHub" | ||
name: "Release" | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'master' | ||
- master | ||
tags: | ||
- '[0-9]+.[0-9]+.[0-9]+' | ||
paths-ignore: | ||
- 'docs/**' | ||
- 'deploy/**' | ||
- 'examples/**' | ||
- 'test/**' | ||
- '*.md' | ||
- '*.yaml' | ||
|
||
jobs: | ||
|
||
release: | ||
build: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
container: golang:1.19-alpine | ||
|
||
- name: Set up Docker buildx | ||
id: buildx | ||
uses: docker/setup-buildx-action@v1 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Decide on tag | ||
id: tagger | ||
- name: build | ||
shell: sh | ||
env: | ||
GOPROXY: https://proxy.golang.org | ||
CGO_ENABLED: 0 | ||
run: | | ||
tag=$(echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///g' -e 's/^refs\/tags\///g' -e 's/^refs\/pull\///g' -e 's/\/merge$//g' | sed -e 's/master/latest/g') | ||
echo "::set-output name=tag::${tag}" | ||
echo "::debug::docker image tag ${tag}" | ||
apk --update add ca-certificates tzdata make git bash | ||
make release | ||
create-release: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
name: release | ||
needs: [ build ] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: tag | ||
id: get_tag | ||
run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: changelog | ||
id: build_changelog | ||
uses: mikepenz/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.get_tag.outputs.git_tag }} | ||
tag_name: ${{ steps.get_tag.outputs.git_tag }} | ||
body: ${{steps.build_changelog.outputs.changelog}} | ||
files: | | ||
.bin/* | ||
push: | ||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
name: push | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: get tag | ||
id: get_tag | ||
run: echo ::set-output name=git_tag::${GITHUB_REF/refs\/tags\//} | ||
|
||
- name: setup QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: setup buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: login to registry | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_ACCOUNT }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
- name: Release to GitHub | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v2 | ||
- name: build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
file: docker/Dockerfile | ||
context: . | ||
build-args: | | ||
RELEASE=true | ||
RELEASE_TAG=${{ steps.tagger.outputs.tag }} | ||
RELEASE_TOKEN=${{ secrets.RELEASE_TOKEN }} | ||
TAG_MESSAGE="Draft Release" | ||
GITHUB_TOKEN=${{ secrets.RELEASE_TOKEN }} | ||
VCS_COMMIT_ID=${{ github.sha }} | ||
VCS_BRANCH_NAME=${{ steps.tagger.outputs.tag }} | ||
VCS_SLUG=${{ github.repository }} | ||
target: github-release | ||
platforms: linux/amd64,linux/arm64 | ||
push: true | ||
tags: ${{ secrets.DOCKER_ORG }}/pumba:${{ steps.get_tag.outputs.git_tag }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
.bin | ||
.env | ||
.in | ||
/.gtm/ | ||
.test | ||
|
||
**/.DS_Store | ||
**/debug | ||
|
File renamed without changes.
Oops, something went wrong.