11#
2- # Compile all MQL programs and create a ZIP file with sources and compiled binaries.
2+ # Compile all MQL programs, create a ZIP file with sources and compiled binaries and notify the build tracker .
33#
44# TODO:
55# - cache the compilers
@@ -26,11 +26,13 @@ jobs:
2626 shell : bash
2727
2828 steps :
29+ # ------------------------------------------------------------------------------------------------------------------------------------
2930 - name : Checkout repository
3031 uses : actions/checkout@v4
3132 with :
3233 fetch-depth : 0 # fetch all branches and history (to access the source branch of PRs)
3334
35+ # ------------------------------------------------------------------------------------------------------------------------------------
3436 - name : Check commit message for "[skip ci]"
3537 run : |
3638 SKIP_CI=false
@@ -44,37 +46,84 @@ jobs:
4446 echo "Skip CI: $SKIP_CI"
4547 echo "SKIP_CI=$SKIP_CI" >> "$GITHUB_ENV"
4648
47- - name : Setup compilers
49+ # ------------------------------------------------------------------------------------------------------------------------------------
50+ - name : Setup MQL compilers
4851 if : env.SKIP_CI != 'true'
4952 env :
5053 MT4_METALANG_URL : ${{ secrets.MT4_METALANG_URL }}
5154 MT4_METAEDITOR_URL : ${{ secrets.MT4_METAEDITOR_URL }}
5255 AUTH_USERNAME : ${{ secrets.MT4_URL_AUTH_USERNAME }}
5356 AUTH_PASSWORD : ${{ secrets.MT4_URL_AUTH_PASSWORD }}
5457 run : |
55- echo "Downloading MT4 compiler from https://.../mt4/ ${MT4_METALANG_URL#*/mt4/ }"
58+ echo "Downloading MT4 compiler from https://.../mt4${MT4_METALANG_URL#*/mt4}"
5659 curl -o metalang.exe --digest -u "$AUTH_USERNAME:$AUTH_PASSWORD" "$MT4_METALANG_URL" --silent --fail --show-error --connect-timeout 10 --max-time 60
5760 echo "MT4_METALANG=$PWD/metalang.exe" >> "$GITHUB_ENV"
5861
59- echo "Downloading MT4 MetaEditor from https://.../mt4/ ${MT4_METAEDITOR_URL#*/mt4/ }"
62+ echo "Downloading MT4 MetaEditor from https://.../mt4${MT4_METAEDITOR_URL#*/mt4}"
6063 curl -o metaeditor.exe --digest -u "$AUTH_USERNAME:$AUTH_PASSWORD" "$MT4_METAEDITOR_URL" --silent --fail --show-error --connect-timeout 10 --max-time 60
6164 echo "MT4_METAEDITOR=$PWD/metaeditor.exe" >> "$GITHUB_ENV"
6265
66+ # ------------------------------------------------------------------------------------------------------------------------------------
6367 - name : Compile MQL files
6468 if : env.SKIP_CI != 'true'
6569 run : |
6670 TRACE=1 \
6771 bin/mqlc -v=mql40 /inc:mql40 mql40/experts mql40/experts/tools mql40/indicators mql40/indicators/.attic mql40/scripts mql40/libraries \
6872 -v=mql45 /inc:mql45 mql45/experts mql45/indicators mql45/scripts mql45/libraries \
6973 --warn2error
70- echo "TIMESTAMP=$(date +'%Y.%m.%d_%H.%M')" >> "$GITHUB_ENV"
7174
72- - name : Store compiled files
73- if : env.SKIP_CI != 'true'
75+ # ------------------------------------------------------------------------------------------------------------------------------------
76+ - name : Prepare build artifact
77+ if : github.event_name == 'push' && env.SKIP_CI != 'true'
78+ run : |
79+ COMMIT_TIMESTAMP='${{ github.event.head_commit.timestamp }}'
80+
81+ echo "Setting directory tree to commit timestamp: $COMMIT_TIMESTAMP"
82+ find . -exec touch -a -m -d "$COMMIT_TIMESTAMP" {} +
83+
84+ COMMIT_TIME="$(date -u -d "$COMMIT_TIMESTAMP" '+%Y.%m.%d_%H.%M')"
85+ echo "COMMIT_TIME=$COMMIT_TIME" >> "$GITHUB_ENV"
86+
87+ # ------------------------------------------------------------------------------------------------------------------------------------
88+ - name : Create build artifact
89+ id : artifact
90+ if : github.event_name == 'push' && env.SKIP_CI != 'true'
7491 uses : actions/upload-artifact@v4
7592 with :
76- name : rosasurfer-mt4-mql- ${{ env.TIMESTAMP }}.bin
93+ name : ${{ github.repository_owner }}-${{ github.event.repository.name }}- ${{ env.COMMIT_TIME }}.bin
7794 path : |
78- mql*/**/*.dll
79- mql*/**/*.ex[e4]
80- mql*/**/*.mq[h4]
95+ bin/
96+ config/
97+ etc/
98+ mql*/
99+ !mql40/indicators/.attic/
100+ sounds/*.mp3
101+ sounds/*.wav
102+ templates*/*.tpl
103+ !**/.git*
104+ LICENSE
105+ README.md
106+ include-hidden-files : true
107+
108+ # ------------------------------------------------------------------------------------------------------------------------------------
109+ - name : Notify build tracker
110+ if : github.event_name == 'push' && env.SKIP_CI != 'true'
111+ env :
112+ BUILD_TRACKER_URL : ${{ secrets.BUILD_TRACKER_URL }}
113+ BUILD_TRACKER_USER : ${{ secrets.BUILD_TRACKER_USERNAME }}
114+ BUILD_TRACKER_PASS : ${{ secrets.BUILD_TRACKER_PASSWORD }}
115+ run : |
116+ echo "Notifying build tracker at https://.../mt4${BUILD_TRACKER_URL#*/mt4}"
117+
118+ response_file="$(mktemp)"
119+ status="$(curl -X POST "$BUILD_TRACKER_URL" -L --silent --connect-timeout 10 --max-time 30 \
120+ --digest -u "$BUILD_TRACKER_USER:$BUILD_TRACKER_PASS" \
121+ -o "$response_file" -w '%{http_code}' \
122+ -d 'repository=${{ github.repository }}' \
123+ -d 'artifact-id=${{ steps.artifact.outputs.artifact-id }}')"
124+ echo "HTTP status: $status"
125+ cat "$response_file"
126+
127+ ((status >= 400)) && exit 1 || :
128+
129+ # ------------------------------------------------------------------------------------------------------------------------------------
0 commit comments