mirror of
https://github.com/krkn-chaos/krkn.git
synced 2026-04-15 06:57:28 +00:00
71 lines
2.4 KiB
YAML
71 lines
2.4 KiB
YAML
name: Build Krkn
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out code
|
|
uses: actions/checkout@v3
|
|
- name: Create multi-node KinD cluster
|
|
uses: redhat-chaos/actions/kind@main
|
|
- name: Install Python
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: '3.9'
|
|
architecture: 'x64'
|
|
- name: Install environment
|
|
run: |
|
|
sudo apt-get install build-essential python3-dev
|
|
pip install --upgrade pip
|
|
pip install -r requirements.txt
|
|
- name: Run unit tests
|
|
run: python -m coverage run -a -m unittest discover -s tests -v
|
|
- name: Run CI
|
|
run: |
|
|
./CI/run.sh
|
|
cat ./CI/results.markdown >> $GITHUB_STEP_SUMMARY
|
|
echo >> $GITHUB_STEP_SUMMARY
|
|
- name: Upload CI logs
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ci-logs
|
|
path: CI/out
|
|
if-no-files-found: error
|
|
- name: Collect coverage report
|
|
run: |
|
|
python -m coverage html
|
|
- name: Publish coverage report to job summary
|
|
run: |
|
|
pip install html2text
|
|
html2text --ignore-images --ignore-links -b 0 htmlcov/index.html >> $GITHUB_STEP_SUMMARY
|
|
- name: Upload coverage data
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: coverage
|
|
path: htmlcov
|
|
if-no-files-found: error
|
|
- name: Check CI results
|
|
run: grep Fail CI/results.markdown && false || true
|
|
- name: Build the Docker images
|
|
run: docker build --no-cache -t quay.io/redhat-chaos/krkn containers/
|
|
- name: Login in quay
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
run: docker login quay.io -u ${QUAY_USER} -p ${QUAY_TOKEN}
|
|
env:
|
|
QUAY_USER: ${{ secrets.QUAY_USER_1 }}
|
|
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN_1 }}
|
|
- name: Push the Docker images
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
run: docker push quay.io/redhat-chaos/krkn
|
|
- name: Rebuild krkn-hub
|
|
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
|
|
uses: redhat-chaos/actions/krkn-hub@main
|
|
with:
|
|
QUAY_USER: ${{ secrets.QUAY_USER_1 }}
|
|
QUAY_TOKEN: ${{ secrets.QUAY_TOKEN_1 }}
|