Skip to content

Commit 5d17354

Browse files
committed
Test release archive in build
1 parent 5e6e59f commit 5d17354

File tree

3 files changed

+24
-10
lines changed

3 files changed

+24
-10
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ jobs:
2020
name: Build SwiftLint with Bazel
2121
env:
2222
CI_BAZELRC_FILE_CONTENT: ${{ secrets.CI_BAZELRC_FILE_CONTENT }}
23+
- name: Prepare release workspace
24+
run: |
25+
cp bazel-bin/swiftlint .
26+
make bazel_release
27+
mkdir -p bazel-workspace
28+
tar -czvf bazel.tar.gz bazel-workspace
29+
cd bazel-workspace
30+
sed -i '/-warnings-as-errors/d' bazel/copts.bzl
31+
- name: Build release archive
32+
uses: ./.github/actions/bazel-linux-build
33+
env:
34+
CI_BAZELRC_FILE_CONTENT: ${{ secrets.CI_BAZELRC_FILE_CONTENT }}
35+
- name: Run tests for extra rules
36+
run: |
37+
bazel run //:swiftlint -- version
38+
bazel test //Tests/ExtraRulesTests --test_output=errors
2339
2440
plugins_linux:
2541
name: SPM plugins, Linux, Swift ${{ matrix.version }}

BUILD

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -225,25 +225,23 @@ filegroup(
225225
],
226226
)
227227

228-
# TODO: Use rules_pkg
229228
genrule(
230229
name = "release",
231230
srcs = [":release_files"],
232231
outs = [
233232
"bazel.tar.gz",
234233
"bazel.tar.gz.sha256",
235234
],
236-
cmd = """\
237-
set -euo pipefail
235+
cmd = """
236+
set -euo pipefail
238237
239-
outs=($(OUTS))
238+
outs=($(OUTS))
240239
241-
COPYFILE_DISABLE=1 tar czvfh "$${outs[0]}" \
242-
--exclude ^bazel-out/ \
243-
--exclude ^external/ \
244-
*
245-
shasum -a 256 "$${outs[0]}" > "$${outs[1]}"
240+
COPYFILE_DISABLE=1 tar -czvfh "$${outs[0]}" --exclude ^bazel-out/ --exclude ^external/ *
241+
242+
"$(location @bazel_tools//tools/build_defs/hash:sha256)" $${outs[0]} $${outs[1]}
246243
""",
244+
tools = ["@bazel_tools//tools/build_defs/hash:sha256"],
247245
)
248246

249247
# Analyze

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ bazel_test_tsan:
143143
bazel test --test_output=errors --build_tests_only --features=tsan --test_timeout=1000 //Tests/...
144144

145145
bazel_release: swiftlint
146-
bazel build :release
146+
bazel build :release --verbose_failures
147147
mv -f bazel-bin/bazel.tar.gz bazel-bin/bazel.tar.gz.sha256 .
148148

149149
docker_image:

0 commit comments

Comments
 (0)