mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 10:06:24 +05:00
Add github actions workflows for unit and it tests
This commit is contained in:
committed by
Dan Christian Bogos
parent
553508d1ff
commit
3c1e70dcbe
68
.github/workflows/build.yaml
vendored
Normal file
68
.github/workflows/build.yaml
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
name: Build & Unit Tests
|
||||
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
# check-if-duplicate-action:
|
||||
# continue-on-error: true
|
||||
# runs-on: ubuntu-latest
|
||||
# outputs:
|
||||
# should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
||||
# steps:
|
||||
# - id: skip_check
|
||||
# uses: fkirc/skip-duplicate-actions@v5
|
||||
# with:
|
||||
# concurrent_skipping: 'never'
|
||||
# skip_after_successful_duplicate: 'true'
|
||||
# paths_ignore: '["master/docs/**"]'
|
||||
# paths: '["master/**.go", "master/.github"]'
|
||||
|
||||
build:
|
||||
# needs: check-if-duplicate-action
|
||||
# if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
go: ["stable"] # could be a good idea to consider oldstable as well
|
||||
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: ${{ matrix.go }}
|
||||
check-latest: true
|
||||
|
||||
- name: Go Format
|
||||
run: gofmt -s -w . && git diff --exit-code
|
||||
|
||||
- name: Go Vet
|
||||
continue-on-error: true # option will soon be removed
|
||||
run: go vet ./...
|
||||
|
||||
- name: Go Tidy
|
||||
run: go mod tidy && git diff --exit-code
|
||||
|
||||
- name: Go Mod
|
||||
run: go mod download
|
||||
|
||||
- name: Go Mod Verify
|
||||
run: go mod verify
|
||||
|
||||
- name: Go Build
|
||||
run: ./build.sh
|
||||
|
||||
- name: Go Test
|
||||
run: go test -count=1 ./... # should probably also add -race flag in the future
|
||||
|
||||
- name: Go Benchmark
|
||||
run: go test -run=- -bench=. -benchtime=1x ./...
|
||||
51
.github/workflows/integration_tests.yaml
vendored
Normal file
51
.github/workflows/integration_tests.yaml
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
name: Integration Tests
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [master]
|
||||
pull_request:
|
||||
branches: [master]
|
||||
|
||||
jobs:
|
||||
# check-if-duplicate-action:
|
||||
# # continue-on-error: true # Uncomment once integration is finished
|
||||
# runs-on: ubuntu-latest
|
||||
# outputs:
|
||||
# should_skip: ${{ steps.skip_check.outputs.should_skip }}
|
||||
# steps:
|
||||
# - id: skip_check
|
||||
# uses: fkirc/skip-duplicate-actions@v5
|
||||
# with:
|
||||
# concurrent_skipping: 'never'
|
||||
# skip_after_successful_duplicate: 'true'
|
||||
# paths_ignore: '["master/docs/**"]'
|
||||
# paths: '["master/**.go", "master/*.sh", "master/.github", "master/data/ansible/conf/samples/**", "master/data/tariffplans"]'
|
||||
|
||||
integration-tests:
|
||||
# needs: check-if-duplicate-action
|
||||
# if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: "3.x"
|
||||
|
||||
- name: Install Ansible
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install ansible
|
||||
|
||||
- name: Run Ansible Playbook
|
||||
run: |
|
||||
ansible-playbook data/ansible/integration_tests/main.yaml -i localhost, -c local -e "ansible_user=$(whoami)"
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
sudo su <<EOF
|
||||
source /etc/profile
|
||||
./integration_test.sh
|
||||
EOF
|
||||
2
go.mod
2
go.mod
@@ -29,6 +29,7 @@ require (
|
||||
github.com/cgrates/ugocodec v0.0.0-20201023092048-df93d0123f60
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6
|
||||
github.com/elastic/go-elasticsearch/v8 v8.8.0
|
||||
github.com/ericlagergren/decimal v0.0.0-20191206042408-88212e6cfca9
|
||||
github.com/fiorix/go-diameter/v4 v4.0.2
|
||||
@@ -70,7 +71,6 @@ require (
|
||||
github.com/couchbase/ghistogram v0.1.0 // indirect
|
||||
github.com/couchbase/moss v0.1.0 // indirect
|
||||
github.com/couchbase/vellum v1.0.2 // indirect
|
||||
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6 // indirect
|
||||
github.com/frankban/quicktest v1.11.3 // indirect
|
||||
github.com/glycerine/go-unsnap-stream v0.0.0-20190901134440-81cf024a9e0a // indirect
|
||||
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
|
||||
|
||||
2
go.sum
2
go.sum
@@ -135,8 +135,6 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8
|
||||
github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU=
|
||||
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6 h1:1+44gxLdKRnR/Bx/iAtr+XqNcE4e0oODa63+FABNANI=
|
||||
github.com/elastic/elastic-transport-go/v8 v8.0.0-20230329154755-1a3c63de0db6/go.mod h1:87Tcz8IVNe6rVSLdBux1o/PEItLtyabHU3naC7IoqKI=
|
||||
github.com/elastic/go-elasticsearch v0.0.0 h1:Pd5fqOuBxKxv83b0+xOAJDAkziWYwFinWnBO0y+TZaA=
|
||||
github.com/elastic/go-elasticsearch v0.0.0/go.mod h1:TkBSJBuTyFdBnrNqoPc54FN0vKf5c04IdM4zuStJ7xg=
|
||||
github.com/elastic/go-elasticsearch/v8 v8.8.0 h1:yNBPlXNo6wstMG7I3KiZPbLFgA82RMryYqkh1xBMV3A=
|
||||
github.com/elastic/go-elasticsearch/v8 v8.8.0/go.mod h1:NGmpvohKiRHXI0Sw4fuUGn6hYOmAXlyCphKpzVBiqDE=
|
||||
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
|
||||
Reference in New Issue
Block a user