Build Dragon #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dragon | |
run-name: Build Dragon | |
on: | |
push: | |
branches: | |
- workflow-build-dragon | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: | |
false | |
matrix: | |
python_version: ["3.9.4", "3.10.10", "3.11.7"] | |
outputs: | |
GITHASH: ${{ steps.build.outputs.GITHASH }} | |
VERSION: ${{ steps.build.outputs.VERSION }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: workflow-build-dragon | |
submodules: 'recursive' | |
- name: Build Image | |
run: | | |
docker build --build-arg python_version=${{ matrix.python_version }} -t my_image ./.devcontainer | |
- name: Run Container | |
run: | | |
docker run -t -d --name my_container my_image | |
- name: Build | |
id: build | |
run: | | |
set -x | |
docker exec -i my_container mkdir dragon | |
docker cp ./ my_container:/dragon | |
docker exec -i my_container bash -c " | |
# inside container | |
cd dragon && source /etc/profile.d/modules.sh; | |
export DRAGON_VERSION=$(grep DRAGON_VERSION src/modulefiles/dragon-dev | awk '{print $3}'); | |
export DRAGON_BASE_DIR=$PWD/src; | |
echo \"DRAGON_BASE_DIR=$DRAGON_BASE_DIR\"; | |
export DRAGON_INCLUDE_DIR=$DRAGON_BASE_DIR/include; | |
export DRAGON_LIB_DIR=$DRAGON_BASE_DIR/lib; | |
export DRAGON_BUILD_NTHREADS=6; | |
export PYTHONPATH=$DRAGON_BASE_DIR; | |
echo \"Building and activating new, clean environment.\"; | |
python3 -m venv --clear _env; | |
. _env/bin/activate; | |
python3 -m pip install -U pip; | |
python3 -m pip install -r src/requirements.txt -c src/constraints.txt; | |
export PATH=$PWD/hack:$PATH; | |
echo \"Building source code.\"; | |
cd external; | |
make clean; | |
make build-capnproto; | |
cd ..; | |
cd src; | |
make dist; | |
cd ..; | |
set -x; | |
ARTIFACT=$(ls ./src/release); | |
GITHASH=$(git rev-parse --short HEAD); | |
echo "GITHASH=$GITHASH" >> $GITHUB_OUTPUT; | |
echo "VERSION=$DRAGON_VERSION" >> $GITHUB_OUTPUT; | |
mv ./src/release/$ARTIFACT ./src/release/dragon-$DRAGON_VERSION-py${{ matrix.python_version }}-$GITHASH.tar.gz; | |
echo "ARTIFACT=$(ls ./src/release)" >> $GITHUB_OUTPUT; | |
" | |
docker cp my_container:/dragon/src/release ./src/ | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.build.outputs.ARTIFACT }} | |
path: src/release/${{ steps.build.outputs.ARTIFACT }} |