Skip to content

ci: replace travis completely with github actions #4554

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .ci/gpg/create-keyring.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ cp "${DIR}"/*.auto* "${GPG_HOME}"

echo -e "\nDecrypting secret key..."
{
# $GPG_PASSWORD is taken from the script's env (injected by Travis CI).
# $GPG_PASSWORD is taken from the script's env (injected by CI).
echo $GPG_PASSWORD | gpg --decrypt \
--pinentry-mode loopback --batch \
--passphrase-fd 0 \
Expand Down
99 changes: 99 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: deploy

on:
push:
branches:
- '**'
tags:
- 'v*'
pull_request:
branches: [ master ]

jobs:
# Job to test release steps. This will only create a release remotely if run on a tagged commit.
goreleaser:
name: goreleaser
runs-on: ubuntu-18.04
environment: deploy
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: install
uses: actions/setup-go@v2
with:
go-version: 1.15.5

- name: gpg init
if: github.event_name != 'pull_request'
run: .ci/gpg/create-keyring.sh
env:
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}

- name: release
run: |
if [[ $GITHUB_REF != refs/tags/* ]]; then
export DRY_RUN=1
fi
make release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Job matrix for image builds.
images:
name: images
runs-on: ubuntu-18.04
environment: deploy
strategy:
matrix:
id: ["operator-sdk", "ansible-operator", "helm-operator", "scorecard-test", "scorecard-test-kuttl"]
steps:

- name: set up qemu
uses: docker/setup-qemu-action@v1

- name: set up buildx
uses: docker/setup-buildx-action@v1

- name: quay.io login
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
registry: quay.io

- name: create tags
id: tags
run: |
IMG=quay.io/operator-framework/${{ matrix.id }}
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG=${GITHUB_REF#refs/tags/}
MAJOR_MINOR=${TAG%.*}
echo ::set-output name=tags::${IMG}:${TAG},${IMG}:${MAJOR_MINOR}

elif [[ $GITHUB_REF == refs/heads/* ]]; then
TAG=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
echo ::set-output name=tags::${IMG}:${TAG}

elif [[ $GITHUB_REF == refs/pull/* ]]; then
TAG=pr-${{ github.event.number }}
echo ::set-output name=tags::${IMG}:${TAG}
fi

- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: build and push
uses: docker/build-push-action@v2
with:
file: ./images/${{ matrix.id }}/Dockerfile
context: .
# s390x is not supported by the scorecard-test-kuttl base image.
platforms: linux/amd64,linux/arm64,linux/ppc64le${{ matrix.id != 'scorecard-test-kuttl' && ',linux/s390x' || '' }}
push: ${{ (github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )) }}
tags: ${{ steps.tags.outputs.tags }}
166 changes: 0 additions & 166 deletions .travis.yml

This file was deleted.

21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,14 @@ build: ## Build operator-sdk, ansible-operator, and helm-operator.
@mkdir -p $(BUILD_DIR)
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,ansible-operator,helm-operator}

.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
build/operator-sdk build/ansible-operator build/helm-operator:
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)

# Build scorecard binaries.
.PHONY: build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests
build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests:
go build $(GO_GCFLAGS) $(GO_ASMFLAGS) -o $(BUILD_DIR)/$(@F) ./images/$(@F)
.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
build/operator-sdk build/ansible-operator build/helm-operator:
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)

##@ Dev image build

Expand All @@ -83,13 +84,13 @@ image-build: $(foreach i,$(IMAGE_TARGET_LIST),image/$(i)) ## Build all images.

# Build an image.
BUILD_IMAGE_REPO = quay.io/operator-framework
image/%: BUILD_DIR = build/_image
# Images run on the linux kernel, so binaries must always target linux.
image/%: export GOOS = linux
image/%: build/%
mkdir -p ./images/$*/bin && mv $(BUILD_DIR)/$* ./images/$*/bin
docker build -t $(BUILD_IMAGE_REPO)/$*:dev -f ./images/$*/Dockerfile ./images/$*
rm -rf $(BUILD_DIR)
# When running in a terminal, this will be false. If true (ex. CI), print plain progress.
ifneq ($(shell test -t 0; echo $$?),0)
DOCKER_PROGRESS = --progress plain
endif
image/%: export DOCKER_CLI_EXPERIMENTAL = enabled
image/%:
docker buildx build $(DOCKER_PROGRESS) -t $(BUILD_IMAGE_REPO)/$*:dev -f ./images/$*/Dockerfile --load .

##@ Release

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<img src="website/static/operator_logo_sdk_color.svg" height="125px"></img>

[![Build Status](https://travis-ci.com/operator-framework/operator-sdk.svg?branch=master)](https://travis-ci.com/operator-framework/operator-sdk)

<!-- TODO(estroz): uncomment this when .github.com/workflows/deploy.yml is merged
[![Build Status](https://github.com/operator-framework/operator-sdk/workflows/deploy/badge.svg)](https://github.com/operator-framework/operator-sdk/actions)
-->
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![Go Report Card](https://goreportcard.com/badge/github.com/operator-framework/operator-sdk)](https://goreportcard.com/report/github.com/operator-framework/operator-sdk)

Expand Down
1 change: 0 additions & 1 deletion hack/ci/check-doc-only-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
set -e

# If running in Github actions: this should be set to "github.base_ref".
# If running in Travis CI: this should be set to "$TRAVIS_COMMIT_RANGE".
: ${1?"the first argument must be set to a commit-ish reference"}

# Patterns to ignore.
Expand Down
55 changes: 0 additions & 55 deletions hack/image/push-image-tags.sh

This file was deleted.

Loading