Skip to content

Commit

Permalink
chore: fix and run all CI test properly (#72)
Browse files Browse the repository at this point in the history
* remove the test skip for the wasm integration tests

* add unit test pipeline and improve the integration test pipeline

* add workflow for unit tests

* trigger integration CI

* fix the integration path

* fix workflow work dir

* add dynamic test run for all apps

* fix test output

* fix ci lint command

* use lint from tools

* downalod golangci-ling

* fix stratergy diffs

* fix app path for CI

* use RELATIVE for diff check

* fix relative path var

* fix relative path var

* fix lint matrix

* fix wasm unit tests

* fix lint pipeline

* fix lint and unit filters for ci

* download lint by curl

* remove invalid case

* rollbak lint

* skip wasm test until the new version

* remove unused concunrrency

* fix tests concunrrency

* remove duplicated serve chain and unused parametes

* remove unused random app name

* fix some lint issues

* fix the test chain id

* rollback config

* use ignite errors pkg

* rollback plush files

* run mod tidy

* fix makefile command to run unit tests without the integration

* fix name of the CI tests

* increase the cancel deadline time for health monitor integration tests

* use global consts for flag names and fix health monitor loop

* add close after flag for the health monitor app

* fix the test assert for the health monitor integration tests

* improve CI names

* fix lint issue

* fix makefile log

* fix lint into the makefile

* add github labels file

* fix makefile

* format .github/workflows/labeler.yml

* rollback template changes

* add ISSUE_TEMPLATE

* app request template

* add name of the app to issue template

---------

Co-authored-by: Pantani <Pantani>
  • Loading branch information
Pantani authored Mar 19, 2024
1 parent 2cfb6cd commit f62736f
Show file tree
Hide file tree
Showing 60 changed files with 656 additions and 324 deletions.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/app-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Ignite Apps feature request
about: Suggest an idea for this project
title: ''
labels: request
assignees: ''

---

**Is your App request related to a problem or issue you encountered? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions you've considered.

Include other useful information that helps us understand your request.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Ignite Apps bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---

**App**: Name of the app

**Describe the bug**
Tell us what you were doing and provide a clear and concise description of issue you encountered.

**To reproduce**
Steps to reproduce the behavior:
1.

**What version are you using?**

Provide the output of the `ignite version` command.
35 changes: 35 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
"component:ci":
- "!.github/labeler.yml"
- "!.github/labels.json"
- .github/**/*

"component:docs":
- README.md

"component:consumer":
- consumer/**/*

"component:examples":
- examples/**/*

"component:explorer":
- explorer/**/*

"type:hermes":
- hermes/**/*

"component:marketplace":
- marketplace/**/*

"type:wasm":
- wasm/**/*

"component:configs":
- .gitignore
- .golangci.yml
- app.ignite.yml
- CODE_OF_CONDUCT.md
- CONTRIBUTING.md
- go.work.example
- LICENSE
- Makefile
72 changes: 72 additions & 0 deletions .github/labels.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
[
{
"name": "bug",
"color": "d73a4a",
"description": "Something isn't working"
},
{
"name": "bug fix",
"color": "8a1d1c",
"description": "Functionality that fixes a bug"
},
{
"name": "dependencies",
"color": "5319e7",
"description": "Update to the dependencies"
},
{
"name": "docs",
"color": "0075ca",
"description": "Improvements or additions to documentation"
},
{
"name": "duplicate",
"color": "cfd3d7",
"description": "This issue or pull request already exists"
},
{
"name": "good first issue",
"color": "7057ff",
"description": "Good for newcomers"
},
{
"name": "help wanted",
"color": "008672",
"description": "Extra attention is needed"
},
{
"name": "breaking change",
"color": "a7327e",
"description": "Functionality that contains breaking changes"
},
{
"name": "don't merge",
"color": "b60205",
"description": "Please don't merge this functionality temporarily"
},
{
"name": "feature",
"color": "ffb703",
"description": "New update to Gno"
},
{
"name": "hotfix",
"color": "003049",
"description": "Major bug fix that should be merged ASAP"
},
{
"name": "info needed",
"color": "54eba0",
"description": "More information needed"
},
{
"name": "question",
"color": "fbca04",
"description": "Questions about Gno"
},
{
"name": "investigating",
"color": "8c008c",
"description": "This behavior is still being tested out"
}
]
16 changes: 16 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Pull Request Labeler"
on:
- pull_request_target

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v4
32 changes: 22 additions & 10 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Integration
on:
pull_request:
paths:
- '**.go'
- '**/go.mod'
- '**/go.sum'
- '**/testdata/**'
push:
paths:
- '**.go'
Expand All @@ -20,13 +25,14 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/[email protected]
- uses: actions/checkout@v4

- name: Finding files and store to output
id: set-matrix
run: echo "matrix=$(find . -type d -name "integration" -exec dirname {} \; | sort -u | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT
run: echo "matrix=$(find . -type d -name "integration" -exec sh -c 'dirname "{}" | cut -c 3-' \; | sort -u | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT

integration:
name: test ${{ matrix.test-path }}
name: ${{ matrix.test-path }}
runs-on: ubuntu-latest
needs: pre-test
if: fromJSON(needs.pre-test.outputs.matrix)[0] != null
Expand All @@ -35,17 +41,22 @@ jobs:
fail-fast: true
matrix:
test-path: ${{fromJson(needs.pre-test.outputs.matrix)}}

steps:
- uses: actions/[email protected]
- uses: actions/checkout@v4

- uses: technote-space/[email protected]
with:
RELATIVE: ${{ matrix.test-path }}
PATTERNS: |
${{ matrix.test-path }}/**/*.go
${{ matrix.test-path }}/*/go.mod
${{ matrix.test-path }}/*/go.sum
!${{ matrix.test-path }}/README.md
**/*.go
**/*.plush
**/*.tpl
go.mod
go.sum
**/testdata/**
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: 'stable'
Expand All @@ -55,7 +66,8 @@ jobs:
env:
GOTOOLCHAIN: local+path
GOSUMDB: off
run: go test -v -timeout 120m ${{ matrix.test-path }}/integration/...
run: go test -race -failfast -v -timeout 120m ./integration/...
working-directory: ${{ matrix.test-path }}

status:
runs-on: ubuntu-latest
Expand Down
11 changes: 7 additions & 4 deletions .github/workflows/test-lint.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Lint
name: Static Analysis
on:
pull_request:
push:
Expand All @@ -13,20 +13,23 @@ concurrency:

jobs:
lint:
name: 'Lint Go Code'
name: "govet | govulncheck | lint"
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: actions/checkout@v4

- uses: technote-space/[email protected]
with:
PATTERNS: |
**/*.go
*/go.mod
*/go.sum
- uses: actions/setup-go@v4
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.21'

- name: Run Lint Tests
if: env.GIT_DIFF
env:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Test Unit
on:
pull_request:
paths-ignore:
- '**.md'
push:
paths-ignore:
- '**.md'
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
pre-test:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

- name: Finding files and store to output
id: set-matrix
run: echo "matrix=$(find . -type f -name "go.mod" -exec sh -c 'dirname "{}" | cut -c 3-' \; | sort -u | jq -R . | jq -cs .)" >> $GITHUB_OUTPUT

unit:
name: ${{ matrix.test-path }}
runs-on: ubuntu-latest
needs: pre-test
if: fromJSON(needs.pre-test.outputs.matrix)[0] != null
continue-on-error: false
strategy:
fail-fast: true
matrix:
test-path: ${{fromJson(needs.pre-test.outputs.matrix)}}

steps:
- uses: actions/checkout@v4

- uses: technote-space/[email protected]
with:
RELATIVE: ${{ matrix.test-path }}
PATTERNS: |
**/*.go
**/*.plush
**/*.tpl
go.mod
go.sum
**/testdata/**
- uses: actions/setup-go@v5
if: env.GIT_DIFF
with:
go-version: '1.21'

- name: Run Unit Tests
if: env.GIT_DIFF
env:
GOTOOLCHAIN: local+path
GOSUMDB: off
run: go test -race -failfast -v -timeout 120m $(go list ./... | grep -v integration)
working-directory: ${{ matrix.test-path }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.ign
go.work
go.work.sum
bin/*
16 changes: 15 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ linters:
enable:
- bodyclose
- decorder
#- depguard
#- depguard
- dogsled
- dupword
- errchkjson
Expand Down Expand Up @@ -37,6 +37,20 @@ linters:
- unparam
- misspell

linters-settings:
forbidigo:
forbid:
- p: ^fmt\.Errorf$
msg: fmt.Errorf should be replaced by '"github.com/ignite/cli/ignite/pkg/errors"'
depguard:
rules:
main:
deny:
- pkg: "errors"
desc: Should be replaced by '"github.com/ignite/cli/ignite/pkg/errors"'
- pkg: "github.com/pkg/errors"
desc: Should be replaced by '"github.com/ignite/cli/ignite/pkg/errors"'

issues:
max-issues-per-linter: 0
max-same-issues: 0
Loading

0 comments on commit f62736f

Please sign in to comment.