Skip to content

Commit

Permalink
better tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wanwiset25 committed Apr 4, 2024
1 parent 704629e commit 98bb6dd
Showing 1 changed file with 43 additions and 13 deletions.
56 changes: 43 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
workflow_dispatch: #allow manual trigger to workflow

jobs:
test_build_and_push_to_docker_registry:
test_golang:
name: Test, build and push image to registry
runs-on: ubuntu-latest
env:
Expand All @@ -17,12 +17,47 @@ jobs:
defaults:
run:
working-directory: ${{ env.GOPATH }}/src/XDC-Subnet
strategy:
matrix:
include:
- name: A-B tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/[a-b].*")
- name: C-[a-m] tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/c[a-m].*")
- name: C-[n-o] tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/c[n-o].*")
- name: C-[p-z] tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/c[p-z].*")
- name: D-I tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/[d-i].*")
- name: J-N tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/[j-n].*")
- name: O-R tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/[o-r].*")
- name: S tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/s.*")
- name: T-Z tests
script: go run build/ci.go test -coverage $(go list ./... | grep "github.com/XinFinOrg/XDPoSChain/[t-z].*")
steps:
- name: Check out code
uses: actions/checkout@v3
with:
path: ${{ env.GOPATH }}/src/XDC-Subnet

- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: ${{ matrix.script }}
env:
GO111MODULE: auto

test_nodejs:
name: Run nodejs tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v1
with:
Expand All @@ -32,16 +67,12 @@ jobs:
cd contracts/validator/src
yarn
npx hardhat test
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
with:
go-version: "1.21.x" # The Go version to download (if necessary) and use.
- name: Run tests
run: |
make test
env:
GO111MODULE: auto
build:
needs: [test_golang, test_nodejs]
name: Build and push image to registry
runs-on: ubuntu-latest
steps:
- name: Docker login
env:
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
Expand All @@ -61,5 +92,4 @@ jobs:
- name: Build and push image
run: |
docker build . --file docker/Dockerfile --tag ${{ steps.image.outputs.name }}
docker push ${{ steps.image.outputs.name }}
docker push ${{ steps.image.outputs.name }}

0 comments on commit 98bb6dd

Please sign in to comment.