Skip to content

try remove golangci config #595

try remove golangci config

try remove golangci config #595

Workflow file for this run

name: Tests
on:
push:
branches:
- '**'
tags:
- '*'
env:
SM_TAG_NAME: ${{ github.sha }}
jobs:
sm-client-unittest:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.12" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get python version
run: python --version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-sc-test.txt -r requirements-sc.txt
- name: Run tests
id: unittests
run: python -m pytest tests/selftest
- name: Collect artifacts
if: failure() && steps.unittests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: unittest-logs
path: pytest.log
retention-days: 7
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.12" ]
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Get python version
run: python --version
- name: Get Docker-compose version
run: docker compose version
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-sc-test.txt -r requirements-sc.txt
- name: Run tests
id: integrationtests
run: python -m pytest tests/integration
- name: Collect artifacts
if: failure() && steps.integrationtests.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: integration-tests-logs
path: test-dump/
retention-days: 7
site-manager-unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run tests
run: |
cd site-manager
go test -vet=all -shuffle=on -v ./tests/
paas-geo-monitor-unittest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Run tests
run: |
cd paas-geo-monitor
go test -vet=all -shuffle=on -v ./...
publish-test-sm-dummy-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t ghcr.io/netcracker/sm-dummy:${{ env.SM_TAG_NAME }} tests/sm-dummy
- run: echo ${{secrets.GITHUB_TOKEN}} | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- run: docker push ghcr.io/netcracker/sm-dummy:${{ env.SM_TAG_NAME }}
publish-test-site-manager-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: docker build -t ghcr.io/netcracker/site-manager:${{ env.SM_TAG_NAME }} site-manager
- run: echo ${{secrets.GITHUB_TOKEN}} | docker login https://ghcr.io -u ${GITHUB_ACTOR} --password-stdin
- run: docker push ghcr.io/netcracker/site-manager:${{ env.SM_TAG_NAME }}
cloud-tests:
needs: [publish-test-sm-dummy-image, publish-test-site-manager-image]
runs-on: ubuntu-22.04
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Set up Python 3.12
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Ssh preparation
run: |
ssh-keygen -t rsa -b 4096 -N "" -f ~/.ssh/id_rsa -q
cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys
ssh-keyscan -H 172.17.0.1 >> ~/.ssh/known_hosts
mkdir -p results/logs
- name: Remove moby-runc to resolve conflicts
run: sudo apt remove moby-runc
- name: Install kubemarine & yq package
run: pip3 install kubemarine yq
# TODO: change to kubemarine runtime values feature
- name: Generate certs
run: |
sudo openssl req -days 730 -nodes -new -x509 -keyout ./ca.key -out ./ca.crt -subj "/CN=SM service"
sudo openssl genrsa -out ./site-manager-tls.key 2048
sudo openssl req -new -key ./site-manager-tls.key -subj "/CN=site-manager.site-manager.svc" -config ./ci/cloud-tests/server.conf | \
sudo openssl x509 -req -days 730 -CA ./ca.crt -CAkey ./ca.key -CAcreateserial -out ./site-manager-tls.crt -extensions v3_req -extfile ./ci/cloud-tests/server.conf
sudo chmod 644 site-manager-tls.key
- name: Add runtime values to cluster.yaml
run: |
sed -i "s/<REGISTRY_USER>/${GITHUB_ACTOR}/; s/<REGISTRY_PASSWORD>/${{secrets.GITHUB_TOKEN}}/; s/<SM_TAG>/${{ env.SM_TAG_NAME }}/" ci/cloud-tests/cluster.yaml
python3 -m yq -i -y ' .plugins."site-manager".installation.procedures[1].helm.values.tls.ca |= "'"$(< ca.crt)"'"' ci/cloud-tests/cluster.yaml
python3 -m yq -i -y ' .plugins."site-manager".installation.procedures[1].helm.values.tls.crt |= "'"$(< site-manager-tls.crt)"'"' ci/cloud-tests/cluster.yaml
python3 -m yq -i -y ' .plugins."site-manager".installation.procedures[1].helm.values.tls.key |= "'"$(< site-manager-tls.key)"'"' ci/cloud-tests/cluster.yaml
- name: Run kubemarine install with site-manager and sm-dummy
run: kubemarine install -c ./ci/cloud-tests/cluster.yaml --disable-cumulative-points --dump-location ./results/kubemarine/
- name: Install dependencies
run: |
pip3 install -r requirements-sc-test.txt -r requirements-sc.txt
- name: Run tests on cluster
run: python3 -m pytest tests/cloud_test --kubeconfig='./kubeconfig'
- name: Get SM logs from pod
if: failure()
run: sudo kubectl logs -n site-manager -l app=site-manager -c site-manager > ./results/logs/sm.log
- name: Get service-a from pod
if: failure()
run: sudo kubectl logs -n test-services -l app=service-a > ./results/logs/service-a.log
- name: Get service-b from pod
if: failure()
run: sudo kubectl logs -n test-services -l app=service-b > ./results/logs/service-b.log
- name: Collect kubemarine artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: kubemarine dumps
path: ./results/kubemarine/
retention-days: 7
- name: Collect SM artifacts
if: failure()
uses: actions/upload-artifact@v4
with:
name: site-manager logs
path: ./results/logs
retention-days: 7
remove-test-site-manager-image:
needs: [cloud-tests]
if: ${{ always() && needs.publish-test-site-manager-image.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Delete image site-manager
uses: bots-house/ghcr-delete-image-action@v1.1.0
with:
owner: netcracker
name: site-manager
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.SM_TAG_NAME }}
remove-test-sm-dummy-image:
needs: [cloud-tests]
if: ${{ always() && needs.publish-test-sm-dummy-image.result == 'success' }}
runs-on: ubuntu-latest
steps:
- name: Delete image sm-dummy
uses: bots-house/ghcr-delete-image-action@v1.1.0
with:
owner: netcracker
name: sm-dummy
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.SM_TAG_NAME }}