FIX: tagion.hibon.Document imported into RefinementInterface #67
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: Main Flow | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
TARGET: x86_64-linux | |
STAGE: commit | |
DC: ldc2 | |
RETENTION_DAYS_BINS: 3 | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
UNITTEST_COV: unittest-cov | |
GH_TOKEN: ${{ secrets.GITBOT_TOKEN }} | |
ARTIFACT_DIR: /mnt/nfs/artifacts/${{ github.sha }}-${{ github.run_attempt }} | |
ACCEPTANCE_STAGE_CORES: 7 | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build: | |
runs-on: CI | |
timeout-minutes: 5 | |
steps: | |
- run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Build tagion | |
run: | | |
export DC=${{ env.DC }} | |
export RELEASE=1 | |
$DC --version | |
make tagion || make proper tagion | |
- name: Post run | |
if: always() | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }} | |
make trunk | |
cp -r build/trunk/. ${{ env.ARTIFACT_DIR }} | |
make clean | |
unittest: | |
runs-on: CI | |
timeout-minutes: 3 | |
steps: | |
- run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Run unittest | |
run: | | |
export DC=dmd | |
make unittest-cov || make proper unittest-cov | |
- name: Report unittest | |
run: | | |
RESULT=$(cat logs/${{ env.TARGET }}/unittest.log | grep -E "^[0-9]+ modules passed unittests") | |
echo -e "### :heavy_check_mark: Unittests passed \n $RESULT" >> $GITHUB_STEP_SUMMARY | |
- name: Upload code coverage results | |
if: ${{ vars.ENABLE_COV || false }} | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./logs/${{ env.TARGET }}/cov/ | |
fail_ci_if_error: true | |
flags: unittest | |
verbose: true | |
- name: Post run | |
if: always() | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }} | |
cp -r --parents logs/* build/${{ env.TARGET }}/bin/unittest-cov ${{ env.ARTIFACT_DIR }} | |
make clean | |
rm -r *.callstack logs/ || echo "no logs" | |
tauon-wasm: | |
runs-on: CI | |
steps: | |
- run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Build and clone wasi | |
run: | | |
export DC=ldc2 | |
make PLATFORM=wasm32-unknown-wasi proper wasi | |
- name: build tauon | |
run: | | |
ldc2 --version | |
export DC=ldc2 | |
make PLATFORM=wasm32-unknown-wasi clean-tauon tauon-test | |
- name: run wasmer test | |
run: | | |
source $HOME/.wasmer/wasmer.sh | |
export DC=ldc2 | |
make PLATFORM=wasm32-unknown-wasi tauon-run | |
- uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: tauon_wasm | |
path: build/wasm32-unknown-wasi/bin/tauon_test.wasm | |
if-no-files-found: error | |
commit_stage_cov: | |
if: ${{ vars.ENABLE_COV || false }} | |
runs-on: CI | |
timeout-minutes: 5 | |
steps: | |
- name: get repository | |
run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- name: pull | |
run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Run commit stage tests | |
run: | | |
export DC=${{ env.DC }} | |
export TEST_STAGE=commit | |
export TESTBENCH_FLAGS=--silent | |
export COV=1 | |
make bddtest -j || make proper bddtest | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
directory: ./logs/${{ env.TARGET }}/bdd/commit/cov/ | |
fail_ci_if_error: true | |
flags: commit | |
verbose: true | |
- name: Post run | |
if: always() | |
run: | | |
make clean | |
rm -r *.callstack build logs/ || echo "no logs" | |
rm -- *.lst | |
commit_stage: | |
runs-on: CI | |
timeout-minutes: 5 | |
steps: | |
- name: get repository | |
run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- name: pull | |
run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Run commit stage tests | |
run: | | |
export DC=${{ env.DC }} | |
export TEST_STAGE=commit | |
export TESTBENCH_FLAGS=--silent | |
export UNSHARE_NET=1 | |
export RELEASE=1 | |
make bddtest -j || make proper bddtest | |
#echo ${{ secrets.USERPWD }} |sudo -S apt-get install -y uwsc | |
make nngtest-build nngtest -k -j | |
- name: Report commit stage tests | |
if: always() | |
run: | | |
sleep 5 | |
./build/${{ env.TARGET }}/bin/collider -c logs/${{ env.TARGET }}/bdd/commit/results | |
./build/${{ env.TARGET }}/bin/collider reporter -o /dev/stdout logs/${{ env.TARGET }}/bdd/commit/results >> $GITHUB_STEP_SUMMARY | |
$PWD/build/${{ env.TARGET }}/bin/bddenv.sh ./build/${{env.TARGET}}/bin/collider reporter -f "github" logs/${{ env.TARGET }}/bdd/commit/results | |
./build/${{ env.TARGET }}/bin/collider -c logs/${{ env.TARGET }}/bdd/commit/results | grep "Test result success!" | |
(echo "<NNGTEST>" && grep -a '#TEST' logs/${{ env.TARGET }}/nngtest/*.log && echo "</NNGTEST>") >> $GITHUB_STEP_SUMMARY | |
- name: Post run | |
if: always() | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }} | |
make trunk | |
cp -r build/trunk/* ${{ env.ARTIFACT_DIR }} | |
make clean | |
rm -r *.callstack logs/ || echo "no logs" | |
acceptance_stage: | |
runs-on: CD | |
timeout-minutes: 12 | |
needs: [commit_stage, unittest, build] | |
strategy: | |
fail-fast: false | |
matrix: | |
stage: [acceptance, tools] | |
steps: | |
- name: Copy Artifact to local machine | |
run: | | |
find . -mindepth 1 -delete | |
cp -r ${{ env.ARTIFACT_DIR }}/. . | |
- name: Run collider tests | |
run: | | |
id | |
pwd | |
hostname | |
source $PWD/build/${{ env.TARGET }}/bin/bddenv.sh | |
export UNSHARE_NET=1 | |
export DBIN=$PWD/build/${{ env.TARGET }}/bin | |
export DLOG=$PWD/logs/${{ env.TARGET }} | |
export COLLIDER_ROOT=$PWD/logs/${{ env.TARGET }}/bdd | |
export PATH=$DBIN:$PATH | |
./build/${{ env.TARGET }}/bin/collider --silent -r ${{ matrix.stage }} -j${{ env.ACCEPTANCE_STAGE_CORES }} -b build/${{ env.TARGET }}/bin/testbench | |
- name: Generate reports | |
if: always() | |
run: | | |
sleep 5 | |
./build/${{ env.TARGET }}/bin/collider -c logs/${{ env.TARGET }}/bdd/${{ matrix.stage }}/results | |
./build/${{ env.TARGET }}/bin/collider reporter -o $GITHUB_STEP_SUMMARY logs/${{ env.TARGET }}/bdd/${{ matrix.stage }}/results | |
$PWD/build/${{ env.TARGET }}/bin/bddenv.sh ./build/${{ env.TARGET }}/bin/collider reporter -f "github" logs/${{ env.TARGET }}/bdd/${{ matrix.stage }}/results | |
./build/${{ env.TARGET }}/bin/collider -c logs/${{ env.TARGET }}/bdd/${{ matrix.stage }}/results | grep "Test result success!" | |
- name: Post run | |
if: always() | |
run: | | |
mkdir -p ${{ env.ARTIFACT_DIR }} | |
stacks=$(find -name "*.callstack") | |
cp -r --parents logs/* $stacks ${{ env.ARTIFACT_DIR }} | |
find . -mindepth 1 -delete | |
docker_build: | |
runs-on: ubuntu-latest | |
if: success() | |
needs: [commit_stage] | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.USER_DOCKER_HUB }} | |
password: ${{ secrets.PAT_DOCKER_HUB }} | |
- name: Build and push | |
run: | | |
docker build . -t tagion/tagion:${{ github.ref_name }} | |
docker push tagion/tagion:${{ github.ref_name }} | |
add_logs: | |
if: failure() | |
runs-on: CI | |
needs: acceptance_stage | |
steps: | |
- name: Add logs | |
run: | | |
cd ${{ env.ARTIFACT_DIR }} | |
add_log_file() { | |
file="$1" | |
url=$(gh gist create $file) || echo could not create gist | |
echo "[$(basename $file)]($url)" >> $GITHUB_STEP_SUMMARY | |
} | |
log_files=$(find logs -name "*.log") | |
for file in $log_files; do | |
add_log_file $file & | |
done | |
- name: Add callstacks | |
run: | | |
cd ${{ env.ARTIFACT_DIR }} | |
callstack_files=$(find . -name "*.callstack") | |
for file in $callstack_files; do | |
./build/${{ env.TARGET }}/bin/tagion callstack ./build/${{ env.TARGET }}/bin/testbench -t $file > $file.unstack || echo could not create callstack | |
url=$(gh gist create $file.unstack) || echo could not create gist | |
echo "[$(basename $file)]($url)" >> $GITHUB_STEP_SUMMARY | |
done | |
- name: Generate graph svgs | |
run: | | |
cd ${{ env.ARTIFACT_DIR }} | |
graph_files=$(find logs -name "*_graph.hibon") | |
# Define a function to process each file | |
process_file() { | |
file="$1" | |
./build/${{ env.TARGET }}/bin/tagion graphview --svg "$file" > "$file.svg" || echo could not create graph | |
url=$(gh gist create "$file.svg") || echo could not create gist | |
echo "[$(basename "$file").svg]($url)" >> $GITHUB_STEP_SUMMARY | |
} | |
# Export the function so that it's available to GNU Parallel | |
export -f process_file | |
# Use GNU Parallel to run the function in parallel | |
echo "$graph_files" | parallel -j 20 process_file >> $GITHUB_STEP_SUMMARY | |
ddoc: | |
if: ${{ github.ref == 'refs/heads/current' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: dlang-community/setup-dlang@v1 | |
with: | |
compiler: dmd-latest | |
- uses: actions/checkout@v4 | |
- name: Build docmentation | |
run: | | |
make ddoc | |
rm -rf .git | |
- name: Push ddoc to repository | |
run: | | |
git clone https://${{ secrets.GITBOT_TOKEN }}@github.com/tagion/ddoc.git | |
cp -R build/ddoc/ ddoc/ | |
cd ddoc | |
git config user.email "[email protected]" | |
git config user.name "gitbot" | |
git add . | |
git commit -m "ddocs updated" || echo "nothing to commit" | |
git push https://${{ secrets.GITBOT_TOKEN }}@github.com/tagion/ddoc.git || echo "repo already up to date" | |
create_artifact: | |
runs-on: CI | |
needs: [acceptance_stage, add_logs] | |
if: always() | |
steps: | |
- name: Create tar ball | |
run: | | |
cd /mnt/nfs/artifacts | |
artifact=${{ github.sha }}-${{ github.run_attempt }} | |
tar czf $artifact.tar.gz --directory=$artifact/ . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.TARGET }} | |
path: ${{ env.ARTIFACT_DIR }} | |
if-no-files-found: error | |
- name: Post run | |
run: | | |
cd | |
rm -r ${{ env.ARTIFACT_DIR }} | |
# Remove older artifacts | |
cd /mnt/nfs/artifacts/ | |
ls -1t *.tar.gz | tail -n +100 | xargs rm -v || echo "No old backups to be removed" | |
android_libmobile: | |
needs: commit_stage | |
strategy: | |
fail-fast: false | |
matrix: | |
arch: [aarch64, armv7a, x86_64] | |
runs-on: CI | |
steps: | |
- name: get repository | |
run: | | |
cd .. | |
git clone [email protected]:tagion/tagion.git || echo "repo already exists" | |
- name: pull | |
run: | | |
git fetch | |
git checkout ${{ github.sha }} | |
git clean -f && git restore . | |
- name: Install android tools | |
run: | | |
make PLATFORM=${{ matrix.arch }}-linux-android install-android-toolchain | |
- name: Build | |
run: | | |
make DC=tools/ldc2-1.37.0-linux-x86_64/bin/ldc2 PLATFORM=${{ matrix.arch }}-linux-android libtauonapi libmobile | |
file ./build/${{ matrix.arch }}-linux-android/lib/libtauonapi.so | |
- uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: ${{ matrix.arch }}-linux-android | |
path: | | |
build/${{matrix.arch}}-linux-android/lib/libtauonapi.* | |
build/${{matrix.arch}}-linux-android/lib/libmobile.* | |
if-no-files-found: error | |
- name: Cleanup | |
run: make PLATFORM=${{ matrix.arch }}-linux-android clean | |
ios_libmobile: | |
needs: commit_stage | |
strategy: | |
fail-fast: false | |
matrix: | |
# arch: [arm64] | |
target: [arm64-apple-ios, arm64-apple-ios-simulator, x86_64-apple-ios-simulator, arm64-darwin] | |
runs-on: macOS | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: ./.github/actions/ios | |
with: | |
platform: ${{ matrix.target }} | |
activate_gitlab: | |
needs: [ ios_libmobile, android_libmobile ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Trigger gitlab ci api | |
run: | | |
curl --request POST \ | |
--form token=${{ secrets.GITLAB_TRIGGER }} \ | |
--form ref=github_binaries_update \ | |
--form variables\[run_id\]="${{ github.run_id }}" \ | |
--form variables\[sha\]="${{ github.run_id }}" \ | |
--form variables\[ref_name\]="${{ github.ref_name }}" \ | |
--form variables\[commit_message\]="${{ github.event.head_commit.message }}" \ | |
"https://gitlab.com/api/v4/projects/59713152/trigger/pipeline" |