Skip to content

Commit

Permalink
chore: avoid template and reuse dockers
Browse files Browse the repository at this point in the history
  • Loading branch information
RafilxTenfen committed Aug 7, 2024
1 parent 6dfb5d3 commit 4f056d3
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 31 deletions.
119 changes: 94 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,98 @@ on:
- '**'

jobs:
free-disk-space:
runs-on: ubuntu-latest
build:
runs-on: ubuntu-22.04
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true

lint_test:
needs: free-disk-space
uses: babylonlabs-io/.github/.github/workflows/[email protected]
secrets: inherit
with:
run-unit-tests: true
run-integration-tests: true
run-lint: true
integration-tests-command: |
sudo make test-e2e
# docker_pipeline:
# uses: babylonlabs-io/.github/.github/workflows/[email protected]
# secrets: inherit
# with:
# publish: false
# dockerfile: ./contrib/images/babylond/Dockerfile
# repoName: babylond
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Print Go environment
run: go env

- name: Build Application
run: make build

# needs: build, in other jobs is to utilize the go cache created by build
lint:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Run Lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.59
args: --timeout=10m

unit-tests:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Run Unit Tests
run: |
make test
check-mock-gen:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.21

- name: Run make mock-gen
run: make mocks

- name: Check for uncommitted changes
run: |
if ! git diff --exit-code; then
echo "Uncommitted changes detected. Please run 'make mocks' before committing."
exit 1
fi
build-integration-tests:
needs: build
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build E2E Dockers
run: |
sudo make build-docker-e2e
run-integration-tests:
needs: build-integration-tests
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Run E2E Tests
run: |
sudo make test-e2e-cache
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,10 @@ endif

.PHONY: run-tests test test-all $(TEST_TARGETS)

test-e2e: build-docker-e2e
go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1 --tags=e2e
test-e2e: build-docker-e2e test-e2e-cache

test-e2e-cache:
go test -mod=readonly -timeout=60m -v $(PACKAGES_E2E) -count=1 --tags=e2e

test-sim-nondeterminism:
@echo "Running non-determinism test..."
Expand Down
8 changes: 4 additions & 4 deletions contrib/images/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ BABYLON_VERSION_BEFORE_UPGRADE ?= v0.9.0

all: babylond cosmos-relayer

babylond: babylond-rmi
babylond:
docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_FULL_PATH}

babylond-e2e: babylond-rmi
babylond-e2e:
docker build --tag babylonlabs-io/babylond -f babylond/Dockerfile ${BABYLON_FULL_PATH} \
--build-arg BUILD_TAGS="e2e" --progress=plain
--build-arg BUILD_TAGS="e2e"

## TODO: once release docker public versions for tags, remove this!
babylond-before-upgrade:
docker build --tag babylonlabs-io/babylond-before-upgrade -f babylond/Dockerfile --progress=plain \
docker build --tag babylonlabs-io/babylond-before-upgrade -f babylond/Dockerfile \
--build-arg VERSION="${BABYLON_VERSION_BEFORE_UPGRADE}" ${BABYLON_FULL_PATH}

babylond-rmi:
Expand Down

0 comments on commit 4f056d3

Please sign in to comment.