Skip to content

Commit

Permalink
Merge branch 'master' into examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlokhorst committed Sep 15, 2020
2 parents e97e138 + 269888b commit 9838171
Show file tree
Hide file tree
Showing 21 changed files with 340 additions and 1,154 deletions.
107 changes: 107 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Checks

on:
push:
branches: [ master ]
pull_request:
branches: '*'

env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer

jobs:
unit-tests:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull cache
uses: actions/cache@v1
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Test
run: swift test -v

test-iOS:
runs-on: macos-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download build
uses: actions/download-artifact@v1
with:
name: rswift-dev
- name: Put build into place
run: |
mkdir -p build/Debug
mv rswift-dev/rswift build/Debug/rswift
chmod +x build/Debug/rswift
- name: Pull cache
uses: actions/cache@v1
id: pod-cache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install pods
if: steps.pod-cache.outputs.cache-hit != 'true'
run: pod install
- name: Test
run: fastlane scan --workspace "ResourceApp.xcworkspace" --scheme "ResourceApp"

test-tvOS:
runs-on: macos-latest
needs: build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Download build
uses: actions/download-artifact@v1
with:
name: rswift-dev
- name: Put build into place
run: |
mkdir -p build/Debug
mv rswift-dev/rswift build/Debug/rswift
chmod +x build/Debug/rswift
- name: Pull cache
uses: actions/cache@v1
id: pod-cache
with:
path: Pods
key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }}
restore-keys: |
${{ runner.os }}-pods-
- name: Install pods
if: steps.pod-cache.outputs.cache-hit != 'true'
run: pod install
- name: Test
run: fastlane scan --workspace "ResourceApp.xcworkspace" --scheme "ResourceApp-tvOS"

build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull cache
uses: actions/cache@v1
with:
path: .build
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-spm-
- name: Set version
run: |
sed -i "" "s/\(static let version = \"\)Unknown\(\"\)/\1Development build: ${GITHUB_SHA}\2/" Sources/rswift/Rswift.swift
- name: Build
run: swift build -v -c release
- name: Store artifact
uses: actions/upload-artifact@v1
with:
name: rswift-dev
path: .build/release/rswift
112 changes: 112 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Release

on:
release:
types: created

env:
DEVELOPER_DIR: /Applications/Xcode_11.4.app/Contents/Developer

jobs:
release-build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set version
run: |
sed -i "" "s/\(static let version = \"\).*\(\"\)/\1${TAG}\2/" Sources/rswift/Rswift.swift
env:
TAG: ${{ github.event.release.tag_name }}
- name: Tarball source
run: |
tar -zcvf $TARGET --exclude .git .
env:
TARGET: ${{ runner.temp }}/source.tar.gz
- name: Attach tarball to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/source.tar.gz
asset_name: rswift-${{ github.event.release.tag_name }}-source.tar.gz
asset_content_type: application/tar+gzip

- name: Build
run: swift build -v -c release
- name: Import Signing Certificates
uses: apple-actions/import-codesign-certs@v1
with:
p12-file-base64: ${{ secrets.APPLE_CERTS }}
p12-password: ${{ secrets.APPLE_CERTS_PASSWORD }}
- name: Code Sign
run: |
codesign --force --options runtime --sign 'Developer ID Application: Mathijs Kadijk (5Z49PA849J)' .build/release/rswift
- name: Store build artifact
uses: actions/upload-artifact@v1
with:
name: rswift-${{ github.event.release.tag_name }}
path: .build/release/rswift

- name: Archive ZIP
run: zip --junk-paths ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip .build/release/rswift License
- name: Notarize ZIP
run: |
sh notarize.sh
env:
BUNDLE_ID: nl.mathijskadijk.rswift
DEV_ACCOUNT: ${{ secrets.APPLE_ID_EMAIL }}
PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
DEV_TEAM: 5Z49PA849J
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip
- name: Attach ZIP to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.zip
asset_name: rswift-${{ github.event.release.tag_name }}.zip
asset_content_type: application/zip

- name: Publish to Cocoapods
run: |
export POD_VERSION=$(echo $TAG_NAME | cut -c2-)
pod trunk push
env:
TAG_NAME: ${{ github.event.release.tag_name }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}

- name: Archive PKG
run: |
mkdir -p $PKG_ROOT/$BINARY_ROOT
cp .build/release/rswift $PKG_ROOT/$BINARY_ROOT
pkgbuild --root $PKG_ROOT --identifier "nl.mathijskadijk.rswift" --version $TAG_NAME --install-location "/" --sign "Developer ID Installer: Mathijs Kadijk (5Z49PA849J)" $FILENAME
env:
TAG_NAME: ${{ github.event.release.tag_name }}
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
BUNDLE_ID: nl.mathijskadijk.rswift
PKG_ROOT: ${{ runner.temp }}/pkgroot
BINARY_ROOT: /usr/local/bin
- name: Notarize PKG
run: |
sh notarize.sh && xcrun stapler staple "$FILENAME"
env:
BUNDLE_ID: nl.mathijskadijk.rswift
DEV_ACCOUNT: ${{ secrets.APPLE_ID_EMAIL }}
PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
DEV_TEAM: 5Z49PA849J
FILENAME: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
- name: Attach PKG to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ${{ runner.temp }}/rswift-${{ github.event.release.tag_name }}.pkg
asset_name: rswift-${{ github.event.release.tag_name }}.pkg
asset_content_type: application/pkg

- name: Publish to Homebrew
run: brew bump-formula-pr --tag $TAG_NAME --revision $REVISION rswift || exit 0
Loading

0 comments on commit 9838171

Please sign in to comment.