|
| 1 | +name: Build and test EverParse+Steel |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches-ignore: |
| 5 | + - _** |
| 6 | + - taramana_steel |
| 7 | + pull_request: |
| 8 | + workflow_dispatch: |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + runs-on: [self-hosted, linux, X64] |
| 12 | + steps: |
| 13 | + - name: Record initial timestamp |
| 14 | + run: | |
| 15 | + echo "CI_INITIAL_TIMESTAMP=$(date '+%s')" >> $GITHUB_ENV |
| 16 | + - name: Check out repo |
| 17 | + uses: actions/checkout@v2 |
| 18 | + - name: Identify the base FStar branch and the notification channel |
| 19 | + run: | |
| 20 | + echo "FSTAR_BRANCH=john_ml_steel_c" >> $GITHUB_ENV |
| 21 | + echo "CI_SLACK_CHANNEL=$(jq -c -r '.NotificationChannel' .docker/build/config.json)" >> $GITHUB_ENV |
| 22 | + - name: Build Everparse and its dependencies |
| 23 | + run: | |
| 24 | + ci_docker_image_tag=everparse:local-run-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT |
| 25 | + ci_docker_builder=builder_everparse_${GITHUB_RUN_ID}_${GITHUB_RUN_ATTEMPT} |
| 26 | + docker buildx create --name $ci_docker_builder --driver-opt env.BUILDKIT_STEP_LOG_MAX_SIZE=500000000 |
| 27 | + docker buildx build --builder $ci_docker_builder --pull --load -t $ci_docker_image_tag -f .docker/steel.Dockerfile . |
| 28 | + docker buildx rm -f $ci_docker_builder |
| 29 | + env: |
| 30 | + DZOMO_GITHUB_TOKEN: ${{ secrets.DZOMO_GITHUB_TOKEN }} |
| 31 | + - name: Compute elapsed time |
| 32 | + if: ${{ always() }} |
| 33 | + run: | |
| 34 | + CI_FINAL_TIMESTAMP=$(date '+%s') |
| 35 | + CI_TIME_DIFF=$(( $CI_FINAL_TIMESTAMP - $CI_INITIAL_TIMESTAMP )) |
| 36 | + echo "CI_TIME_DIFF_S=$(( $CI_TIME_DIFF % 60 ))" >> $GITHUB_ENV |
| 37 | + echo "CI_TIME_DIFF_M=$(( ($CI_TIME_DIFF / 60) % 60 ))" >> $GITHUB_ENV |
| 38 | + echo "CI_TIME_DIFF_H=$(( $CI_TIME_DIFF / 3600 ))" >> $GITHUB_ENV |
| 39 | + case ${{ job.status }} in |
| 40 | + (success) |
| 41 | + echo "CI_EMOJI=✅" >> $GITHUB_ENV |
| 42 | + ;; |
| 43 | + (cancelled) |
| 44 | + echo "CI_EMOJI=⚠" >> $GITHUB_ENV |
| 45 | + ;; |
| 46 | + (*) |
| 47 | + echo "CI_EMOJI=❌" >> $GITHUB_ENV |
| 48 | + ;; |
| 49 | + esac |
| 50 | + echo "CI_COMMIT=$(echo ${{ github.event.head_commit.id || github.event.pull_request.head.sha }} | grep -o '^........')" >> $GITHUB_ENV |
| 51 | + - name: Post to the Slack channel |
| 52 | + if: ${{ always() }} |
| 53 | + id: slack |
| 54 | + |
| 55 | + with: |
| 56 | + channel-id: ${{ env.CI_SLACK_CHANNEL }} |
| 57 | + payload: | |
| 58 | + { |
| 59 | + "blocks" : [ |
| 60 | + { |
| 61 | + "type": "section", |
| 62 | + "text": { |
| 63 | + "type": "mrkdwn", |
| 64 | + "text": "<${{ github.event.head_commit.url || github.event.pull_request.html_url }}|${{ env.CI_COMMIT }}> on (${{ github.ref_name }}) by ${{ github.event.head_commit.author.username || github.event.pull_request.user.login }}" |
| 65 | + } |
| 66 | + }, |
| 67 | + { |
| 68 | + "type": "section", |
| 69 | + "text": { |
| 70 | + "type": "plain_text", |
| 71 | + "text": ${{ toJSON(github.event.head_commit.message || github.event.pull_request.title) }} |
| 72 | + } |
| 73 | + }, |
| 74 | + { |
| 75 | + "type": "section", |
| 76 | + "text": { |
| 77 | + "type": "mrkdwn", |
| 78 | + "text": "${{ env.CI_EMOJI }} <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{ job.status }}>" |
| 79 | + } |
| 80 | + }, |
| 81 | + { |
| 82 | + "type": "section", |
| 83 | + "text": { |
| 84 | + "type": "plain_text", |
| 85 | + "text": "Duration: ${{ env.CI_TIME_DIFF_H }}h ${{ env.CI_TIME_DIFF_M }}min ${{ env.CI_TIME_DIFF_S }}s" |
| 86 | + } |
| 87 | + } |
| 88 | + ] |
| 89 | + } |
| 90 | + env: |
| 91 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
| 92 | + SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
0 commit comments