4646 needs : get-matrix
4747 env :
4848 JUNIT_REPORT_PATH : ~
49+ TS_YEAR : ~
50+ TS_MONTH : ~
51+ TS_DAY : ~
52+ TS : ~
53+ BUILD_DIR : /opt/foo/build
54+ OUTPUT_DIR : /opt/foo/output
55+ CACHE_DIR : /opt/foo/build/ccache
4956 strategy :
5057 fail-fast : false
5158 matrix :
@@ -84,33 +91,55 @@ jobs:
8491 fi
8592
8693
87- # - name: Run (example)
88- # run: |
89- # CMD="uname -a"
90- # if [[ "${{ matrix.runner.image }}" == "" ]]
91- # then
92- # $CMD
93- # else
94- # docker run ${{ matrix.runner.image }} $CMD
95- # fi
96-
97- # - name: Extract timestamps for caching
98- # run: |
99- # mkdir -p /opt/scripts
100- # cd /opt/scripts
101- # wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/scripts/runner/set-variable.sh && chmod +x set-variable.sh
102- # wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/scripts/runner/set-timestamps.sh && chmod +x set-timestamps.sh
103- # ./set-timestamps.sh
104-
105- - name : Setup build cache (vt)
94+ - name : Display System Information
10695 run : |
107- echo "TODO: implement cache usage if required by your project"
96+ CMD="uname -a"
97+ if [[ "${{ matrix.runner.image }}" == "" ]]
98+ then
99+ echo "Runner System Information:"
100+ $CMD
101+ else
102+ echo "Docker System Information:"
103+ docker run ${{ matrix.runner.image }} $CMD
104+ fi
105+
106+ # TODO: remove the commented lines if
107+ # - name: Extract timestamps for caching (using CMake as in VT)
108+ # run: |
109+ # echo "$1=$2" >> $GITHUB_ENV
110+
111+ # mkdir -p /opt/scripts
112+ # cd /opt/scripts
113+ # wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/scripts/runner/set-variable.sh && chmod +x set-variable.sh
114+ # wget https://raw.githubusercontent.com/${{ env.CI_REPO }}/refs/heads/${{ env.CI_BRANCH }}/ci/shared/scripts/runner/set-timestamps.sh && chmod +x set-timestamps.sh
115+ # ./set-timestamps.sh
108116
109- - name : PR tests env
117+ - name : Build timestamp for caching
118+ continue-on-error : true
110119 run : |
111- echo 'TODO...'
112- echo '1. Load environment variables from a matrix file (env set per env id) into .env'
113- echo '2. Load .env file to build `export $(cat .env | egrep -v "(^#.*|^$)" | xargs) && ./build.sh`'
120+ echo "TS_YEAR=$(date -u +%Y)" >> $GITHUB_ENV
121+ echo "TS_MONTH=$(date -u +%m)" >> $GITHUB_ENV
122+ echo "TS_DAY=$(date -u +%d)" >> $GITHUB_ENV
123+ echo "TS=$(date -u +%H:%M:%S)" >> $GITHUB_ENV
124+
125+ - name : Output timestamp for caching
126+ continue-on-error : true
127+ run : |
128+ echo "my pipeline variable is $(TS) $(TS_YEAR) $(TS_MONTH) $(TS_DAY)"
129+
130+ - name : Update cache
131+ continue-on-error : true
132+ uses : actions/cache@v3
133+ env :
134+ cache_name : ${{ matrix.runner.name }}
135+ with :
136+ path : ${{ env.CACHE_DIR }}
137+ key : ${{ runner.os }}-${{ env.cache_name }}-${{ env.TS_YEAR }}-${{ env.TS_MONTH }}-${{ env.TS_DAY }}-${{ env.TS }}
138+ restore-keys : |
139+ ${{ runner.os }}-${{ env.cache_name }}-${{ env.TS_YEAR }}-${{ env.TS_MONTH }}-${{ env.TS_DAY }}-
140+ ${{ runner.os }}-${{ env.cache_name }}-${{ env.TS_YEAR }}-${{ env.TS_MONTH }}-
141+ ${{ runner.os }}-${{ env.cache_name }}-${{ env.TS_YEAR }}-
142+ ${{ runner.os }}-${{ env.cache_name }}-
114143
115144 - name : PR tests
116145 run : |
@@ -134,8 +163,8 @@ jobs:
134163 --name test-container \
135164 -w $WORKSPACE \
136165 -v ${{ github.workspace }}:/workspace \
137- -v /opt/foo/build :/opt/foo/build \
138- -v /opt/foo/output :/opt/foo/output \
166+ -v ${{ env.BUILD_DIR }} :/opt/foo/build \
167+ -v ${{ env.OUTPUT_DIR }} :/opt/foo/output \
139168 -e CI="1" \
140169 -e https_proxy="" \
141170 -e http_proxy="" \
0 commit comments