Update github workflows

In the integration_tests one, go is now installed using actions, therefore
the ansible go installation will be skipped.
This commit is contained in:
ionutboangiu
2023-08-11 11:43:35 -04:00
committed by Dan Christian Bogos
parent 2754f1e7d4
commit 353fc05440
6 changed files with 28 additions and 16 deletions

View File

@@ -27,10 +27,12 @@ jobs:
# 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
## 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
@@ -39,8 +41,7 @@ jobs:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
check-latest: true
go-version: "1.21.0"
- name: Go Format
run: gofmt -s -w . && git diff --exit-code

View File

@@ -29,6 +29,11 @@ jobs:
- 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:
@@ -41,11 +46,10 @@ jobs:
- 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"
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
source /etc/profile
./integration_test.sh
EOF

View File

@@ -16,6 +16,5 @@
- ../roles/kafka
- ../roles/mongodb
- ../roles/postgresql
- role: ../roles/go
when: install_go | bool | default(true)
- ../roles/go
- ../roles/cgrates

View File

@@ -13,7 +13,7 @@
mode: "u=rwx,go=rx"
owner: "{{ ansible_user }}"
dest: "{{ cgrates_dir }}"
when: clone_repository | bool | default(true)
when: clone_repository | bool
- name: Git clone cgrates
ansible.builtin.git:
@@ -22,7 +22,7 @@
update: yes
force: yes
version: "{{ git_version }}"
when: clone_repository | bool | default(true)
when: clone_repository | bool
- name: Build cgrates
ansible.builtin.shell:

View File

@@ -5,3 +5,4 @@ go_arch: amd64
go_tarball: go{{ go_version }}.{{ go_platform }}-{{ go_arch }}.tar.gz
go_download_url: https://dl.google.com/go/{{ go_tarball }}
go_checksum: "d0398903a16ba2232b389fb31032ddf57cac34efda306a0eebac34f0965a0742"
install_go: true

View File

@@ -10,27 +10,34 @@
state: absent
path: /usr/local/go
when:
- install_go | bool
- go_version_result is succeeded
- go_version not in go_version_result.stdout
- name: Download Go.
become: yes
get_url:
url: "{{ go_download_url }}"
dest: /usr/local/src/{{ go_tarball }}
checksum: "sha256:{{ go_checksum }}"
when: go_version_result is failed
or go_version not in go_version_result.stdout
when:
- install_go | bool
- (go_version_result is failed or go_version not in go_version_result.stdout)
- name: Extract Go.
become: yes
unarchive:
src: /usr/local/src/{{ go_tarball }}
dest: /usr/local
copy: no
when: go_version_result is failed
or go_version not in go_version_result.stdout
when:
- install_go | bool
- (go_version_result is failed or go_version not in go_version_result.stdout)
- name: Add Go to to system-wide $PATH.
become: yes
copy:
dest: /etc/profile.d/go-path.sh
content: |-
export PATH=$PATH:/usr/local/go/bin
when: install_go | bool