Files
faas-cli/.github/workflows/build.yaml
Utsav Anand 15cc71aa64 Migrate builds from Travis to Github Actions
Fixes #838

Thanks to Lucas Roesler for his PR for buildx support #836
Signed-off-by: Utsav Anand <utsavanand2@gmail.com>
2020-11-17 14:46:47 +00:00

73 lines
2.0 KiB
YAML

name: build
on:
push:
branches:
- "*"
pull_request:
branches:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@master
with:
fetch-depth: 1
-
name: Set Username/Repo as ENV vars
run: echo "USER_REPO"=$(echo "$GITHUB_REPOSITORY" | awk '{print tolower($1)}' | sed -e "s/:refs//") >> $GITHUB_ENV
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Local docker build (non-root image)
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64
target: release
build-args: |
VERSION=latest-dev
GIT_COMMIT=${{ github.sha }}
REPO_URL=https://github.com/${{ env.USER_REPO }}
load: true
tags: openfaas/faas-cli:${{ github.sha }}
-
name: Local docker build (root image)
uses: docker/build-push-action@v2
with:
context: .
file: ./Dockerfile
push: false
platforms: linux/amd64
target: release
build-args: |
VERSION=latest-dev
GIT_COMMIT=${{ github.sha }}
REPO_URL=https://github.com/${{ env.USER_REPO }}
tags: openfaas/faas-cli:${{ github.sha }}-root
-
name: Copy binary to host
run: |
docker create --name faas-cli openfaas/faas-cli:${{ github.sha }} && \
mkdir -p ./bin && \
docker cp faas-cli:/usr/bin/faas-cli ./bin && \
docker rm -f faas-cli
-
name: Build samples
run: ./build_samples.sh
-
name: Test version
run: ./test/version.sh ./bin/faas-cli
-
name: Test the cli and the function behaviour
run: make test-templating