Skip to content

Merge pull request #8 from vnsamsonov/feat/validate-connectors #27

Merge pull request #8 from vnsamsonov/feat/validate-connectors

Merge pull request #8 from vnsamsonov/feat/validate-connectors #27

Workflow file for this run

name: CI
on:
push:
branches:
- '**'
tags:
- 'v*.*.*'
pull_request:
branches:
- '**'
jobs:
lint:
name: Linter
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8.15
cache: poetry
- run: poetry install
- run: poetry run pylint ./k8s-itlabs-operator
unit-tests:
name: Run unit-tests
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Poetry
run: pipx install poetry
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8.15
cache: poetry
- run: poetry install
- run: poetry run pytest -m unit ./k8s-itlabs-operator
e2e-tests:
name: Run e2e-tests
runs-on: ubuntu-latest
container:
image: docker:20.10.17
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run tests
env:
KUBECTL: v1.24.15
KIND: v0.20.0
DOCKER_IMAGE: operator:test
MANIFEST_FOLDER: ./manifests
run: |
apk add --no-cache procps
chmod +x e2e_tests/e2e-tests.sh
./e2e_tests/e2e-tests.sh
push-to-registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [lint, unit-tests, e2e-tests]
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Log in to Docker Hub
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: itlabsio/k8s-itlabs-operator
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
file: ./docker/Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
create-release:
name: Create release
runs-on: ubuntu-latest
if: github.ref_type == 'tag'
needs: [lint, unit-tests, e2e-tests]
steps:
- name: Checkout repo
uses: actions/checkout@v3
- name: Build changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
configurationJson: |
{
"template": "#{{CHANGELOG}}\n\n<details>\n<summary>Uncategorized</summary>\n\n#{{UNCATEGORIZED}}\n</details>",
"categories": [
{
"title": "## 🚀 Features",
"labels": ["feature"]
},
{
"title": "## 🐛 Fixes",
"labels": ["fix"]
},
{
"title": "## 🔧 Refactoring",
"labels": ["refactor"]
},
{
"title": "## 🧪 Tests",
"labels": ["test"]
},
{
"title": "## ❗ Breaking changes",
"labels": ["breaking"]
},
{
"title": "## 💬 Other",
"labels": ["other"]
}
]
}
- name: Prepare manifest
env:
DOCKER_IMAGE: itlabsio/k8s-itlabs-operator:${{ github.ref_name }}
MANIFEST_FOLDER: ./manifests/
run: |
chmod +x scripts/update-manifests.sh
./scripts/update-manifests.sh
- name: Create manifests pack
run: |
zip -r manifests.zip manifests
- name: Upload manifests
uses: actions/upload-artifact@v3
with:
name: manifests
path: manifests
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: ${{ steps.build_changelog.outputs.changelog }}
- name: Upload release asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./manifests.zip
asset_name: manifests.zip
asset_content_type: application/zip