Skip to content

Add VCPKG_ROOT environment variable to workflow #10

Add VCPKG_ROOT environment variable to workflow

Add VCPKG_ROOT environment variable to workflow #10

name: Sync with Upstream (unstable → production)
on:
schedule:
- cron: "0 4 * * 0" # Every Sunday at 04:00 UTC
workflow_dispatch: # Allow manual trigger from the Actions tab
push:
branches:
- unstable # Trigger if unstable branch is pushed to
permissions:
contents: write
pull-requests: write
actions: read
concurrency:
group: sync-upstream
cancel-in-progress: true
env:
UPSTREAM_REPO: schrodinger/pymol-open-source
UPSTREAM_BRANCH: master # change to 'main' if upstream uses main
UNSTABLE_BRANCH: unstable # branch where upstream changes are merged
PRODUCTION_BRANCH: production # stable branch for PyPI releases
PR_BRANCH_PREFIX: sync/upstream-
VCPKG_ROOT: ${{ github.workspace }}/vendor/vcpkg
jobs:
sync:
name: Merge upstream → tests → PR
runs-on: ubuntu-latest
steps:
- name: Checkout fork (full history)
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git author
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Add and fetch upstream remote
run: |
git remote add upstream https://github.com/${{ env.UPSTREAM_REPO }} || true
git fetch upstream ${{ env.UPSTREAM_BRANCH }}
git fetch origin ${{ env.UNSTABLE_BRANCH }}
- name: Checkout unstable branch
run: git checkout ${{ env.UNSTABLE_BRANCH }}
- name: Configure Git merge driver
run: git config merge.ours.driver true
- name: Merge upstream into unstable (keep fork deletions/overrides)
run: |
set -e
git merge -s recursive -X ours upstream/${{ env.UPSTREAM_BRANCH }} || true
git checkout --ours pyproject.toml || true
git add pyproject.toml
git rm -f .github/workflows/build.yml || true
git add -u
git commit -m "Merge upstream/${{ env.UPSTREAM_BRANCH }} into unstable, keeping fork deletions/overrides" || echo "No commit needed"
git push origin ${{ env.UNSTABLE_BRANCH }}
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install git build-essential libxmu-dev libxi-dev libgl-dev libglew-dev libpng-dev libfreetype6-dev libxml2-dev libmsgpack-dev libglm-dev libnetcdf-dev linux-libc-dev autoconf perl
- name: Initialize vcpkg
run: |
git clone https://github.com/Microsoft/vcpkg.git vendor/vcpkg
- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Create virtual environment
run: |
python -m venv .venv
source .venv/bin/activate
python -m pip install wheel setuptools cibuildwheel
python -m pip install -r requirements.txt
- name: Bootstrap vcpkg
run: ${{ env.VCPKG_ROOT }}/bootstrap-vcpkg.sh -disableMetrics
- name: Install vcpkg dependencies
run: |
${{ env.VCPKG_ROOT }}/vcpkg install
- name: Last build environment setup steps
run: |
source .venv/bin/activate
python automations/my_automator.py setup dev-env
- name: Build C extension
run: |
source .venv/bin/activate
python automations/my_automator.py setup dev-env
cibuildwheel .
- name: Detect if unstable has diverged from production
id: changes
run: |
if git diff --quiet origin/${{ env.PRODUCTION_BRANCH }} origin/${{ env.UNSTABLE_BRANCH }}; then
echo "HAS_CHANGES=false" >> $GITHUB_ENV
echo "No new changes to propose for production."
else
echo "HAS_CHANGES=true" >> $GITHUB_ENV
- name: Create Pull Request from unstable → production
if: env.HAS_CHANGES == 'true'
uses: peter-evans/create-pull-request@v6
with:
title: "Promote unstable → production"
body: |
This PR promotes the current `unstable` branch (with merged upstream changes)
into `production`, preparing for the next PyPI release.
Tests passed ✅
commit-message: "chore: merge unstable into production"
branch: ${{ env.UNSTABLE_BRANCH }} # use unstable as the PR branch
base: ${{ env.PRODUCTION_BRANCH }}
delete-branch: false
labels: |
automated
release-candidate