From 7966c4279d201dadf64fa963ac1303040b019b52 Mon Sep 17 00:00:00 2001 From: leavesster <11785335+leavesster@users.noreply.github.com> Date: Thu, 22 May 2025 16:02:16 +0800 Subject: [PATCH] feat: add oocana-python build and layer action --- .github/actions/oocana-python/action.yml | 53 ++++++++++++++++++++++++ .github/workflows/oocana-python.yml | 42 +++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 .github/actions/oocana-python/action.yml create mode 100644 .github/workflows/oocana-python.yml diff --git a/.github/actions/oocana-python/action.yml b/.github/actions/oocana-python/action.yml new file mode 100644 index 00000000..1ea77b1a --- /dev/null +++ b/.github/actions/oocana-python/action.yml @@ -0,0 +1,53 @@ +name: "setup oocana-python" +description: "setup oocana-python on ubuntu-latest with optional layer" +inputs: + token: + description: "GitHub token" + required: true + default: ${{ github.token }} + create-layer: + description: "create layer" + required: false + default: "false" + ref: + description: "GitHub ref" + required: false + default: "" + path: + description: "GitHub path" + required: false + default: "." + +runs: + using: "composite" + steps: + - uses: actions/checkout@v4 + with: + repository: oomol/oocana-python + path: ${{ inputs.path }} + ref: ${{ inputs.ref }} + token: ${{ inputs.token }} + - uses: pdm-project/setup-pdm@v4 + with: + cache: true + python-version: "3.10" + python-version-file: ${{ inputs.path }}/pyproject.toml + cache-dependency-path: ${{ inputs.path }}/pdm.lock + - name: install dependencies + run: pdm install + shell: bash + working-directory: ${{ inputs.path }} + - name: build + run: pdm build + shell: bash + working-directory: ${{ inputs.path }} + - name: static check + run: pdm check + shell: bash + working-directory: ${{ inputs.path }} + - name: create-layer + if: ${{ inputs.create-layer != 'false' }} + run: | + python ./scripts/layer.py + shell: bash + working-directory: ${{ inputs.path }} diff --git a/.github/workflows/oocana-python.yml b/.github/workflows/oocana-python.yml new file mode 100644 index 00000000..469dd6fd --- /dev/null +++ b/.github/workflows/oocana-python.yml @@ -0,0 +1,42 @@ +name: "setup oocana-python action" +on: + workflow_dispatch: + pull_request: + branches: + - main + paths: + - ".github/workflows/oocana-python.yml" + - "scripts/**" + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + action-test: + runs-on: ubuntu-latest + env: + OVMLAYER_LOG: /tmp/ovmlayer.log + steps: + - uses: actions/checkout@v4 + - uses: oomol/oocana-rust/.github/actions/ovmlayer@main + with: + rootfs: https://github.com/oomol/ovmlayer-rootfs/releases/download/base-rootfs%400.3.0/amd64-rootfs.tar + token: ${{ secrets.ACCESS_REPO }} + - name: setup oocana-python action without layer + uses: ./.github/actions/oocana-python + with: + ref: ${{ github.sha }} + path: "oocana-python" + - name: setup oocana-python action with layer + uses: ./.github/actions/oocana-python + with: + ref: ${{ github.sha }} + create-layer: "true" + path: "oocana-python" + - name: upload log + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ovmlayer-log + path: /tmp/ovmlayer.log