test: e2e testing #150
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests / Code Coverage | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened, labeled] | |
merge_group: | |
types: [checks_requested] | |
permissions: | |
contents: read | |
concurrency: | |
group: ci-${{ github.ref }}-tests | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
arch: [amd64, arm64] | |
targetos: [darwin, linux] | |
name: sedad ${{ matrix.targetos }}-${{ matrix.arch }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache binaries | |
id: cache-binaries | |
uses: actions/cache@v3 | |
with: | |
path: ./cmd/sedad/sedad | |
key: sedad-${{ matrix.targetos }}-${{ matrix.arch }} | |
- uses: technote-space/[email protected] | |
with: | |
PATTERNS: | | |
**/**.go | |
go.mod | |
go.sum | |
- name: Setup go | |
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF | |
uses: actions/setup-go@v4 | |
with: | |
go-version: "1.19" | |
cache: true | |
env: | |
GOOS: ${{ matrix.targetos }} | |
GOARCH: ${{ matrix.arch }} | |
- name: Compile | |
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF | |
run: | | |
go mod download | |
make build | |
build_push_e2e_image: | |
name: Build and Push e2e Image to GHCR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ghcr.io/sedaprotocol/seda-chaind-e2e | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./dockerfiles/Dockerfile.e2e | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v4 | |
with: | |
go-version: "1.21" | |
check-latest: true | |
cache: true | |
cache-dependency-path: go.sum | |
- uses: technote-space/[email protected] | |
id: git_diff | |
with: | |
PATTERNS: | | |
**/*.go | |
go.mod | |
go.sum | |
**/go.mod | |
**/go.sum | |
**/Makefile | |
Makefile | |
- name: test & coverage report creation | |
if: env.GIT_DIFF | |
run: make test-unit-cover | |
- uses: actions/upload-artifact@v3 | |
if: env.GIT_DIFF | |
with: | |
name: "${{ github.sha }}-${{ matrix.part }}-coverage" | |
path: ./${{ matrix.part }}profile.out | |