Skip to content

0.2.0-beta.5

0.2.0-beta.5 #33

Workflow file for this run

name: SwiftTube
on:
push:
branches:
- 'pr/*'
- 'feature/*'
- 'release/*'
- 'bugfix/*'
tags: '*'
pull_request:
types: '*'
env:
YOUTUBE_API_KEY: ${{ secrets.YOUTUBE_API_KEY }}
YOUTUBE_PLAYLIST_ID: ${{ secrets.YOUTUBE_PLAYLIST_ID }}
jobs:
build-ubuntu:
name: Build on Ubuntu
env:
PACKAGE_NAME: SwiftTube
SWIFT_VER: ${{ matrix.swift-version }}
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
runs-on: [ubuntu-18.04, ubuntu-20.04]
swift-version: [5.2.4, 5.3.3, 5.4.1, 5.5.2, 5.6.2]
steps:
- uses: actions/checkout@v2
- name: Set Ubuntu Release DOT
run: echo "RELEASE_DOT=$(lsb_release -sr)" >> $GITHUB_ENV
- name: Set Ubuntu Release NUM
run: echo "RELEASE_NUM=${RELEASE_DOT//[-._]/}" >> $GITHUB_ENV
- name: Set Ubuntu Codename
run: echo "RELEASE_NAME=$(lsb_release -sc)" >> $GITHUB_ENV
- name: Download Swift
run: curl -O https://download.swift.org/swift-${SWIFT_VER}-release/ubuntu${RELEASE_NUM}/swift-${SWIFT_VER}-RELEASE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
- name: Extract Swift
run: tar xzf swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}.tar.gz
- name: Add Path
run: echo "$GITHUB_WORKSPACE/swift-${SWIFT_VER}-RELEASE-ubuntu${RELEASE_DOT}/usr/bin" >> $GITHUB_PATH
- name: Build
run: swift build
- name: Run tests
run: swift test --enable-test-discovery
build-macos:
name: Build on macOS
env:
PACKAGE_NAME: SwiftTube
runs-on: ${{ matrix.runs-on }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
matrix:
runs-on: [macos-11, macos-10.15]
xcode: ["/Applications/Xcode_12.4.app", "/Applications/Xcode_11.7.app"]
include:
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.6.app"
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.5.app"
- runs-on: macos-10.15
xcode: "/Applications/Xcode_11.4.1.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_13.1.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_13.0.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_12.5.1.app"
- runs-on: macos-11
xcode: "/Applications/Xcode_13.2.1.app"
- runs-on: macos-12
xcode: "/Applications/Xcode_13.2.1.app"
- runs-on: macos-12
xcode: "/Applications/Xcode_13.3.1.app"
- runs-on: macos-12
xcode: "/Applications/Xcode_13.4.app"
- runs-on: macos-12
xcode: "/Applications/Xcode_13.4.1.app"
steps:
- uses: actions/checkout@v2
- name: Set Xcode Name
run: echo "XCODE_NAME=$(basename -- ${{ matrix.xcode }} | sed 's/\.[^.]*$//' | cut -d'_' -f2)" >> $GITHUB_ENV
- name: Setup Xcode
run: sudo xcode-select -s ${{ matrix.xcode }}/Contents/Developer
- name: Build
run: swift build
- name: Lint
if: startsWith(github.ref, 'refs/tags/') != true
run: swift run swiftformat --lint . && swift run swiftlint
- name: Run tests
run: swift test
deploy:
name: Deploy to Netlify
needs: [build-macos, build-ubuntu]
env:
PACKAGE_NAME: SwiftTube
runs-on: macos-11
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v2
- name: Setup Netlify
run: brew install netlify-cli
- name: Setup Xcode
run: sudo xcode-select -s /Applications/Xcode_13.0.app/Contents/Developer
- name: Resolve Package Dependencies
run: xcodebuild -resolvePackageDependencies -scheme ${{ env.PACKAGE_NAME }} -derivedDataPath DerivedData
- name: Build DocC Documentation
run: xcodebuild docbuild -scheme ${{ env.PACKAGE_NAME }} -destination 'platform=macOS' -derivedDataPath DerivedData
# - name: Deploy Files
# run: netlify deploy --site ${{ secrets.NETLIFY_SITE_ID }} --auth ${{ secrets.NETLIFY_AUTH_TOKEN }} --prod