Skip to content

Commit

Permalink
chore: Change to ubicloud runners (#169)
Browse files Browse the repository at this point in the history
  • Loading branch information
pigri authored Sep 23, 2024
2 parents a431e59 + ed170d5 commit 840be7c
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/core-pull.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
name: core-unit-test

on:
pull_request:
pull_request_review:
types: [submitted]
branches:
- main
paths:
Expand All @@ -12,8 +13,9 @@ on:

jobs:
core-unit-test:
if: github.event.review.state == 'approved'
name: Core unit tests
runs-on: ubuntu-latest
runs-on: ubicloud-standard-2
strategy:
matrix:
go-version: [ '1.21', '1.22', '1.23' ]
Expand All @@ -36,7 +38,8 @@ jobs:


core-docker-build:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
runs-on: ubicloud-standard-2
steps:
- name: Login to Github Packages
uses: docker/login-action@v3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*'
jobs:
core-release:
runs-on: ubuntu-latest
runs-on: ubicloud-standard-2
steps:
- name: Login to Github Packages
uses: docker/login-action@v3
Expand Down Expand Up @@ -54,7 +54,7 @@ jobs:
labels: ${{ steps.openshield.outputs.labels }}

rule-service-release:
runs-on: ubuntu-latest
runs-on: ubicloud-standard-2
steps:
- name: Login to Github Packages
uses: docker/login-action@v3
Expand Down
41 changes: 37 additions & 4 deletions .github/workflows/rule-server-pull.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name: Rule-server-unit-test

on:
pull_request:
pull_request_review:
types: [submitted]
branches:
- main
paths:
- rules/rule-service/**
- .github/workflows/rule-server-pull.yaml

jobs:
rule-server-unit-test:
rule-server-unit-test-x86:
if: github.event.review.state == 'approved'
name: Rule server unit tests
runs-on: ubuntu-latest
runs-on: ubicloud-standard-2
strategy:
matrix:
python-version: ["3.11"]
Expand All @@ -38,9 +40,40 @@ jobs:
run: |
cd rules/rule-service/rule_service/tests
poetry run python -m unittest test_api.py
rule-server-unit-test-arm:
if: github.event.review.state == 'approved'
name: Rule server unit tests
runs-on: ubicloud-standard-2-arm
strategy:
matrix:
python-version: ["3.11"]
poetry-version: ["1.8.3"]

steps:
- uses: actions/checkout@v4
with:
repository: openshieldai/openshield
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Run poetry action
uses: abatilo/actions-poetry@v3
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install dependencies
run: |
cd rules/rule-service
poetry install
- name: Run unit tests
run: |
cd rules/rule-service/rule_service/tests
poetry run python -m unittest test_api.py
rule-service-docker-build:
runs-on: ubuntu-latest
if: github.event.review.state == 'approved'
runs-on: ubicloud-standard-2
steps:
- name: Login to Github Packages
uses: docker/login-action@v3
Expand Down
5 changes: 3 additions & 2 deletions rules/rule-service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ RUN --mount=type=cache,target=/root/.cache \
WORKDIR /app
COPY poetry.lock pyproject.toml ./
# install runtime deps to $VIRTUAL_ENV
RUN --mount=type=cache,target=/root/.cache \
poetry install --no-root --only main
RUN poetry export -f requirements.txt > requirements.txt && \
python -m pip install -r requirements.txt

#COPY scripts scripts/
COPY rule_service/ rule_service/

Expand Down

0 comments on commit 840be7c

Please sign in to comment.