-
Notifications
You must be signed in to change notification settings - Fork 15
196 lines (196 loc) · 8.38 KB
/
linux-x64.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
name: Linux build
on:
push:
branches-ignore:
- _**
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: [self-hosted, linux, X64]
steps:
- name: Record initial timestamp
run: |
echo "CI_INITIAL_TIMESTAMP=$(date '+%s')" >> $GITHUB_ENV
- name: Check out repo
uses: actions/checkout@v2
- name: Identify the base FStar branch and the notification channel
run: |
echo "FSTAR_BRANCH=$(jq -c -r '.BranchName' .docker/build/config.json)" >> $GITHUB_ENV
echo "CI_SLACK_CHANNEL=$(jq -c -r '.NotificationChannel' .docker/build/config.json)" >> $GITHUB_ENV
- name: Determine the build flavor
run: |
if docker image inspect fstar:local-branch-$FSTAR_BRANCH ; then echo CI_FLAVOR=hierarchic >> $GITHUB_ENV ; else echo CI_FLAVOR=standalone >> $GITHUB_ENV ; fi
- name: Build Everparse and its dependencies
run: |
ci_docker_image_tag=everparse:local-run-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
docker buildx build --secret id=DZOMO_GITHUB_TOKEN -t $ci_docker_image_tag -f .docker/$CI_FLAVOR.Dockerfile --build-arg FSTAR_BRANCH=$FSTAR_BRANCH --build-arg CI_BRANCH=$GITHUB_REF_NAME .
ci_docker_status=$(docker run everparse:local-run-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT /bin/bash -c 'cat $EVERPARSE_HOME/status.txt' || echo false)
if $ci_docker_status ; then
if ! { echo $GITHUB_REF_NAME | grep '/' ; } ; then
docker tag $ci_docker_image_tag everparse:local-branch-$GITHUB_REF_NAME
fi
docker tag $ci_docker_image_tag everparse:local-commit-$GITHUB_SHA
fi
docker run $ci_docker_image_tag /bin/bash -c 'cat $EVERPARSE_HOME/log.txt' > log.txt
$ci_docker_status
env:
DZOMO_GITHUB_TOKEN: ${{ secrets.DZOMO_GITHUB_TOKEN }}
- name: Archive build log
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: log
path: log.txt
- name: Compute elapsed time
if: ${{ always() }}
run: |
CI_FINAL_TIMESTAMP=$(date '+%s')
CI_TIME_DIFF=$(( $CI_FINAL_TIMESTAMP - $CI_INITIAL_TIMESTAMP ))
echo "CI_TIME_DIFF_S=$(( $CI_TIME_DIFF % 60 ))" >> $GITHUB_ENV
echo "CI_TIME_DIFF_M=$(( ($CI_TIME_DIFF / 60) % 60 ))" >> $GITHUB_ENV
echo "CI_TIME_DIFF_H=$(( $CI_TIME_DIFF / 3600 ))" >> $GITHUB_ENV
case ${{ job.status }} in
(success)
echo "CI_EMOJI=✅" >> $GITHUB_ENV
;;
(cancelled)
echo "CI_EMOJI=⚠" >> $GITHUB_ENV
;;
(*)
echo "CI_EMOJI=❌" >> $GITHUB_ENV
;;
esac
echo "CI_COMMIT=$(echo ${{ github.event.head_commit.id || github.event.pull_request.head.sha }} | grep -o '^........')" >> $GITHUB_ENV
- name: Post to the Slack channel
if: ${{ always() }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ env.CI_SLACK_CHANNEL }}
payload: |
{
"blocks" : [
{
"type": "section",
"text": {
"type": "mrkdwn",
"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 }}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": ${{ toJSON(github.event.head_commit.message || github.event.pull_request.title) }}
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.CI_EMOJI }} <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{ job.status }}>"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Duration: ${{ env.CI_TIME_DIFF_H }}h ${{ env.CI_TIME_DIFF_M }}min ${{ env.CI_TIME_DIFF_S }}s"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
produce-binary:
runs-on: [self-hosted, linux, X64]
steps:
- name: Record initial timestamp
run: |
echo "CI_INITIAL_TIMESTAMP=$(date '+%s')" >> $GITHUB_ENV
- name: Check out repo
uses: actions/checkout@v2
- name: Identify the base FStar branch and the notification channel
run: |
echo "FSTAR_BRANCH=$(jq -c -r '.BranchName' .docker/build/config.json)" >> $GITHUB_ENV
echo "CI_SLACK_CHANNEL=$(jq -c -r '.NotificationChannel' .docker/build/config.json)" >> $GITHUB_ENV
- name: Build Everparse and its dependencies
run: |
ci_docker_image_tag=everparse:local-binary-run-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
docker buildx build --secret id=DZOMO_GITHUB_TOKEN -t $ci_docker_image_tag -f .docker/produce-binary.Dockerfile --build-arg FSTAR_BRANCH=$FSTAR_BRANCH --build-arg CI_BRANCH=$GITHUB_REF_NAME .
docker run $ci_docker_image_tag /bin/bash -c 'cat $EVERPARSE_HOME/everparse.tar.gz || true' > everparse.tar.gz
mkdir -p everparse
mv everparse.tar.gz everparse/
(cd everparse && tar xf everparse.tar.gz)
env:
DZOMO_GITHUB_TOKEN: ${{ secrets.DZOMO_GITHUB_TOKEN }}
- name: Archive EverParse package
uses: actions/upload-artifact@v4
with:
name: everparse
path: everparse/everparse
include-hidden-files: true
- name: Compute elapsed time
if: ${{ always() }}
run: |
CI_FINAL_TIMESTAMP=$(date '+%s')
CI_TIME_DIFF=$(( $CI_FINAL_TIMESTAMP - $CI_INITIAL_TIMESTAMP ))
echo "CI_TIME_DIFF_S=$(( $CI_TIME_DIFF % 60 ))" >> $GITHUB_ENV
echo "CI_TIME_DIFF_M=$(( ($CI_TIME_DIFF / 60) % 60 ))" >> $GITHUB_ENV
echo "CI_TIME_DIFF_H=$(( $CI_TIME_DIFF / 3600 ))" >> $GITHUB_ENV
case ${{ job.status }} in
(success)
echo "CI_EMOJI=✅" >> $GITHUB_ENV
;;
(cancelled)
echo "CI_EMOJI=⚠" >> $GITHUB_ENV
;;
(*)
echo "CI_EMOJI=❌" >> $GITHUB_ENV
;;
esac
echo "CI_COMMIT=$(echo ${{ github.event.head_commit.id || github.event.pull_request.head.sha }} | grep -o '^........')" >> $GITHUB_ENV
- name: Post to the Slack channel
if: ${{ always() }}
id: slack
uses: slackapi/[email protected]
with:
channel-id: ${{ env.CI_SLACK_CHANNEL }}
payload: |
{
"blocks" : [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "<${{ github.event.head_commit.url || github.event.pull_request.html_url }}|${{ env.CI_COMMIT }}> on (${{ github.ref_name }}) (produce Linux binary) by ${{ github.event.head_commit.author.username || github.event.pull_request.user.login }}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": ${{ toJSON(github.event.head_commit.message || github.event.pull_request.title) }}
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "${{ env.CI_EMOJI }} <https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}|${{ job.status }}>"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Duration: ${{ env.CI_TIME_DIFF_H }}h ${{ env.CI_TIME_DIFF_M }}min ${{ env.CI_TIME_DIFF_S }}s"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK