Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests for PRs #72

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 7 additions & 49 deletions .github/workflows/check.yaml → .github/workflows/check_main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,55 +45,13 @@ jobs:
needs:
- start-vm
- checkout
runs-on: ${{ needs.start-vm.outputs.label }}
env:
HOME: /root
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.11.2

- name: Build
shell: bash
run: |
make build

- name: Run tests
shell: bash
run: |
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.19.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster --retain -v 100
kubectl get pod
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml

make helm-kind-install
docker pull ytsaurus/ytsaurus-nightly:dev-23.1-5f8638fc66f6e59c7a06708ed508804986a6579f
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.1-5f8638fc66f6e59c7a06708ed508804986a6579f
docker pull ytsaurus/ytsaurus-nightly:dev-23.1-9779e0140ff73f5a786bd5362313ef9a74fcd0de
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.1-9779e0140ff73f5a786bd5362313ef9a74fcd0de
docker pull ytsaurus/ytsaurus-nightly:dev-23.2-62a472c4efc2c8395d125a13ca0216720e06999d
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.2-62a472c4efc2c8395d125a13ca0216720e06999d
YTSAURUS_ENABLE_E2E_TESTS=true make test
helm uninstall ytsaurus

./compat_test.sh --from-version 0.4.1 --to-version trunk

- name: Docker Hub login
run: |
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin

- name: Docker
shell: bash
run: |
make release RELEASE_VERSION=0.0.$(git rev-list --count HEAD)-dev-${GITHUB_SHA} OPERATOR_IMAGE=ytsaurus/k8s-operator-nightly OPERATOR_CHART=ytop-chart-nightly
with:
runs-on-value: ${{ needs.start-vm.outputs.label }}
release: true
secrets:
DOCKER_HUB_LOGIN: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
uses: ./.github/workflows/subflow_run_e2e.yaml

stop-vm:
name: Stop VM
Expand Down
70 changes: 70 additions & 0 deletions .github/workflows/check_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Build and test

on:
pull_request:

jobs:
start-vm:
if: github.event.pull_request.head.repo.full_name == github.repository
name: Start VM
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-yc-runner.outputs.label }}
instance-id: ${{ steps.start-yc-runner.outputs.instance-id }}
steps:
- name: Start YC runner
id: start-yc-runner
uses: yc-actions/yc-github-runner@v1
with:
mode: start
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
folder-id: ${{ vars.YC_FOLDER_ID }}
image-id: ${{ vars.YC_DEFAULT_IMAGE_ID }}
zone-id: ${{ vars.YC_ZONE_ID }}
subnet-id: ${{ vars.YC_SUBNET_ID }}
cores: 4
memory: 8GB
core-fraction: 100
disk-type: network-ssd-nonreplicated
disk-size: 93GB

checkout:
name: Checkout sources
needs: start-vm
runs-on: ${{ needs.start-vm.outputs.label }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

check:
name: Run checks
needs:
- start-vm
- checkout
with:
runs-on-value: ${{ needs.start-vm.outputs.label }}
release: false
secrets:
DOCKER_HUB_LOGIN: ${{ secrets.DOCKER_HUB_LOGIN }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
uses: ./.github/workflows/subflow_run_e2e.yaml

stop-vm:
name: Stop VM
needs:
- start-vm
- check
runs-on: ubuntu-latest
if: ${{ always() }}
steps:
- name: Stop YC runner
uses: yc-actions/yc-github-runner@v1
with:
mode: stop
yc-sa-json-credentials: ${{ secrets.YC_SA_JSON_CREDENTIALS }}
github-token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
label: ${{ needs.start-vm.outputs.label }}
instance-id: ${{ needs.start-vm.outputs.instance-id }}
69 changes: 69 additions & 0 deletions .github/workflows/subflow_run_e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
on:
workflow_call:
inputs:
runs-on-value:
required: true
type: string
release:
required: true
type: boolean
secrets:
DOCKER_HUB_LOGIN:
required: true
DOCKER_HUB_PASSWORD:
required: true

jobs:
check:
name: Run checks
runs-on: ${{ inputs.runs-on-value }}
env:
HOME: /root
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.19

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.11.2

- name: Build
shell: bash
run: |
make build

- name: Run tests
shell: bash
run: |
[ $(uname -m) = x86_64 ] && curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.19.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind
kind create cluster --retain -v 100
kubectl get pod
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.11.0/cert-manager.yaml

make helm-kind-install
docker pull ytsaurus/ytsaurus-nightly:dev-23.1-5f8638fc66f6e59c7a06708ed508804986a6579f
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.1-5f8638fc66f6e59c7a06708ed508804986a6579f
docker pull ytsaurus/ytsaurus-nightly:dev-23.1-9779e0140ff73f5a786bd5362313ef9a74fcd0de
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.1-9779e0140ff73f5a786bd5362313ef9a74fcd0de
docker pull ytsaurus/ytsaurus-nightly:dev-23.2-62a472c4efc2c8395d125a13ca0216720e06999d
kind load docker-image ytsaurus/ytsaurus-nightly:dev-23.2-62a472c4efc2c8395d125a13ca0216720e06999d
YTSAURUS_ENABLE_E2E_TESTS=true make test
helm uninstall ytsaurus

./compat_test.sh --from-version 0.4.1 --to-version trunk

- name: Docker Hub login
if: ${{ inputs.release }}
run: |
echo '${{ secrets.DOCKER_HUB_PASSWORD }}' | docker login --username ${{ secrets.DOCKER_HUB_LOGIN}} --password-stdin

- name: Docker
if: ${{ inputs.release }}
shell: bash
run: |
make release RELEASE_VERSION=0.0.$(git rev-list --count HEAD)-dev-${GITHUB_SHA} OPERATOR_IMAGE=ytsaurus/k8s-operator-nightly OPERATOR_CHART=ytop-chart-nightly
l0kix2 marked this conversation as resolved.
Show resolved Hide resolved
Loading