diff --git a/.ci/manifest.toml b/.ci/manifest.toml new file mode 100644 index 0000000..2822d20 --- /dev/null +++ b/.ci/manifest.toml @@ -0,0 +1,54 @@ +[package] +name = "pyodc" +repo = "ecmwf/pyodc" +visibility = "public" +fork-pull-requests = false +allow-stale-deps = true +compiler-inputs = [] +ci-pre-commit = false +ci-schedule = "from-dependencies+21" +full-history = true + +[[deps]] +repo = "ecmwf/odc" +package = "odc" +ref = "develop" +compiler-inputs = ["cxx-compiler"] + +# A pure-Python upstream, built on the GitHub runner rather than in this container. +[[deps]] +repo = "ecmwf/findlibs" +package = "findlibs" +ref = "develop" +compiler-inputs = [] +python-version-input = "python-version" +platform-input = "python-platform" +build-type-input = "python-build-type" + +[[trigger-downstream]] +repo = "ecmwf/earthkit-data" +ref = "develop" + +[matrix.test] +triggers = ["upstream-change", "rebuild-request"] + +# The container and compiler of odc's build, whose library the tests load. +[matrix.test.defaults] +job-script = "./.ci/test.sh.j2" +runs-on = "ubuntu-latest" +container = "eccr.ecmwf.int/public-ci-images/ubuntu24.04-gcc13-gfortran13" +platform = "ubuntu-24.04" +cxx-compiler = "g++-13" +c-compiler = "gcc-13" +build-type = "RelWithDebInfo" +python-platform = "gh-ubuntu-26.04" +python-build-type = "Release" + +[[matrix.test.include]] +python-version = "3.11" + +[[matrix.test.include]] +python-version = "3.12" + +[[matrix.test.include]] +python-version = "3.13" diff --git a/.ci/test.sh.j2 b/.ci/test.sh.j2 new file mode 100644 index 0000000..43da6f7 --- /dev/null +++ b/.ci/test.sh.j2 @@ -0,0 +1,5 @@ +{% extends "ci-infrastructure/python-runner.sh.j2" %} +{% block set_environment %} +export FINDLIBS_DISABLE_PACKAGE=yes +{% endblock %} +{% block test_requirements %}-r "$CI_SOURCE_DIR/requirements.txt"{% endblock %} diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 34ca5d1..89a7969 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1,2 @@ /.github/workflows/ @iainrussell @mcocdawc +/.ci/ @iainrussell @mcocdawc diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9fc5f3f..2b93f36 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,33 +1,141 @@ -name: ci +# GENERATED FILE - DO NOT EDIT. +# Regenerate via the ci-infrastructure-generate CLI. +# Source of truth: each repo's .ci/manifest.toml. +name: CI on: - # Trigger the workflow on push to master or develop, except tag creation push: - branches: - - 'master' - - 'develop' - tags-ignore: - - '**' + branches: [develop, master, main] + pull_request: + types: [opened, reopened, synchronize] + workflow_dispatch: + schedule: + - cron: "58 3 * * *" - # Trigger the workflow on pull request - pull_request: ~ +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} + cancel-in-progress: true - # Trigger the workflow manually - workflow_dispatch: ~ +permissions: + contents: read + +env: + ARTIFACT_POLL_INTERVAL: ${{ vars.ARTIFACT_POLL_INTERVAL || '60' }} + ARTIFACT_WAIT_TIMEOUT: ${{ vars.ARTIFACT_WAIT_TIMEOUT || '1800' }} + ARTIFACT_S3_ENDPOINT: ${{ secrets.ARTIFACT_S3_ENDPOINT }} + ARTIFACT_S3_BUCKET: ${{ secrets.ARTIFACT_S3_BUCKET }} + SCCACHE_BUCKET: ${{ secrets.SCCACHE_BUCKET }} + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} jobs: - # Run CI including downstream packages on self-hosted runners - downstream-ci: - name: downstream-ci - uses: ecmwf/downstream-ci/.github/workflows/downstream-ci.yml@main - with: - pyodc: ecmwf/pyodc@${{ github.event.pull_request.head.sha || github.sha }} - secrets: inherit - - # Build downstream packages on HPC - downstream-ci-hpc: - name: downstream-ci-hpc - uses: ecmwf/downstream-ci/.github/workflows/downstream-ci-hpc.yml@main - with: - pyodc: ecmwf/pyodc@${{ github.event.pull_request.head.sha || github.sha }} - secrets: inherit + ci-approval: + runs-on: ubuntu-latest + permissions: + pull-requests: write + steps: + - uses: ecmwf/ci-infrastructure/actions/require-ci-approval@main + + resolve: + needs: ci-approval + runs-on: ubuntu-latest + outputs: + matrices: ${{ steps.r.outputs.json }} + dispatch-plans: ${{ steps.r.outputs.dispatch-plans }} + steps: + - id: mint + uses: ecmwf/ci-infrastructure/actions/mint-token@main + with: + client-id: ${{ vars.CI_READER_APP_CLIENT_ID }} + private-key: ${{ secrets.CI_READER_APP_PRIVATE_KEY }} + repositories: ecbuild,eckit,findlibs,odc,pyodc,stack-dependencies + permissions: contents:read actions:read + - uses: actions/checkout@v6 + with: + persist-credentials: false + fetch-depth: 0 + - id: r + uses: ecmwf/ci-infrastructure/actions/resolve-deps@main + with: + matrix: test + token: ${{ steps.mint.outputs.token }} + rebuild-missing: 'true' + - name: Wait for the deps of test + if: steps.r.outputs.dispatch-plans == '[]' + uses: ecmwf/ci-infrastructure/actions/wait-for-deps@main + with: + matrix: ${{ steps.r.outputs.json }} + kinds: test + token: ${{ steps.mint.outputs.token }} + name: resolve + wait-build + + rebuild-producers: + needs: [ci-approval, resolve] + runs-on: ubuntu-latest + steps: + - if: needs.resolve.outputs.dispatch-plans != '' && needs.resolve.outputs.dispatch-plans != '[]' + uses: ecmwf/ci-infrastructure/actions/dispatch-producers@main + with: + dispatch-plans: ${{ needs.resolve.outputs.dispatch-plans }} + repositories: ecbuild,eckit,findlibs,odc,pyodc,stack-dependencies + client-id: ${{ vars.CI_DISPATCHER_APP_CLIENT_ID }} + app-private-key: ${{ secrets.CI_DISPATCHER_APP_PRIVATE_KEY }} + + test: + needs: [ci-approval, resolve, rebuild-producers] + name: test (${{ matrix._resolved['job-name'] }}) + runs-on: ${{ matrix['runs-on'] }} + container: + image: ${{ matrix.container || '' }} + strategy: + fail-fast: false + matrix: ${{ fromJSON(needs.resolve.outputs.matrices).test }} + steps: + - name: Announce image + uses: ecmwf/ci-infrastructure/actions/announce-image@main + - id: mint + uses: ecmwf/ci-infrastructure/actions/mint-token@main + with: + client-id: ${{ vars.CI_READER_APP_CLIENT_ID }} + private-key: ${{ secrets.CI_READER_APP_PRIVATE_KEY }} + repositories: ecbuild,eckit,findlibs,odc,pyodc,stack-dependencies + permissions: contents:read actions:read + - uses: actions/checkout@v6 + with: + persist-credentials: false + fetch-depth: 0 + - name: Fetch resolved deps + id: deps + uses: ecmwf/ci-infrastructure/actions/fetch-deps@main + with: + deps-json: ${{ toJSON(matrix._resolved.deps) }} + token: ${{ steps.mint.outputs.token }} + - name: Print dependency table + uses: ecmwf/ci-infrastructure/actions/print-dep-table@main + with: + resolved: ${{ toJSON(matrix._resolved) }} + - name: Build + id: build + uses: ecmwf/ci-infrastructure/actions/run-job-script@main + with: + job-script: ${{ matrix.job-script }} + matrix-leg: ${{ toJSON(matrix) }} + package: pyodc + cmake-prefix-path: ${{ steps.deps.outputs.cmake-prefix-path }} + - name: Publish + uses: ecmwf/ci-infrastructure/actions/publish-artifact@main + with: + install-path: ${{ steps.build.outputs.install-path }} + artifact-name: ${{ matrix._resolved['own-artifact-name'] }} + + ci-result: + name: collect results + if: always() + needs: [ci-approval, resolve, test] + runs-on: ubuntu-latest + permissions: + statuses: write + steps: + - uses: ecmwf/ci-infrastructure/actions/ci-result@main + with: + needs: ${{ toJSON(needs) }} diff --git a/.github/workflows/label-public-pr.yml b/.github/workflows/label-public-pr.yml deleted file mode 100644 index dbcc936..0000000 --- a/.github/workflows/label-public-pr.yml +++ /dev/null @@ -1,10 +0,0 @@ -# Manage labels of pull requests that originate from forks -name: label-public-pr - -on: - pull_request_target: - types: [opened, synchronize] - -jobs: - label: - uses: ecmwf/reusable-workflows/.github/workflows/label-pr.yml@v2 diff --git a/.github/workflows/old_CI.yml b/.github/workflows/old_CI.yml new file mode 100644 index 0000000..dde8dae --- /dev/null +++ b/.github/workflows/old_CI.yml @@ -0,0 +1,34 @@ +name: old CI + +on: + # Trigger the workflow after the new CI succeeded on a push + workflow_run: + workflows: [CI] + types: [completed] + branches: + - "master" + - "develop" + + # Trigger the workflow manually + workflow_dispatch: ~ + +jobs: + # Run CI including downstream packages on self-hosted runners + downstream-ci: + name: downstream-ci + if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success') }} + uses: ecmwf/downstream-ci/.github/workflows/downstream-ci.yml@main + with: + ci_group: only-self + pyodc: ecmwf/pyodc@${{ github.event.workflow_run.head_sha || github.sha }} + secrets: inherit + + # Build downstream packages on HPC + downstream-ci-hpc: + name: downstream-ci-hpc + if: ${{ github.event_name == 'workflow_dispatch' || (github.event.workflow_run.event == 'push' && github.event.workflow_run.conclusion == 'success') }} + uses: ecmwf/downstream-ci/.github/workflows/downstream-ci-hpc.yml@main + with: + ci_group: only-self + pyodc: ecmwf/pyodc@${{ github.event.workflow_run.head_sha || github.sha }} + secrets: inherit