Skip to content
Open
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
16 changes: 0 additions & 16 deletions .buildkite/pipeline.yaml

This file was deleted.

35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CI

on:
pull_request:
push:
branches: [master]

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: make ci_test

build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: make ci_build

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- run: make ci_lint
46 changes: 46 additions & 0 deletions .github/workflows/mirror-ci-image.yml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we really need this file? Once the PR is merged, we will no longer publish to our ECR anyway, right?

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Mirror CI image

# Anonymous pulls from public ECR hit a rate limit on GitHub runners.
# This copies the gridx dev image to GHCR, where CI pulls it from.
# Runs on every change to this file and on manual dispatch.
on:
push:
paths:
- .github/workflows/mirror-ci-image.yml
workflow_dispatch:
inputs:
source_tag:
description: Tag of public.ecr.aws/gridx/base-images to mirror
default: modbus-dev-1.21.latest
target_tag:
description: Tag to publish under ghcr.io/grid-x/modbus-dev
default: go1.21

jobs:
mirror:
runs-on: ubuntu-latest
permissions:
packages: write
env:
SOURCE: public.ecr.aws/gridx/base-images:${{ inputs.source_tag || 'modbus-dev-1.21.latest' }}
TARGET: ghcr.io/grid-x/modbus-dev:${{ inputs.target_tag || 'go1.21' }}
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull source image
run: |
for attempt in 1 2 3 4 5 6; do
docker pull "$SOURCE" && exit 0
echo "pull failed, retry $attempt in 30s"
sleep 30
done
exit 1

- name: Push to GHCR
run: |
docker tag "$SOURCE" "$TARGET"
docker push "$TARGET"
4 changes: 1 addition & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
GO_FILES := $(shell find . -type f -name "*.go")
GO_BUILD := CGO_ENABLED=0 go build -ldflags "-w -s"
GO_TOOLS := public.ecr.aws/gridx/base-images:modbus-dev-1.21.latest
GO_TOOLS := ghcr.io/grid-x/modbus-dev:go1.21
DOCKER_RUN := docker run --init --rm -v $$PWD:/go/src/github.com/grid-x/modbus -w /go/src/github.com/grid-x/modbus
GO_RUN := ${DOCKER_RUN} ${GO_TOOLS} bash -c

BRANCH := $(shell echo ${BUILDKITE_BRANCH} | sed 's/\//_/g')

all: bin/

.PHONY: test
Expand Down
Loading