Skip to content
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

ci: build artifacts in parallel and add arm64 to release #518

Merged
merged 1 commit into from
Feb 1, 2023
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
83 changes: 69 additions & 14 deletions .github/workflows/release-testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,15 @@ jobs:
# Release Testing Job
# --------------------------------------------------------------------------

tests:
environment: gcloud
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: Kong/kong-license@master
id: license
with:
password: ${{ secrets.PULP_PASSWORD }}

# --------------------------------------------------------------------------
# Repository Checkout
# --------------------------------------------------------------------------
- name: checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT_GITHUB }}

- name: setup golang
uses: actions/setup-go@v3
Expand All @@ -39,25 +36,76 @@ jobs:
restore-keys: |
${{ runner.os }}-build-codegen-

- name: run unit tests
run: make test.unit

integration-tests:
runs-on: ubuntu-latest
steps:

- uses: Kong/kong-license@master
id: license
with:
password: ${{ secrets.PULP_PASSWORD }}

- name: checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT_GITHUB }}

# --------------------------------------------------------------------------
# Run Tests
# --------------------------------------------------------------------------
- name: setup golang
uses: actions/setup-go@v3
with:
go-version: '^1.19'

- name: run unit tests
run: make test.unit
- name: cache go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-

- name: run integration tests
run: make test.integration
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
KONG_LICENSE_DATA: ${{ steps.license.outputs.license }}

e2e-tests:
environment: gcloud
runs-on: ubuntu-latest
steps:

- uses: Kong/kong-license@master
id: license
with:
password: ${{ secrets.PULP_PASSWORD }}

# --------------------------------------------------------------------------
# Repository Checkout
# --------------------------------------------------------------------------

- name: checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.PAT_GITHUB }}

- name: setup golang
uses: actions/setup-go@v3
with:
go-version: '^1.19'

- name: cache go modules
uses: actions/cache@v3
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-build-codegen-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-build-codegen-

- name: run e2e tests
run: make test.e2e
env:
Expand All @@ -67,6 +115,13 @@ jobs:
GOOGLE_LOCATION: ${{ secrets.GOOGLE_LOCATION }}
KONG_LICENSE_DATA: ${{ steps.license.outputs.license }}

release-tagging:
runs-on: ubuntu-latest
needs:
- unit-tests
- integration-tests
- e2e-tests
steps:
# --------------------------------------------------------------------------
# Release Tagging
# --------------------------------------------------------------------------
Expand Down
132 changes: 71 additions & 61 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,36 @@ name: release
on:
push:
tags:
- "v*"
- "v*"
workflow_dispatch: {}

jobs:

# --------------------------------------------------------------------------
# Release Job
# --------------------------------------------------------------------------

release:
artifacts:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- os: linux
arch: amd64
- os: linux
arch: arm64
- os: darwin
arch: amd64
- os: darwin
arch: arm64
steps:

# --------------------------------------------------------------------------
# Repository Checkout
# --------------------------------------------------------------------------

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

- name: setup golang
uses: actions/setup-go@v3
with:
Expand All @@ -33,75 +46,72 @@ jobs:
restore-keys: |
${{ runner.os }}-build-codegen-

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

# --------------------------------------------------------------------------
# Github Release
# Build & Upload Artifacts
# --------------------------------------------------------------------------

- name: release
id: create_release
uses: actions/create-release@v1
- name: build for ${{ matrix.os }} ${{ matrix.arch }}
run: make build GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }}
- name: upload ${{ matrix.os }} ${{ matrix.arch }} artifact
uses: actions/upload-artifact@v3
with:
draft: false
prerelease: false
release_name: ${{ github.ref }}
tag_name: ${{ github.ref }}
body: |
See the [CHANGELOG.md](https://raw.githubusercontent.com/Kong/kubernetes-testing-framework/main/CHANGELOG.md)
env:
GITHUB_TOKEN: ${{ github.token }}
name: bin
path: build/ktf.${{ matrix.os }}.${{ matrix.arch }}
if-no-files-found: error

# --------------------------------------------------------------------------
# Build & Upload Artifacts
# Generate Checksums
# --------------------------------------------------------------------------

- name: build linux amd64 artifacts
run: make build GOOS=linux GOARCH=amd64
- name: upload linux amd64 artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/ktf.linux.amd64
asset_name: ktf.linux.amd64
asset_content_type: application/octet-stream

- name: build mac amd64 artifacts
run: make build GOOS=darwin GOARCH=amd64
- name: upload mac amd64 artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: generate checksum for ${{ matrix.os }} ${{ matrix.arch }} artifact
run: sha256sum ktf.${{ matrix.os }}.${{ matrix.arch }} >> CHECKSUMS.${{ matrix.os }}.${{ matrix.arch }}
working-directory: ./build/
- name: upload checksum for ${{ matrix.os }} ${{ matrix.arch }}
uses: actions/upload-artifact@v3
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/ktf.darwin.amd64
asset_name: ktf.darwin.amd64
asset_content_type: application/octet-stream
name: CHECKSUMS
path: build/CHECKSUMS.${{ matrix.os }}.${{ matrix.arch }}
if-no-files-found: error

# --------------------------------------------------------------------------
# Release Job
# --------------------------------------------------------------------------

release:
runs-on: ubuntu-latest
needs:
- artifacts
steps:

# --------------------------------------------------------------------------
# Generate Checksums
# Github Release
# --------------------------------------------------------------------------

- name: generate checksums for linux amd64 artifacts
run: sha256sum ktf.linux.amd64 >> CHECKSUMS
working-directory: ./build/
- name: download checksums artifact
uses: actions/download-artifact@v3
with:
name: CHECKSUMS

- name: generate checksums for mac amd64 artifacts
run: sha256sum ktf.darwin.amd64 >> CHECKSUMS
working-directory: ./build/
- name: concatenate all checksums
run: cat CHECKSUMS.* > CHECKSUMS

- name: upload checksums
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
- name: download binary artifacts
uses: actions/download-artifact@v3
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/CHECKSUMS
asset_name: CHECKSUMS
asset_content_type: text/plain
name: bin

- name: Release
uses: softprops/action-gh-release@v1
id: create_release
with:
draft: true
prerelease: true
name: ${{ github.ref }}
tag_name: ${{ github.ref }}
files: |
CHECKSUMS
ktf.*
body: |
See the [CHANGELOG.md](https://raw.githubusercontent.com/Kong/kubernetes-testing-framework/main/CHANGELOG.md)
env:
GITHUB_TOKEN: ${{ github.token }}