Skip to content

Commit

Permalink
Cache actions dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
finnvoor committed Apr 5, 2024
1 parent 348e85a commit a9d473c
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 23 deletions.
51 changes: 41 additions & 10 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,58 @@
name: Build
on:
push:
branches:
- main
branches: [main]
pull_request:
branches: [main]

jobs:
Build:
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Install nightly Swift
- uses: actions/checkout@v4
- name: Run gtar as root
run: sudo chown root /opt/homebrew/bin/gtar && sudo chmod u+s /opt/homebrew/bin/gtar
- name: Get latest Swift version
id: swift-version
run: |
DOWNLOAD=$(curl "https://raw.githubusercontent.com/apple/swift-org-website/main/_data/builds/development/xcode.yml" | yq '.[0].download')
DIR=$(curl "https://raw.githubusercontent.com/apple/swift-org-website/main/_data/builds/development/xcode.yml" | yq '.[0].dir')
curl -L -sS --show-error --fail "https://download.swift.org/development/xcode/$DIR/$DOWNLOAD" -o $DOWNLOAD
sudo installer -store -pkg $DOWNLOAD -target /
- name: Select Xcode
run: sudo xcode-select -s '/Applications/Xcode_15.3.app'
- name: Install Playdate SDK
echo "name=$DIR" >> $GITHUB_OUTPUT
echo "url=https://download.swift.org/development/xcode/$DIR/$DOWNLOAD" >> $GITHUB_OUTPUT
- name: Cache Swift
id: cache-swift
uses: actions/cache@v4
with:
path: /Library/Developer/Toolchains/${{ steps.swift-version.outputs.name }}.xctoolchain
key: ${{ steps.swift-version.outputs.name }}
- if: ${{ steps.cache-swift.outputs.cache-hit != 'true' }}
name: Install latest Swift version
run: |
curl -L -sS --show-error --fail ${{ steps.swift-version.outputs.url }} -o swift.pkg
sudo installer -store -pkg swift.pkg -target /
- name: Get latest Playdate SDK version
id: playdate-version
run: |
URL=$(curl -Ls -o /dev/null -w %{url_effective} -X HEAD "https://download.panic.com/playdate_sdk/PlaydateSDK-latest.zip")
echo "name=$(echo $URL | sed 's|.*/\(PlaydateSDK-[0-9]*\.[0-9]*\.[0-9]*\)\.zip|\1|')" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
- name: Cache Playdate
id: cache-playdate
uses: actions/cache@v4
with:
path: |
~/Developer/PlaydateSDK
/usr/local/playdate
key: ${{ steps.playdate-version.outputs.name }}
- if: ${{ steps.cache-playdate.outputs.cache-hit != 'true' }}
name: Install Playdate SDK
run: |
curl -L -sS --show-error --fail "https://download.panic.com/playdate_sdk/PlaydateSDK-latest.zip" -o PlaydateSDK-latest.zip
curl -L -sS --show-error --fail ${{ steps.playdate-version.outputs.url }} -o PlaydateSDK-latest.zip
unzip PlaydateSDK-latest.zip
sudo installer -store -pkg "PlaydateSDK.pkg" -target /
- name: Select Xcode
run: |
ls /Library/Developer/Toolchains/swift-latest.xctoolchain
sudo xcode-select -s '/Applications/Xcode_15.3.app'
- name: Build
run: set -o pipefail && $(xcrun -f swift -toolchain "swift latest") build -c release | xcbeautify --renderer github-actions
56 changes: 45 additions & 11 deletions .github/workflows/BuildDocs.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,69 @@
name: Deploy Documentation
on:
push:
branches: ["main"]
branches: [main]

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: true

jobs:
DeployDocs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- name: Install nightly Swift
- uses: actions/checkout@v4
- name: Run gtar as root
run: sudo chown root /opt/homebrew/bin/gtar && sudo chmod u+s /opt/homebrew/bin/gtar
- name: Get latest Swift version
id: swift-version
run: |
DOWNLOAD=$(curl "https://raw.githubusercontent.com/apple/swift-org-website/main/_data/builds/development/xcode.yml" | yq '.[0].download')
DIR=$(curl "https://raw.githubusercontent.com/apple/swift-org-website/main/_data/builds/development/xcode.yml" | yq '.[0].dir')
curl -L -sS --show-error --fail "https://download.swift.org/development/xcode/$DIR/$DOWNLOAD" -o $DOWNLOAD
sudo installer -store -pkg $DOWNLOAD -target /
- name: Select Xcode
run: sudo xcode-select -s '/Applications/Xcode_15.3.app'
- name: Install Playdate SDK
echo "name=$DIR" >> $GITHUB_OUTPUT
echo "url=https://download.swift.org/development/xcode/$DIR/$DOWNLOAD" >> $GITHUB_OUTPUT
- name: Cache Swift
id: cache-swift
uses: actions/cache@v4
with:
path: /Library/Developer/Toolchains/${{ steps.swift-version.outputs.name }}.xctoolchain
key: ${{ steps.swift-version.outputs.name }}
- if: ${{ steps.cache-swift.outputs.cache-hit != 'true' }}
name: Install latest Swift version
run: |
curl -L -sS --show-error --fail "https://download.panic.com/playdate_sdk/PlaydateSDK-latest.zip" -o PlaydateSDK-latest.zip
curl -L -sS --show-error --fail ${{ steps.swift-version.outputs.url }} -o swift.pkg
sudo installer -store -pkg swift.pkg -target /
- name: Get latest Playdate SDK version
id: playdate-version
run: |
URL=$(curl -Ls -o /dev/null -w %{url_effective} -X HEAD "https://download.panic.com/playdate_sdk/PlaydateSDK-latest.zip")
echo "name=$(echo $URL | awk -F'/' '{print $NF}' | sed 's/.zip$//')" >> $GITHUB_OUTPUT
echo "url=$URL" >> $GITHUB_OUTPUT
- name: Cache Playdate
id: cache-playdate
uses: actions/cache@v4
with:
path: |
~/Developer/PlaydateSDK
/usr/local/playdate
key: ${{ steps.playdate-version.outputs.name }}
- if: ${{ steps.cache-playdate.outputs.cache-hit != 'true' }}
name: Install Playdate SDK
run: |
curl -L -sS --show-error --fail ${{ steps.playdate-version.outputs.url }} -o PlaydateSDK-latest.zip
unzip PlaydateSDK-latest.zip
sudo installer -store -pkg "PlaydateSDK.pkg" -target /
- name: Select Xcode
run: |
ls /Library/Developer/Toolchains/swift-latest.xctoolchain
sudo xcode-select -s '/Applications/Xcode_15.3.app'
- name: Build
run: |
xcodebuild docbuild -scheme PlaydateKit \
Expand All @@ -42,9 +76,9 @@ jobs:
--hosting-base-path PlaydateKit \
--output-path docs;
- name: Upload
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'
- name: Deploy
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
5 changes: 3 additions & 2 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: Lint
on:
pull_request:
branches: [main]

jobs:
Lint:
runs-on: macos-latest
runs-on: macos-14
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: SwiftFormat
run: swiftformat --lint . --reporter github-actions-log

0 comments on commit a9d473c

Please sign in to comment.