Resolve dependencies and cache before running individual pipelines #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The purpose of this CI is to build and test Linux Cross SDKs during development. | |
# Only a single version of the SDK will be built for each architecture and tested. | |
name: Develop Swift Linux Cross SDKs | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
SWIFT_VERSION: 6.0.3 | |
DISTRIBUTION_NAME: ubuntu | |
DISTRIBUTION_VERSION: jammy | |
jobs: | |
common-dependencies: | |
name: Setup Common Dependencies | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: swift-actions/setup-swift@v2 | |
- name: Swift Version | |
shell: bash | |
run: swift --version | |
- name: Common Dependencies Cache | |
uses: actions/cache@v4 | |
with: | |
key: common-dependencies-${{ env.SWIFT_VERSION }} | |
path: | | |
swift-sdk-generator | |
test-project/.build | |
- name: Build SDK Generator | |
shell: bash | |
run: ./build-generator.sh | |
- name: Resolve Test Dependencies | |
shell: bash | |
run: swift package resolve --package-path test-project | |
build-sdks: | |
strategy: | |
matrix: | |
target-arch: ["x86_64", "aarch64", "armv7"] | |
name: Build & Test SDK | |
runs-on: ubuntu-22.04 | |
needs: [common-dependencies] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: swift-actions/setup-swift@v2 | |
- name: Restore Common Dependencies | |
uses: actions/cache/restore@v4 | |
with: | |
key: common-dependencies-${{ env.SWIFT_VERSION }} | |
path: | | |
swift-sdk-generator | |
test-project/.build | |
fail-on-cache-miss: true | |
- uses: ./.github/actions/build-and-test-sdk | |
name: Build, Test, Publish | |
with: | |
swift-version: ${{ env.SWIFT_VERSION }} | |
distribution-name: ${{ env.DISTRIBUTION_NAME }} | |
distribution-version: ${{ env.DISTRIBUTION_VERSION }} | |
target-arch: ${{ matrix.target-arch }} |