Skip to content

Commit 470b816

Browse files
committed
Swift: add ARM build to CI, and other fixes
Also: * removed the pretty much non-functioning bazel cache, will come back to it when we have a broader solution * replaced sharing the extractor pack via cache with uploading and downloading it
1 parent 5eaba48 commit 470b816

File tree

8 files changed

+50
-64
lines changed

8 files changed

+50
-64
lines changed

.github/workflows/swift.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,19 @@ permissions:
3737
contents: read
3838

3939
jobs:
40-
# not using a matrix as you cannot depend on a specific job in a matrix, and we want to start linux checks
41-
# without waiting for the macOS build
40+
# not putting linux in the matrix as you cannot depend on a specific job in a matrix, and we want to start linux
41+
# checks without waiting for the macOS build
4242
build-and-test-macos:
4343
if: github.repository_owner == 'github'
44-
runs-on: macos-12-xl
44+
strategy:
45+
matrix:
46+
runner: [macos-13-xlarge, macos-13-large] # both ARM and Intel
47+
runs-on: ${{ matrix.runner }}
4548
steps:
4649
- uses: actions/checkout@v4
4750
- uses: ./swift/actions/build-and-test
51+
with:
52+
upload: ${{ matrix.runner == 'macos-13-large' }}
4853
build-and-test-linux:
4954
if: github.repository_owner == 'github'
5055
runs-on: ubuntu-latest-xl
@@ -61,7 +66,7 @@ jobs:
6166
qltests-macos:
6267
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
6368
needs: build-and-test-macos
64-
runs-on: macos-12-xl
69+
runs-on: macos-13-xlarge
6570
steps:
6671
- uses: actions/checkout@v4
6772
- uses: ./swift/actions/run-ql-tests
@@ -75,7 +80,7 @@ jobs:
7580
integration-tests-macos:
7681
if: ${{ github.repository_owner == 'github' && github.event_name == 'pull_request' }}
7782
needs: build-and-test-macos
78-
runs-on: macos-12-xl
83+
runs-on: macos-13-xlarge
7984
timeout-minutes: 60
8085
steps:
8186
- uses: actions/checkout@v4

swift/.python-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.8.14
1+
3.11
Lines changed: 8 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,21 @@
11
name: Build Swift CodeQL pack
22
description: Builds the Swift CodeQL pack
3+
inputs:
4+
upload:
5+
description: Whether to upload the extractor pack
6+
default: true
37
runs:
48
using: composite
59
steps:
610
- uses: bazelbuild/setup-bazelisk@v2
711
- uses: actions/setup-python@v4
812
with:
913
python-version-file: 'swift/.python-version'
10-
# FIXME: this is copy-pasted from .github/actions/cache-query-compilation, but we cannot factor it out to a common
11-
# composite action because of https://github.com/actions/runner/issues/2009 (cache fails to save in the post action
12-
# phase because its inputs were lost in the meantime)
13-
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
14-
- name: Calculate merge-base
15-
shell: bash
16-
if: ${{ github.event_name == 'pull_request' }}
17-
env:
18-
BASE_BRANCH: ${{ github.base_ref }}
19-
run: |
20-
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
21-
echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
22-
- name: Restore read-only cache (PR)
23-
if: ${{ github.event_name == 'pull_request' }}
24-
uses: actions/cache/restore@v3
25-
with:
26-
path: 'bazel-cache'
27-
key: bazel-pr-${{ github.sha }}
28-
restore-keys: |
29-
bazel-${{ github.base_ref }}-${{ env.merge_base }}
30-
bazel-${{ github.base_ref }}-
31-
bazel-main-
32-
- name: Fill cache (push)
33-
if: ${{ github.event_name != 'pull_request' }}
34-
uses: actions/cache@v3
35-
with:
36-
path: 'bazel-cache'
37-
key: bazel-${{ github.ref_name }}-${{ github.sha }} # just fill on main
38-
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
39-
bazel-${{ github.ref_name }}-
40-
bazel-main-
4114
- name: Configure bazel
4215
shell: bash
4316
run: |
44-
mkdir -p bazel-cache/{repository,disk}
45-
echo build --repository_cache=bazel-cache/repository --disk_cache=bazel-cache/disk > local.bazelrc
17+
echo > local.bazelrc
4618
echo test --test_output=errors >> local.bazelrc
47-
# - name: Print unextracted entities
48-
# shell: bash
49-
# run: |
50-
# bazel run //swift/extractor/print_unextracted
51-
- uses: ./swift/actions/share-extractor-pack
5219
- name: Build Swift extractor
5320
shell: bash
5421
run: |
@@ -63,10 +30,6 @@ runs:
6330
shell: bash
6431
run: |
6532
bazel test //swift/...
66-
- name: Evict bazel cache
67-
if: ${{ github.event_name != 'pull_request' }}
68-
shell: bash
69-
run: |
70-
du -sh bazel-cache/*
71-
find bazel-cache -atime +0 -type f -delete
72-
du -sh bazel-cache/*
33+
- name: Upload
34+
if: inputs.upload == 'true'
35+
uses: ./swift/actions/upload-extractor-pack
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: Download Swift CodeQL pack
2+
description: Downloads the Swift CodeQL pack
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Download
7+
uses: actions/download-artifact@v4
8+
with:
9+
name: swift-extractor-pack-${{ runner.os }}
10+
- name: Extract
11+
shell: bash
12+
run: |
13+
zstd -cd swift-extractor-pack-${{ runner.os }}.tar.zst | tar xvf -

swift/actions/run-integration-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: Builds the Swift CodeQL pack
33
runs:
44
using: composite
55
steps:
6-
- uses: ./swift/actions/share-extractor-pack
6+
- uses: ./swift/actions/download-extractor-pack
77
- uses: actions/setup-python@v4
88
with:
99
python-version-file: 'swift/.python-version'

swift/actions/run-ql-tests/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ inputs:
88
runs:
99
using: composite
1010
steps:
11-
- uses: ./swift/actions/share-extractor-pack
11+
- uses: ./swift/actions/download-extractor-pack
1212
- uses: ./.github/actions/fetch-codeql
1313
- id: query-cache
1414
uses: ./.github/actions/cache-query-compilation

swift/actions/share-extractor-pack/action.yml

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Upload Swift CodeQL pack
2+
description: Uploads the Swift CodeQL pack
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Compress
7+
shell: bash
8+
run: |
9+
tar cf - swift/extractor-pack | zstd > swift-extractor-pack-${{ runner.os }}.tar.zst
10+
- name: Upload
11+
uses: actions/upload-artifact@v4
12+
with:
13+
name: swift-extractor-pack-${{ runner.os }}
14+
path: swift-extractor-pack-${{ runner.os }}.tar.zst
15+
compression-level: 0
16+
retention-days: 3

0 commit comments

Comments
 (0)