Skip to content

Commit d940893

Browse files
author
Eric Stroczynski
authored
ci: replace travis completely with github actions (#4554)
1 parent d37a747 commit d940893

File tree

20 files changed

+279
-476
lines changed

20 files changed

+279
-476
lines changed

.ci/gpg/create-keyring.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ cp "${DIR}"/*.auto* "${GPG_HOME}"
1818

1919
echo -e "\nDecrypting secret key..."
2020
{
21-
# $GPG_PASSWORD is taken from the script's env (injected by Travis CI).
21+
# $GPG_PASSWORD is taken from the script's env (injected by CI).
2222
echo $GPG_PASSWORD | gpg --decrypt \
2323
--pinentry-mode loopback --batch \
2424
--passphrase-fd 0 \

.github/workflows/deploy.yml

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
name: deploy
2+
3+
on:
4+
push:
5+
branches:
6+
- '**'
7+
tags:
8+
- 'v*'
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
# Job to test release steps. This will only create a release remotely if run on a tagged commit.
14+
goreleaser:
15+
name: goreleaser
16+
runs-on: ubuntu-18.04
17+
environment: deploy
18+
steps:
19+
- name: checkout
20+
uses: actions/checkout@v2
21+
with:
22+
fetch-depth: 0
23+
24+
- name: install
25+
uses: actions/setup-go@v2
26+
with:
27+
go-version: 1.15.5
28+
29+
- name: gpg init
30+
if: github.event_name != 'pull_request'
31+
run: .ci/gpg/create-keyring.sh
32+
env:
33+
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
34+
35+
- name: release
36+
run: |
37+
if [[ $GITHUB_REF != refs/tags/* ]]; then
38+
export DRY_RUN=1
39+
fi
40+
make release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
44+
# Job matrix for image builds.
45+
images:
46+
name: images
47+
runs-on: ubuntu-18.04
48+
environment: deploy
49+
strategy:
50+
matrix:
51+
id: ["operator-sdk", "ansible-operator", "helm-operator", "scorecard-test", "scorecard-test-kuttl"]
52+
steps:
53+
54+
- name: set up qemu
55+
uses: docker/setup-qemu-action@v1
56+
57+
- name: set up buildx
58+
uses: docker/setup-buildx-action@v1
59+
60+
- name: quay.io login
61+
if: github.event_name != 'pull_request'
62+
uses: docker/login-action@v1
63+
with:
64+
username: ${{ secrets.QUAY_USERNAME }}
65+
password: ${{ secrets.QUAY_PASSWORD }}
66+
registry: quay.io
67+
68+
- name: create tags
69+
id: tags
70+
run: |
71+
IMG=quay.io/operator-framework/${{ matrix.id }}
72+
if [[ $GITHUB_REF == refs/tags/* ]]; then
73+
TAG=${GITHUB_REF#refs/tags/}
74+
MAJOR_MINOR=${TAG%.*}
75+
echo ::set-output name=tags::${IMG}:${TAG},${IMG}:${MAJOR_MINOR}
76+
77+
elif [[ $GITHUB_REF == refs/heads/* ]]; then
78+
TAG=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
79+
echo ::set-output name=tags::${IMG}:${TAG}
80+
81+
elif [[ $GITHUB_REF == refs/pull/* ]]; then
82+
TAG=pr-${{ github.event.number }}
83+
echo ::set-output name=tags::${IMG}:${TAG}
84+
fi
85+
86+
- name: checkout
87+
uses: actions/checkout@v2
88+
with:
89+
fetch-depth: 0
90+
91+
- name: build and push
92+
uses: docker/build-push-action@v2
93+
with:
94+
file: ./images/${{ matrix.id }}/Dockerfile
95+
context: .
96+
# s390x is not supported by the scorecard-test-kuttl base image.
97+
platforms: linux/amd64,linux/arm64,linux/ppc64le${{ matrix.id != 'scorecard-test-kuttl' && ',linux/s390x' || '' }}
98+
push: ${{ (github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/') || github.ref == format('refs/heads/{0}', github.event.repository.default_branch) )) }}
99+
tags: ${{ steps.tags.outputs.tags }}

.travis.yml

Lines changed: 0 additions & 166 deletions
This file was deleted.

Makefile

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,14 @@ build: ## Build operator-sdk, ansible-operator, and helm-operator.
6666
@mkdir -p $(BUILD_DIR)
6767
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR) ./cmd/{operator-sdk,ansible-operator,helm-operator}
6868

69+
.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
70+
build/operator-sdk build/ansible-operator build/helm-operator:
71+
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)
72+
6973
# Build scorecard binaries.
7074
.PHONY: build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests
7175
build/scorecard-test build/scorecard-test-kuttl build/custom-scorecard-tests:
7276
go build $(GO_GCFLAGS) $(GO_ASMFLAGS) -o $(BUILD_DIR)/$(@F) ./images/$(@F)
73-
.PHONY: build/operator-sdk build/ansible-operator build/helm-operator
74-
build/operator-sdk build/ansible-operator build/helm-operator:
75-
go build $(GO_BUILD_ARGS) -o $(BUILD_DIR)/$(@F) ./cmd/$(@F)
7677

7778
##@ Dev image build
7879

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

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

9495
##@ Release
9596

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<img src="website/static/operator_logo_sdk_color.svg" height="125px"></img>
22

3-
[![Build Status](https://travis-ci.com/operator-framework/operator-sdk.svg?branch=master)](https://travis-ci.com/operator-framework/operator-sdk)
3+
4+
<!-- TODO(estroz): uncomment this when .github.com/workflows/deploy.yml is merged
5+
[![Build Status](https://github.com/operator-framework/operator-sdk/workflows/deploy/badge.svg)](https://github.com/operator-framework/operator-sdk/actions)
6+
-->
47
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
58
[![Go Report Card](https://goreportcard.com/badge/github.com/operator-framework/operator-sdk)](https://goreportcard.com/report/github.com/operator-framework/operator-sdk)
69

hack/ci/check-doc-only-update.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
set -e
44

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

98
# Patterns to ignore.

hack/image/push-image-tags.sh

Lines changed: 0 additions & 55 deletions
This file was deleted.

0 commit comments

Comments
 (0)