Merge pull request #122 from nickcharles/patch-2 #2
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
name: Tests | |
on: [push] | |
jobs: | |
buildAndTest: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
# Build | |
- name: Build Image | |
run: docker build . --tag kafka-backup-dev:latest | |
# Get the jar file and upload it as an artifact | |
- name: Prepare upload kafka-backup.jar | |
run: | | |
id=$(docker create kafka-backup-dev:latest) | |
docker cp $id:/opt/kafka-backup/kafka-backup.jar . | |
docker rm -v $id | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: kafka-backup-jar | |
path: ./kafka-backup.jar | |
# Integration Tests | |
- name: setup env | |
run: | | |
echo "::set-env name=GOPATH::$(go env GOPATH)" | |
echo "::add-path::$(go env GOPATH)/bin" | |
- uses: actions/setup-go@v2-beta | |
with: | |
go-version: '^1.13.1' | |
# Prepare Tests | |
- name: Setup Coyote | |
run: go get github.com/landoop/coyote | |
- name: Setup Tests | |
working-directory: ./system_test/ | |
run: | | |
docker-compose pull | |
docker-compose build | |
mkdir -p /tmp/kafka-backup out | |
chmod 777 /tmp/kafka-backup | |
# Run system tests | |
- name: Simple Roundtrip Test | |
working-directory: ./system_test/ | |
run: coyote -c 01_simple_roundtrip_test.yaml --out out/01_simple_roundtrip_test.html | |
- name: Full Test | |
working-directory: ./system_test/ | |
run: coyote -c 02_full_test.yaml --out out/02_full_test.html | |
- name: Start and Stop Kafka Connect | |
working-directory: ./system_test/ | |
run: coyote -c 03_start_n_stop.yaml --out out/03_start_n_stop.html | |
- name: Delete old Segments before restore | |
working-directory: ./system_test/ | |
run: coyote -c 04_delete_old_segments.yaml --out out/04_delete_old_segments.html | |
# Upload Test Results | |
- name: Upload Test Results | |
uses: actions/upload-artifact@v1 | |
with: | |
name: Test Results | |
path: ./system_test/out/ | |
# Create a Release | |
create-release: | |
needs: buildAndTest | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 | |
- uses: actions/download-artifact@v1 | |
with: | |
name: kafka-backup-jar | |
- name: Prepare Artifact | |
run: | | |
mv kafka-backup-jar/kafka-backup.jar bin/kafka-backup.jar | |
mv bin kafka-backup | |
tar cfz kafka-backup.tar.gz kafka-backup | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./kafka-backup.tar.gz | |
asset_name: kafka-backup.tar.gz | |
asset_content_type: application/gzip |