Skip to content

Commit

Permalink
Complete github actions migration (flyteorg#156)
Browse files Browse the repository at this point in the history
* Add unit tests in github actions

* Remove Travis and update master pipeline

* Push to dockerhub again

* Fix tagging in PRs

* make dockerhub push parallel

* renames

* parallelize image builds

* new line

* Update  boilerplate

* Add reference to how to bump versions
  • Loading branch information
EngHabu authored Jun 18, 2020
1 parent 2723182 commit 476c587
Show file tree
Hide file tree
Showing 7 changed files with 208 additions and 40 deletions.
60 changes: 53 additions & 7 deletions flytepropeller/.github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,32 @@ on:
- master

jobs:
build:
bump-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump-version.outputs.tag }}
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump-version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
push-github-end2end:
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.flytegithub_repo }}/operator
image_tag: latest,${{ github.sha }},${{ steps.bump-version.outputs.tag }}
image_name: ${{ secrets.flytegithub_repo }}/flytepropeller
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }}
push_git_tag: true
registry: docker.pkg.github.com
build_extra_args: "--compress=true"
Expand All @@ -39,4 +45,44 @@ jobs:
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/operator:${{ github.sha }} make end2end_execute
PROPELLER=${{ secrets.flytegithub_repo }}/flytepropeller:${{ github.sha }} make end2end_execute
push-dockerhub:
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }}
push_git_tag: true
build_extra_args: "--compress=true"
tests-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
47 changes: 39 additions & 8 deletions flytepropeller/.github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,16 @@ on:
pull_request

jobs:
build:
build-and-end2end:
runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
go-version: [1.13]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.flytegithub_repo }}/operator
image_name: ${{ secrets.flytegithub_repo }}/flytepropeller
image_tag: ${{ github.sha }}
push_git_tag: true
registry: docker.pkg.github.com
Expand All @@ -31,4 +27,39 @@ jobs:
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/operator:${{ github.sha }} make end2end_execute
PROPELLER=${{ secrets.flytegithub_repo }}/flytepropeller:${{ github.sha }} make end2end_execute
push-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: ${{ github.sha }}
push_git_tag: true
build_extra_args: "--compress=true"
tests-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
16 changes: 0 additions & 16 deletions flytepropeller/.travis.yml

This file was deleted.

67 changes: 62 additions & 5 deletions flytepropeller/boilerplate/lyft/github_workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,83 @@ on:
- master

jobs:
build:
bump-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.bump-version.outputs.tag }}
steps:
- uses: actions/checkout@master
with:
fetch-depth: '0'
- name: Bump version and push tag
id: bump-version
uses: anothrNick/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
push-github-end2end:
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.flytegithub_repo }}/operator
image_tag: latest,${{ github.sha }},${{ steps.bump-version.outputs.tag }}
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }}
push_git_tag: true
registry: docker.pkg.github.com
build_extra_args: "--compress=true"
- uses: engineerd/[email protected]
- name: End2End
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
run: |
kubectl cluster-info
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/operator:${{ github.sha }} make end2end_execute
push-dockerhub:
runs-on: ubuntu-latest
needs: bump-version
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }}
push_git_tag: true
build_extra_args: "--compress=true"
tests-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: '0'
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
52 changes: 49 additions & 3 deletions flytepropeller/boilerplate/lyft/github_workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,62 @@ on:
pull_request

jobs:
build:
build-and-end2end:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Push Docker Image to Github Registry
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ github.actor }}"
password: "${{ secrets.GITHUB_TOKEN }}"
image_name: ${{ secrets.flytegithub_repo }}/operator
image_name: ${{ secrets.flytegithub_repo }}/flytepropeller
image_tag: ${{ github.sha }}
push_git_tag: true
registry: docker.pkg.github.com
- uses: engineerd/[email protected]
- name: End2End
env:
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: "${{ secrets.GITHUB_TOKEN }}"
run: |
kubectl cluster-info
kubectl get pods -n kube-system
echo "current-context:" $(kubectl config current-context)
echo "environment-kubeconfig:" ${KUBECONFIG}
PROPELLER=${{ secrets.flytegithub_repo }}/flytepropeller:${{ github.sha }} make end2end_execute
push-dockerhub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Push Docker Image to Dockerhub
uses: whoan/docker-build-with-cache-action@v5
with:
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
image_name: ${{ secrets.DOCKERHUB_IMAGE_NAME }}
image_tag: ${{ github.sha }}
push_git_tag: true
build_extra_args: "--compress=true"
tests-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Unit Tests
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make test_unit_codecov
- name: Push CodeCov
uses: codecov/codecov-action@v1
with:
file: coverage.txt
flags: unittests
fail_ci_if_error: true
- name: Lint
uses: cedrickring/[email protected]
env:
GO111MODULE: "on"
with:
args: make install && make lint
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,3 @@ test_unit_visual:
.PHONY: test_unit_codecov
test_unit_codecov:
go test ./... -race -coverprofile=coverage.txt -covermode=atomic
curl -s https://codecov.io/bash > codecov_bash.sh && bash codecov_bash.sh
5 changes: 5 additions & 0 deletions flytepropeller/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Read then delete
- Make sure to use a concise title for the pull-request.
- Use #patch, #minor or #major in the pull-request title to bump the corresponding version. Otherwise, the patch version
will be bumped. [More details](https://github.com/marketplace/actions/github-tag-bump)

# TL;DR
_Please replace this text with a description of what this PR accomplishes._

Expand Down

0 comments on commit 476c587

Please sign in to comment.