mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Import github workflows
This commit is contained in:
committed by
Dan Christian Bogos
parent
bbf1eaf439
commit
c2caaba4e1
69
.github/workflows/build.yaml
vendored
Normal file
69
.github/workflows/build.yaml
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
name: Build & Unit Tests
|
||||
|
||||
permissions: {}
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [1.0]
|
||||
pull_request:
|
||||
branches: [1.0]
|
||||
|
||||
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: '["1.0/docs/**"]'
|
||||
# paths: '["1.0/**.go", "1.0/.github"]'
|
||||
|
||||
build:
|
||||
# needs: check-if-duplicate-action
|
||||
# if: needs.check-if-duplicate-action.outputs.should_skip != 'true'
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
## Currently prefer to run tests for a single static go version
|
||||
# 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: "1.21.0"
|
||||
|
||||
- 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 ./...
|
||||
55
.github/workflows/integration_tests.yaml
vendored
Normal file
55
.github/workflows/integration_tests.yaml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Integration Tests
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches: [1.0]
|
||||
pull_request:
|
||||
branches: [1.0]
|
||||
|
||||
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: '["1.0/docs/**"]'
|
||||
# paths: '["1.0/**.go", "1.0/*.sh", "1.0/.github", "1.0/data/ansible/conf/samples/**", "1.0/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: Install Go
|
||||
uses: actions/setup-go@v4
|
||||
with:
|
||||
go-version: "1.21.0"
|
||||
|
||||
- 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) cgrates_dir=$GITHUB_WORKSPACE clone_repository=false install_go=false"
|
||||
|
||||
- name: Run integration tests
|
||||
run: |
|
||||
sudo su <<EOF
|
||||
./integration_test.sh
|
||||
EOF
|
||||
Reference in New Issue
Block a user