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

General housekeeping #54

Merged
merged 8 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Create and publish a Docker image
name: Build and Push

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build and Push Container Image?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2024-01-15 at 8 31 22 PM

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am fine reverting, but the reason I made these changes: "Build and Push" as the title of the workflow and "container" as what is being built and pushed. I think it displays nicely on the output.

# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
Expand All @@ -8,44 +8,59 @@ on:
tags:
- "v*.*.*"
paths-ignore:
- 'README.md'
- "README.md"
pull_request:

# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds.
# Defines two custom environment variables for the workflow.
# These are used for the Container registry domain, and a name
# for the Docker image that this workflow builds.
env:
REGISTRY: ghcr.io
IMAGE_NAME: substratusai/lingo

# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu.
# There is a single job in this workflow.
# It's configured to run on the latest available version of Ubuntu.
jobs:
build-and-push-image:
container:
runs-on: ubuntu-latest
nstogner marked this conversation as resolved.
Show resolved Hide resolved

# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job.
permissions:
contents: read
packages: write
#

steps:
- name: Checkout repository
uses: actions/checkout@v4
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here.
- if: github.event_name == 'push'
name: Log in to the Container registry

# Uses the `docker/login-action` action to log in to the Container registry registry
# using the account and password that will publish the packages. Once published, the
# packages are scoped to the account defined here.
- name: Log in to the Container registry
if: github.event_name == 'push'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels.

# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about)
# to extract tags and labels that will be applied to the specified image. The `id` "meta"
# allows the output of this step to be referenced in a subsequent step. The `images` value
# provides the base name for the tags and labels.
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository.
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step.
- name: Build and push Docker image

# This step uses the `docker/build-push-action` action to build the image, based on your
# repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages.
# It uses the `context` parameter to define the build's context as the set of files located
# in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)"
# in the README of the `docker/build-push-action` repository. It uses the `tags` and `labels`
# parameters to tag and label the image with the output from the "meta" step.
- name: Build and push container image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/integration-tests.yml

This file was deleted.

25 changes: 17 additions & 8 deletions .github/workflows/load-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,43 @@ run-name: Load tests by @${{ github.actor }}
on: workflow_dispatch

jobs:
perf-tests:
k6:
nstogner marked this conversation as resolved.
Show resolved Hide resolved
runs-on: ubuntu-latest

permissions:
contents: "read"
id-token: "write"

steps:
- name: Checkout code
uses: actions/checkout@v2
- id: "auth"

- name: Authenticate with GCP
uses: "google-github-actions/auth@v1"
with:
workload_identity_provider: "projects/819220466562/locations/global/workloadIdentityPools/github/providers/my-repo"
service_account: "github-actions@substratus-dev.iam.gserviceaccount.com"
- name: "Set up Cloud SDK"

- name: Set up cloud SDK
uses: "google-github-actions/setup-gcloud@v1"
- id: "get-credentials"

- name: Get credentials
uses: "google-github-actions/get-gke-credentials@v1"
with:
cluster_name: "lingo-dev"
location: "us-central1"
- id: "get-pods"

- name: Get pods
run: "kubectl get pods"
- id: "install-skaffold"

- name: Install skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
chmod +x skaffold
sudo mv skaffold /usr/local/bin
- id: "configure-docker"

- name: Configure docker
run: gcloud auth configure-docker -q us-central1-docker.pkg.dev
- id: "run-tests"

- name: Run tests
run: "./tests/load/test.sh"
34 changes: 0 additions & 34 deletions .github/workflows/system-test-kind.yml

This file was deleted.

55 changes: 55 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests
run-name: Run tests by @${{ github.actor }}

on:
push:
branches:
- main
pull_request:

jobs:
unit-race-integration:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ">=1.21.0"

- name: Run unit tests
run: make test-unit
nstogner marked this conversation as resolved.
Show resolved Hide resolved

- name: Run race tests
run: make test-race

- name: Run integration tests
run: make test-integration

e2e:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install kind
run: |
# For AMD64 / x86_64
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-amd64
# For ARM64
[ $(uname -m) = aarch64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.20.0/kind-linux-arm64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

- name: Install skaffold
run: |
curl -Lo skaffold https://storage.googleapis.com/skaffold/releases/latest/skaffold-linux-amd64
chmod +x skaffold
sudo mv skaffold /usr/local/bin

- name: Run e2e tests
run: make test-e2e
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
ENVTEST_K8S_VERSION = 1.27.1

.PHONY: test
test: test-unit

.PHONY: test-all
test-all: test-race test-integration
test: test-unit test-race test-integration test-e2e
nstogner marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: test-unit
test-unit:
Expand All @@ -18,6 +15,10 @@ test-race:
test-integration: envtest
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./tests/integration -v

.PHONY: test-e2e
test-e2e:
./tests/e2e/test.sh

## Location to install dependencies to
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
Expand Down
Loading
Loading