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: move ictest to use archive.tar instead of ghcr #788

Merged
merged 13 commits into from
Aug 14, 2023
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
build/
build/
.github/
interchaintest/
*.md
15 changes: 9 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,29 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: 1.20.7

jobs:
build:
runs-on: ubuntu-latest
name: build
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20.0
go-version: ${{ env.GO_VERSION }}
- run: go build ./...

test:
runs-on: ubuntu-latest
name: test
steps:
- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20.0
go-version: ${{ env.GO_VERSION }}
- name: Checkout code
uses: actions/checkout@v3
- name: Test
Expand All @@ -42,9 +45,9 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Setup go
uses: actions/setup-go@v3
uses: actions/setup-go@v4
with:
go-version: 1.20.0
go-version: ${{ env.GO_VERSION }}
- run: |
go mod tidy
CHANGES_IN_REPO=$(git status --porcelain)
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: 1.20.7

jobs:
analyze:
name: Analyze
Expand All @@ -29,9 +32,9 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: 1.20.0
go-version: ${{ env.GO_VERSION }}
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,17 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
GO_VERSION: 1.20.7

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v3
- uses: actions/setup-go@v4
with:
go-version: 1.20.0
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v3

- name: golangci-lint-junod
Expand Down
172 changes: 56 additions & 116 deletions .github/workflows/interchaintest-E2E.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,152 +4,92 @@ on:
pull_request:
push:
tags:
- '**'
- "**"
branches:
- 'main'
- 'master'
- "main"
- "master"

permissions:
contents: read
packages: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-e2e
GO_VERSION: 1.19
GO_VERSION: 1.20.7
TAR_PATH: /tmp/juno-docker-image.tar
IMAGE_NAME: juno-docker-image

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

jobs:
build-and-push-image:
build-docker:
runs-on: ubuntu-latest
outputs:
branchTag: ${{ steps.meta.outputs.version }}
permissions:
contents: read
packages: write

steps:
- name: Checkout repository
- name: Checkout
uses: actions/checkout@v3

# We setup go & cache dependencies here. This way each child job
# does not have to reinstall all dependencies individually.
# Should ID be unique to this job only?
- name: Setup Golang with cache
uses: magnetikonline/action-golang-cache@v4
- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
id: go

- name: Download dependencies
run: |
go mod download
cd interchaintest && go mod download

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
cache-dependency-path: interchaintest/go.sum

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: push
- name: Build and export
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max

# make juno:branchname here for all needs.build-and-push-image.outputs.branchTag
# then upload to github. Then download for each as a cache. This way its only built once

test-juno-basic:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-basic
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}

test-juno-ibc:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-ibc
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
tags: juno:local
outputs: type=docker,dest=${{ env.TAR_PATH }}

test-juno-upgrade:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-upgrade
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}

test-juno-tokenfactory:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-tokenfactory
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.TAR_PATH }}

test-juno-feeshare:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-feeshare
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
e2e-tests:
needs: build-docker
runs-on: ubuntu-latest
strategy:
matrix:
# names of `make` commands to run tests
test:
- "ictest-basic"
- "ictest-ibchooks"
- "ictest-tokenfactory"
- "ictest-feeshare"
- "ictest-pfm"
- "ictest-upgrade"
- "ictest-ibc"
- "ictest-unity-deploy"
- "ictest-unity-gov"
- "ictest-pob"
fail-fast: false

test-juno-ibchooks:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-ibchooks
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: interchaintest/go.sum

# === UNITY CONTRACT ===
test-juno-unity-deploy:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-unity-deploy
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
- name: checkout chain
uses: actions/checkout@v3

test-juno-unity-gov:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-unity-gov
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: /tmp

test-juno-pfm:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-pfm
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
- name: Load Docker Image
run: |
docker image load -i ${{ env.TAR_PATH }}
docker image ls -a

test-pob:
needs: build-and-push-image
uses: ./.github/workflows/make-cmd-runner.yml
with:
make-command: ictest-pob
branch-tag: ${{needs.build-and-push-image.outputs.branchTag}}
- name: Run Test
run: make ${{ matrix.test }}
31 changes: 0 additions & 31 deletions .github/workflows/make-cmd-runner.yml

This file was deleted.

2 changes: 1 addition & 1 deletion contrib/devtools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# docker run --rm -v $(pwd):/workspace --workdir /workspace cosmossdk-proto sh ./scripts/protocgen.sh

FROM bufbuild/buf:1.9.0 as BUILDER
FROM golang:1.19-alpine
FROM golang:1.20-alpine

RUN apk add --no-cache \
nodejs \
Expand Down
23 changes: 16 additions & 7 deletions interchaintest/chain_upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,38 @@ import (
)

const (
chainName = "juno"
upgradeName = "v17"

haltHeightDelta = uint64(9) // will propose upgrade this many blocks in the future
blocksAfterUpgrade = uint64(7)
)

var (
// baseChain is the current version of the chain that will be upgraded from
baseChain = ibc.DockerImage{
Repository: JunoMainRepo,
Version: "v16.0.0",
UidGid: "1025:1025",
}
)

func TestBasicJunoUpgrade(t *testing.T) {
repo, version := GetDockerImageInfo()
startVersion := "v16.0.0"
upgradeName := "v17"
CosmosChainUpgradeTest(t, "juno", startVersion, version, repo, upgradeName)
CosmosChainUpgradeTest(t, chainName, version, repo, upgradeName)
}

func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeBranchVersion, upgradeRepo, upgradeName string) {
func CosmosChainUpgradeTest(t *testing.T, chainName, upgradeBranchVersion, upgradeRepo, upgradeName string) {
if testing.Short() {
t.Skip("skipping in short mode")
}

t.Parallel()

t.Log(chainName, initialVersion, upgradeBranchVersion, upgradeRepo, upgradeName)
t.Log(chainName, upgradeBranchVersion, upgradeRepo, upgradeName)

numVals, numNodes := 4, 4
chains := CreateThisBranchChain(t, numVals, numNodes)
chains := CreateChain(t, numVals, numNodes, baseChain)
chain := chains[0].(*cosmos.CosmosChain)

ic, ctx, client, _ := BuildInitialChain(t, chains)
Expand All @@ -62,7 +72,6 @@ func CosmosChainUpgradeTest(t *testing.T, chainName, initialVersion, upgradeBran
ValidatorVoting(t, ctx, chain, proposalID, height, haltHeight)

UpgradeNodes(t, ctx, chain, client, haltHeight, upgradeRepo, upgradeBranchVersion)

}

func UpgradeNodes(t *testing.T, ctx context.Context, chain *cosmos.CosmosChain, client *client.Client, haltHeight uint64, upgradeRepo, upgradeBranchVersion string) {
Expand Down
Loading
Loading