forked from dfinity/ic
-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (143 loc) · 5.67 KB
/
schedule-hourly.yml
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
name: Schedule Hourly
on:
schedule:
- cron: "0 * * * *"
workflow_dispatch:
env:
CI_COMMIT_SHA: ${{ github.sha }}
CI_COMMIT_REF_PROTECTED: ${{ github.ref_protected }}
CI_JOB_NAME: ${{ github.job }}
CI_JOB_ID: ${{ github.job }} # github does not expose this variable https://github.com/orgs/community/discussions/8945
CI_JOB_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
CI_PIPELINE_SOURCE: ${{ github.event_name }}
CI_PROJECT_DIR: ${{ github.workspace }}
CI_MERGE_REQUEST_TARGET_BRANCH_NAME: ${{ github.event.pull_request.base.ref }}
ROOT_PIPELINE_ID: ${{ github.run_id }}
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
RUSTFLAGS: "--remap-path-prefix=${CI_PROJECT_DIR}=/ic"
AWS_SHARED_CREDENTIALS_CONTENT: ${{ secrets.AWS_SHARED_CREDENTIALS_FILE }}
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
DOCKER_HUB_PASSWORD_RO: ${{ secrets.DOCKER_HUB_PASSWORD_RO }}
BUILDEVENT_APIKEY: ${{ secrets.HONEYCOMB_API_TOKEN }}
BUILDEVENT_DATASET: "github-ci-dfinity"
jobs:
bazel-build-all-no-cache:
name: Bazel Build All No Cache
runs-on:
labels: bazel-runner-large
container:
image: ghcr.io/dfinity/ic-build@sha256:eb85228ebf7511e2589f86788345eb3d1c8144914a8a2fa771d4347ddacac413
timeout-minutes: 120
if: ${{ vars.RUN_CI == 'true' }} # needed to avoid running on public dfinity org until published
steps:
- name: Before script
if: always()
id: before-script
shell: bash
run: |
git config --global http.postBuffer 524288000
git config --global safe.directory '*'
if [ -e /__w/cache ]; then sudo ln -s /__w/cache /; fi
if [ -n "${NODE_NAME:-}" ]; then echo "Node: $NODE_NAME"; fi
- name: Checkout
uses: actions/checkout@v3
- name: Docker RO SA login
id: docker-ro-login
shell: bash
run: |
docker login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD_RO"
if which docker-bin 2>/dev/null; then
docker-bin login -u "$DOCKER_HUB_USER" -p "$DOCKER_HUB_PASSWORD_RO"
fi
- name: Run Bazel Build All No Cache
uses: ./.github/actions/bazel-test-all/
with:
BAZEL_CI_CONFIG: "--config=ci"
BAZEL_COMMAND: "build"
BAZEL_EXTRA_ARGS: "--repository_cache= --disk_cache= --noremote_accept_cached --remote_instance_name=${CI_COMMIT_SHA} --@rules_rust//rust/settings:pipelined_compilation=True"
- name: Bazel Clean
if: always()
run: bazel clean
bazel-system-test-hourly:
name: Bazel System Tests Hourly
runs-on:
labels: bazel-runner-large
container:
image: ghcr.io/dfinity/ic-build@sha256:eb85228ebf7511e2589f86788345eb3d1c8144914a8a2fa771d4347ddacac413
timeout-minutes: 120
if: ${{ vars.RUN_CI == 'true' }}
steps:
- name: Before script
if: always()
id: before-script
shell: bash
run: |
git config --global http.postBuffer 524288000
git config --global safe.directory '*'
if [ -e /__w/cache ]; then sudo ln -s /__w/cache /; fi
if [ -n "${NODE_NAME:-}" ]; then echo "Node: $NODE_NAME"; fi
- name: Checkout
uses: actions/checkout@v3
- name: Run Bazel System Test Hourly
id: bazel-test-all
uses: ./.github/actions/bazel-test-all/
with:
BAZEL_COMMAND: "test"
BAZEL_TARGETS: "//... --deleted_packages=gitlab-ci/src/gitlab_config"
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_EXTRA_ARGS: "--keep_going --verbose_failures --test_tag_filters=system_test_hourly"
HONEYCOMB_API_TOKEN: ${{ secrets.HONEYCOMB_API_TOKEN }}
- name: Bazel Clean
if: always()
run: bazel clean
bazel-test-coverage:
name: Bazel Test Coverage
runs-on:
labels: bazel-runner-large
container:
image: ghcr.io/dfinity/ic-build@sha256:eb85228ebf7511e2589f86788345eb3d1c8144914a8a2fa771d4347ddacac413
timeout-minutes: 120
if: ${{ vars.RUN_CI == 'true' }}
steps:
- name: Before script
if: always()
id: before-script
shell: bash
run: |
git config --global http.postBuffer 524288000
git config --global safe.directory '*'
if [ -e /__w/cache ]; then sudo ln -s /__w/cache /; fi
if [ -n "${NODE_NAME:-}" ]; then echo "Node: $NODE_NAME"; fi
- name: Checkout
uses: actions/checkout@v3
- name: Run Bazel Test Coverage
shell: bash
run: |
set -eExuo pipefail
bazel query --universe_scope=//... \
"kind(test, //rs/...) except kind(test, allrdeps(attr('tags', 'canister', //rs/...)))" \
> cov_targets.txt
# shellcheck disable=SC2046,SC2086
bazel ${BAZEL_STARTUP_ARGS} coverage ${BAZEL_CI_CONFIG} ${BAZEL_EXTRA_ARGS} --test_timeout=3000 \
--combined_report=lcov $(<cov_targets.txt) || true
cp bazel-out/_coverage/_coverage_report.dat cov_report.dat
genhtml --output cov_html cov_report.dat
env:
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_EXTRA_ARGS: "--combined_report=lcov"
# TODO: publish coverage to github pages
- name: Upload Test Coverage Report
uses: actions/upload-artifact@v4
with:
name: coverage-report
compression-level: 9
# TODO: change to 7 before migration
retention-days: 1
if-no-files-found: error
path: |
cov_targets.txt
cov_report.dat
cov_html/
- name: Bazel Clean
if: always()
run: bazel clean