forked from flyteorg/flytepropeller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Github workflows] Use latest boilerplate (flyteorg#201)
* [Github workflows] Use latest boilerplate * Update latest master workflow
- Loading branch information
Showing
6 changed files
with
301 additions
and
90 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 |
---|---|---|
|
@@ -6,8 +6,62 @@ on: | |
- master | ||
|
||
jobs: | ||
# Duplicated from pull request workflow because sharing is not yet supported | ||
build-docker: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: /tmp/tmp/docker-images | ||
key: /tmp/docker-images-${{ github.event.after }} | ||
restore-keys: | | ||
/tmp/docker-images-${{ github.event.before }} | ||
/tmp/docker-images-${{ github.event.pull_request.base.sha }} | ||
- name: Prime docker cache | ||
run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true) | ||
- name: Build dockerfile | ||
run: | | ||
docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder . | ||
docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder . | ||
- name: Tag and cache docker image | ||
run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar | ||
|
||
# Duplicated from pull request workflow because sharing is not yet supported | ||
endtoend: | ||
name: End to End tests | ||
runs-on: ubuntu-latest | ||
needs: [build-docker] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: /tmp/tmp/docker-images | ||
key: /tmp/docker-images-${{ github.event.after }} | ||
- name: Prime docker cache | ||
run: docker load -i /tmp/tmp/docker-images/snapshot.tar || true | ||
- uses: engineerd/[email protected] | ||
- name: End2End | ||
run: | | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:latest make end2end_execute | ||
bump-version: | ||
name: Bump Version | ||
if: github.actor != 'goreleaserbot' | ||
runs-on: ubuntu-latest | ||
needs: build-docker # Only to ensure it can successfully build | ||
outputs: | ||
version: ${{ steps.bump-version.outputs.tag }} | ||
steps: | ||
|
@@ -21,57 +75,48 @@ jobs: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
WITH_V: true | ||
DEFAULT_BUMP: patch | ||
|
||
goreleaser: | ||
name: Goreleaser | ||
runs-on: ubuntu-latest | ||
needs: [bump-version] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- | ||
name: Set up Go | ||
- name: Set up Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: 1.14 | ||
- | ||
name: Run GoReleaser | ||
- name: Run GoReleaser | ||
uses: goreleaser/goreleaser-action@v2 | ||
with: | ||
version: latest | ||
args: release --rm-dist | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }} | ||
push-github-end2end: | ||
|
||
push-github: | ||
name: Push to Github Registry | ||
runs-on: ubuntu-latest | ||
needs: bump-version | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: '0' | ||
- id: cache-docker | ||
uses: actions/cache@v1 | ||
- name: Push Docker Image to Github Registry | ||
uses: whoan/docker-build-with-cache-action@v5 | ||
with: | ||
path: /tmp//tmp/docker-images | ||
key: /tmp/docker-images-${{ hashFiles('Dockerfile') }} | ||
|
||
- run: docker load -i /tmp//tmp/docker-images/snapshot-builder.tar || true | ||
if: steps.cache-docker.outputs.cache-hit == 'true' | ||
- run: | | ||
docker build -t lyft/flytepropeller:${{ github.sha }} . --target builder --cache-from=flytepropeller-cache | ||
docker build -t lyft/flytepropeller:${{ github.sha }} . | ||
- run: docker tag lyft/flytepropeller:${{ github.sha }} flytepropeller-cache && mkdir -p /tmp//tmp/docker-images && docker save flytepropeller-cache -o /tmp//tmp/docker-images/snapshot.tar && ls -lh /tmp//tmp/docker-images || true | ||
if: always() && steps.cache-docker.outputs.cache-hit != 'true' | ||
username: "${{ github.actor }}" | ||
password: "${{ secrets.GITHUB_TOKEN }}" | ||
image_name: ${{ github.repository }}/${{ github.event.repository.name }} | ||
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 | ||
run: | | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
PROPELLER=lyft/flytepropeller:${{ github.sha }} make end2end_execute | ||
push-dockerhub: | ||
name: Push to Dockerhub | ||
runs-on: ubuntu-latest | ||
needs: bump-version | ||
steps: | ||
|
@@ -87,7 +132,9 @@ jobs: | |
image_tag: latest,${{ github.sha }},${{ needs.bump-version.outputs.version }} | ||
push_git_tag: true | ||
build_extra_args: "--compress=true" | ||
|
||
tests-lint: | ||
name: Run tests and lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
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,38 +4,85 @@ on: | |
pull_request | ||
|
||
jobs: | ||
build-and-end2end: | ||
build-docker: | ||
name: Build Docker Image | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
name: "Checkout" | ||
- id: cache-docker | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: /tmp//tmp/docker-images | ||
key: /tmp/docker-images-${{ hashFiles('Dockerfile') }} | ||
- run: docker load -i /tmp//tmp/docker-images/snapshot-builder.tar || true | ||
if: steps.cache-docker.outputs.cache-hit == 'true' | ||
- run: | | ||
docker build -t lyft/flytepropeller:${{ github.sha }} . --target builder --cache-from=flytepropeller-cache | ||
docker build -t lyft/flytepropeller:${{ github.sha }} . | ||
path: /tmp/tmp/docker-images | ||
key: /tmp/docker-images-${{ github.event.after }} | ||
restore-keys: | | ||
/tmp/docker-images-${{ github.event.before }} | ||
/tmp/docker-images-${{ github.event.pull_request.base.sha }} | ||
- name: Prime docker cache | ||
run: (docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true) && (docker load -i /tmp/tmp/docker-images/snapshot.tar || true) | ||
- name: Build dockerfile | ||
run: | | ||
docker build -t lyft/${{ github.event.repository.name }}:builder --target builder --cache-from=lyft/${{ github.event.repository.name }}:builder . | ||
docker build -t lyft/${{ github.event.repository.name }}:latest --cache-from=lyft/${{ github.event.repository.name }}:builder . | ||
- run: docker tag lyft/flytepropeller:${{ github.sha }} flytepropeller-cache && mkdir -p /tmp//tmp/docker-images && docker save flytepropeller-cache -o /tmp//tmp/docker-images/snapshot.tar && ls -lh /tmp//tmp/docker-images || true | ||
if: always() && steps.cache-docker.outputs.cache-hit != 'true' | ||
- name: Tag and cache docker image | ||
run: mkdir -p /tmp/tmp/docker-images && docker save lyft/${{ github.event.repository.name }}:builder -o /tmp/tmp/docker-images/snapshot-builder.tar && docker save lyft/${{ github.event.repository.name }}:latest -o /tmp/tmp/docker-images/snapshot.tar | ||
|
||
endtoend: | ||
name: End to End tests | ||
runs-on: ubuntu-latest | ||
needs: [build-docker] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: /tmp/tmp/docker-images | ||
key: /tmp/docker-images-${{ github.event.after }} | ||
- name: Prime docker cache | ||
run: docker load -i /tmp/tmp/docker-images/snapshot.tar || true | ||
- uses: engineerd/[email protected] | ||
- name: End2End | ||
run: | | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
PROPELLER=lyft/flytepropeller:${{ github.sha }} make end2end_execute | ||
IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:latest make end2end_execute | ||
integration: | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
needs: [build-docker] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- id: load-docker-cache | ||
name: Load Docker Cache | ||
uses: actions/cache@v1 | ||
with: | ||
path: /tmp/tmp/docker-images | ||
key: /tmp/docker-images-${{ github.event.after }} | ||
- name: Prime docker cache | ||
run: docker load -i /tmp/tmp/docker-images/snapshot-builder.tar || true | ||
- uses: engineerd/[email protected] | ||
- name: Integration | ||
run: | | ||
kubectl cluster-info | ||
kubectl get pods -n kube-system | ||
echo "current-context:" $(kubectl config current-context) | ||
echo "environment-kubeconfig:" ${KUBECONFIG} | ||
IMAGE_NAME=${{ github.event.repository.name }} IMAGE=lyft/${{ github.event.repository.name }}:builder make k8s_integration_execute | ||
tests-lint: | ||
name: Run tests and lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Unit Tests | ||
uses: cedrickring/[email protected] | ||
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
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
Oops, something went wrong.