Skip to content

Commit

Permalink
Merge pull request #32 from hasheddan/new-ci
Browse files Browse the repository at this point in the history
Make CI and promote workflows match other providers
  • Loading branch information
janwillies authored Oct 11, 2022
2 parents 21f0763 + 87732ef commit ca61e76
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 29 deletions.
37 changes: 13 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
env:
# Common versions
GO_VERSION: '1.18'
GOLANGCI_VERSION: 'v1.49'
GOLANGCI_VERSION: 'v1.47.1'
DOCKER_BUILDX_VERSION: 'v0.8.2'

# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
Expand All @@ -29,12 +29,11 @@ jobs:
steps:
- name: Detect No-op Changes
id: noop
uses: fkirc/skip-duplicate-actions@v2.1.0
uses: fkirc/skip-duplicate-actions@v2.0.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
paths_ignore: '["**.md", "**.png", "**.jpg"]'
do_not_skip: '["workflow_dispatch", "schedule", "push"]'
concurrent_skipping: false


lint:
Expand Down Expand Up @@ -74,14 +73,12 @@ jobs:
- name: Vendor Dependencies
run: make vendor vendor.check

# We could run 'make lint' to ensure our desired Go version, but we prefer
# this action because it leaves 'annotations' (i.e. it comments on PRs to
# point out linter violations).
# We could run 'make lint' but we prefer this action because it leaves
# 'annotations' (i.e. it comments on PRs to point out linter violations).
- name: Lint
uses: golangci/golangci-lint-action@v2
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GOLANGCI_VERSION }}
skip-go-installation: true

check-diff:
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -225,13 +222,11 @@ jobs:
run: make vendor vendor.check

- name: Build Helm Chart
timeout-minutes: 10
run: make -j2 build
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
RUNNING_IN_CI: true

- name: Run E2E Tests
run: make e2e USE_HELM3=true
Expand Down Expand Up @@ -288,52 +283,46 @@ jobs:
run: make vendor vendor.check

- name: Build Artifacts
timeout-minutes: 10
run: make -j2 build.all
env:
# We're using docker buildx, which doesn't actually load the images it
# builds by default. Specifying --load does so.
BUILD_ARGS: "--load"
RUNNING_IN_CI: true


- name: Publish Artifacts to GitHub
uses: actions/upload-artifact@v2
with:
name: output
path: _output/**

- name: Login to DockerHub
- name: Login to Docker
uses: docker/login-action@v1
if: env.CONTRIB_DOCKER_USR != ''
with:
username: ${{ secrets.CONTRIB_DOCKER_USR }}
password: ${{ secrets.CONTRIB_DOCKER_PSW }}

- name: Login to Upbound
uses: docker/login-action@v1
if: env.XPKG_ACCESS_ID != ''
with:
registry: xpkg.upbound.io
username: ${{ secrets.XPKG_ACCESS_ID }}
password: ${{ secrets.XPKG_TOKEN }}

- name: Publish Artifacts to S3, DockerHub
- name: Publish Artifacts to S3 and Docker Hub
run: make -j2 publish BRANCH_NAME=${GITHUB_REF##*/}
if: env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != ''
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }}
AWS_DEFAULT_REGION: us-east-1
GIT_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCS_GIT_USR: ${{ secrets.UPBOUND_BOT_GITHUB_USR }}
DOCS_GIT_PSW: ${{ secrets.UPBOUND_BOT_GITHUB_PSW }}

- name: Promote Artifacts in S3, DockerHub

- name: Promote Artifacts in S3 and Docker Hub
if: github.ref == 'refs/heads/main' && env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != ''
run: make -j2 promote
env:
BRANCH_NAME: main
CHANNEL: main
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }}
AWS_DEFAULT_REGION: us-east-1
15 changes: 11 additions & 4 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ on:
channel:
description: 'Release channel'
required: true
default: 'stable'
default: 'alpha'

env:
# Common versions
GO_VERSION: '1.18'

# Common users. We can't run a step 'if secrets.AWS_USR != ""' but we can run
# a step 'if env.AWS_USR' != ""', so we copy these to succinctly test whether
# credentials have been provided before trying to run steps that need them.
Expand All @@ -28,22 +31,26 @@ jobs:
with:
submodules: true

- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}

- name: Fetch History
run: git fetch --prune --unshallow

- name: Login to DockerHub
- name: Login to Docker
uses: docker/login-action@v1
if: env.CONTRIB_DOCKER_USR != ''
with:
username: ${{ secrets.CONTRIB_DOCKER_USR }}
password: ${{ secrets.CONTRIB_DOCKER_PSW }}

- name: Promote Artifacts in S3, DockerHub, and Upbound Registry
- name: Promote Artifacts in S3 and Docker Hub
if: env.AWS_USR != '' && env.CONTRIB_DOCKER_USR != ''
run: make -j2 promote BRANCH_NAME=${GITHUB_REF##*/}
env:
VERSION: ${{ github.event.inputs.version }}
CHANNEL: ${{ github.event.inputs.channel }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_USR }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PSW }}
AWS_DEFAULT_REGION: us-east-1
2 changes: 1 addition & 1 deletion build

0 comments on commit ca61e76

Please sign in to comment.