diff --git a/.github/utils/get_core_repo.py b/.github/utils/get_core_repo.py index 9c7bea8b..d9a09002 100644 --- a/.github/utils/get_core_repo.py +++ b/.github/utils/get_core_repo.py @@ -90,9 +90,11 @@ def main(): print(f'Uncommon branch {branch}; defaulting to master') branch = 'master' - with open(os.environ['GITHUB_ENV'], 'a') as f: - f.write(f'{SCOPE}_REPO={full_repo}\n') - f.write(f'{SCOPE}_BRANCH={branch}\n') + for fn in (os.environ['GITHUB_ENV'], os.environ['GITHUB_OUTPUT']): + with open(fn, 'a') as f: + f.write(f'{SCOPE}_REPO={full_repo}\n') + f.write(f'{SCOPE}_BRANCH={branch}\n') + return 0 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..91555262 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,101 @@ +name: Build + +env: + PYTHON_VERSION: '3.12' + TZ: Europe/Zurich + +on: + push: + branches: + - 'master' + - '*.x' + - 'ci-build-plugins' # TODO remove + pull_request: + branches: + - 'master' + - '*.x' + types: + - opened + - reopened + - synchronize + - labeled + +jobs: + build: + name: Build plugin packages 📦 + runs-on: ubuntu-22.04 + if: github.event_name == 'push' || contains(github.event.pull_request.labels.*.name, 'build-wheel') + steps: + - uses: actions/checkout@v4 + with: + path: plugins + # prefer head commit over merge commit in case of PRs + ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }} + + - name: Pick Indico core repo + id: core-repo + env: + GH_TOKEN: ${{ github.token }} + PR_BODY: ${{ github.event_name == 'pull_request' && github.event.pull_request.body }} + PR_BASE_REF: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.ref }} + run: python plugins/.github/utils/get_core_repo.py indico/indico INDICO + + - name: Checkout Indico core code + uses: actions/checkout@v4 + with: + path: indico + repository: indico/indico + ref: ${{ steps.core-repo.outputs.INDICO_BRANCH }} + + - name: Set up Python 🐍 + uses: actions/setup-python@v5 + with: + python-version: ${{ env.PYTHON_VERSION }} + cache: pip + cache-dependency-path: | + indico/requirements*.txt + plugins/**/setup.cfg + + - name: Setup Node + uses: actions/setup-node@v4 + with: + node-version: 18.x + + - name: Get pip cache dir + id: pip-cache + run: echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT + + - name: Cache pip + id: cache-pip + uses: actions/cache@v4 + with: + path: ${{ steps.pip-cache.outputs.dir }} + key: pip|${{ runner.os }}|${{ env.PYTHON_VERSION }}|${{ hashFiles('indico/requirements*.txt') }}|${{ hashFiles('plugins/**/setup.cfg') }} + + - name: Test + run: | + ls -al + echo + ls -al plugins + echo + ls -al indico + echo + + # - name: Install build deps 🔧 + # run: | + # sudo apt-get install libpq-dev + # pip install --user -U pip setuptools wheel + # pip install --user -e '.[dev]' + + # - name: Install npm deps ☕ + # run: npm ci + + # - name: Build wheel 🏗 + # run: ./bin/maintenance/build-wheel.py indico --add-version-suffix + + # - uses: actions/upload-artifact@v4 + # name: Upload build artifacts 📦 + # with: + # name: indico-wheel + # retention-days: 7 + # path: ./dist