Skip to content

Commit

Permalink
Separate setup from build jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
st-pasha committed Nov 28, 2023
1 parent 4a3020c commit e4d4dd0
Showing 1 changed file with 57 additions and 27 deletions.
84 changes: 57 additions & 27 deletions .github/workflows/build-and-test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@ on:
- main

jobs:
build:
runs-on: windows-latest

setup:
runs-on: ubuntu-latest
env:
DT_HARNESS: GitHub
DT_BUILD_ID: ${{ github.run_id }}
DT_BUILD_NUMBER: ''
DT_BUILD_SUFFIX: ''
DT_RELEASE: ''
DT_MSVC_PATH: C:\Program Files\Microsoft Visual Studio\2022\Enterprise

steps:
- name: Checkout code
Expand All @@ -28,40 +27,65 @@ jobs:
fetch-depth: 0

- name: Prepare environment variables
id: prepare
run: |
echo "DT_BUILD_ID=$((git rev-list --count origin/main) - 1)" >> $env:GITHUB_ENV
if ($env:GITHUB_EVENT_NAME -eq 'pull_request') {
if ($env:GITHUB_HEAD_REF -match '^rel-') {
echo "DT_RELEASE=True" >> $env:GITHUB_ENV
} else {
echo "DT_BUILD_SUFFIX=PR$($env:GITHUB_EVENT_NUMBER).$env:DT_BUILD_ID" >> $env:GITHUB_ENV
}
} elseif ($env:GITHUB_REF -eq 'refs/heads/main') {
echo "DT_BUILD_NUMBER=$env:DT_BUILD_ID" >> $env:GITHUB_ENV
} elseif ($env:GITHUB_REF -match '^refs/heads/rel-') {
echo "DT_RELEASE=True" >> $env:GITHUB_ENV
} else {
echo "DT_BUILD_SUFFIX=$env:GITHUB_REF.$env:DT_BUILD_ID" >> $env:GITHUB_ENV
}
echo "DT_BUILD_ID=$($(git rev-list --count origin/main) - 1)" >> $GITHUB_ENV
if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then
if [[ "$GITHUB_HEAD_REF" =~ ^rel- ]]; then
echo "DT_RELEASE=True" >> $GITHUB_ENV
else
echo "DT_BUILD_SUFFIX=PR$GITHUB_EVENT_NUMBER.$DT_BUILD_ID" >> $GITHUB_ENV
fi
elif [ "$GITHUB_REF" == "refs/heads/main" ]; then
echo "DT_BUILD_NUMBER=$DT_BUILD_ID" >> $GITHUB_ENV
elif [[ "$GITHUB_REF" =~ ^refs/heads/rel- ]]; then
echo "DT_RELEASE=True" >> $GITHUB_ENV
else
echo "DT_BUILD_SUFFIX=$GITHUB_REF.$DT_BUILD_ID" >> $GITHUB_ENV
fi
echo "DT_BUILD_ID=$DT_BUILD_ID" >> $GITHUB_OUTPUT
echo "DT_RELEASE=$DT_RELEASE" >> $GITHUB_OUTPUT
echo "DT_BUILD_SUFFIX=$DT_UI"DT_BUILD_SUFFIX" >> $GITHUB_OUTPUT
echo "DT_BUILD_NUMBER=$DT_UI"DT_BUILD_NUMBER" >> $GITHUB_OUTPUT
- name: Print environment
run: |
echo "GITHUB_EVENT_NAME = $env:GITHUB_EVENT_NAME"
echo "GITHUB_EVENT_NUMBER = $env:GITHUB_EVENT_NUMBER"
echo "GITHUB_REF = $env:GITHUB_REF"
echo "GITHUB_HEAD_REF = $env:GITHUB_HEAD_REF"
echo "DT_HARNESS = $env:DT_HARNESS"
echo "DT_BUILD_ID = $env:DT_BUILD_ID"
echo "DT_RELEASE = $env:DT_RELEASE"
echo "DT_BUILD_SUFFIX = $env:DT_BUILD_SUFFIX"
echo "DT_BUILD_NUMBER = $env:DT_BUILD_NUMBER"
echo "GITHUB_EVENT_NAME = $GITHUB_EVENT_NAME"
echo "GITHUB_EVENT_NUMBER = $GITHUB_EVENT_NUMBER"
echo "GITHUB_REF = $GITHUB_REF"
echo "GITHUB_HEAD_REF = $GITHUB_HEAD_REF"
echo "DT_HARNESS = $DT_HARNESS"
echo "DT_BUILD_ID = $DT_BUILD_ID"
echo "DT_RELEASE = $DT_RELEASE"
echo "DT_BUILD_SUFFIX = $DT_BUILD_SUFFIX"
echo "DT_BUILD_NUMBER = $DT_BUILD_NUMBER"
outputs:
DT_HARNESS: Github
DT_BUILD_ID: ${{ steps.prepare.outputs.DT_BUILD_ID }}
DT_RELEASE: ${{ steps.prepare.outputs.DT_RELEASE }}
DT_BUILD_SUFFIX: ${{ steps.prepare.outputs.DT_BUILD_SUFFIX }}
DT_BUILD_NUMBER: ${{ steps.prepare.outputs.DT_BUILD_NUMBER }}


build-38:
name: Build and test on Python 3.8
runs-on: windows-latest
needs: setup

steps:
- name: Set up Python 3.8
uses: actions/setup-python@v3
with:
python-version: 3.8

- name: Build datatable wheel
env:
DT_HARNESS: ${{ needs.setup.outputs.DT_HARNESS }}
DT_BUILD_ID: ${{ needs.setup.outputs.DT_BUILD_ID }}
DT_RELEASE: ${{ needs.setup.outputs.DT_RELEASE }}
DT_BUILD_SUFFIX: ${{ needs.setup.outputs.DT_BUILD_SUFFIX }}
DT_BUILD_NUMBER: ${{ needs.setup.outputs.DT_BUILD_NUMBER }}
run: |
python -V
python -m pip install --upgrade pip
Expand All @@ -73,6 +97,12 @@ jobs:
echo "DT_WHEEL = $env:DT_WHEEL"
cat src/datatable/_build_info.py
- name: Save wheel artifact
uses: actions/upload-artifact@v2
with:
name: wheel-3.8
path: ${{ env.DT_WHEEL }}

- name: Install and test
run: |
python -m pip install $env:DT_WHEEL
Expand Down

0 comments on commit e4d4dd0

Please sign in to comment.