Use GitHub Actions.

This commit is contained in:
YOCKOW 2020-05-22 14:18:46 +09:00
parent 2fc382fcbd
commit ffd3d7a4d1
No known key found for this signature in database
GPG Key ID: BEEDB9712A367313
3 changed files with 61 additions and 29 deletions

60
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,60 @@
name: CI
on:
push:
branches:
- '**'
tags-ignore:
- '**'
paths:
- '**/*.swift'
- '.github/workflows/*.yml'
pull_request:
paths:
- '**/*.swift'
- '.github/workflows/*.yml'
jobs:
test:
strategy:
matrix:
os:
- ubuntu-latest
- macOS-latest
swift-compat-ver:
- '5'
# - '4.2'
# - '4'
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Use a cache for ".build" directory.
uses: actions/cache@v1
with:
path: .build
key: build-${{ github.workspace }}-${{ runner.os }}-${{ matrix.swift-compat-ver }}-${{ hashFiles('**/*.swift') }}
restore-keys: |
build-${{ github.workspace }}-${{ runner.os }}-${{ matrix.swift-compat-ver }}-
build-${{ github.workspace }}-${{ runner.os }}-
build-${{ github.workspace }}-
- uses: YOCKOW/Action-setup-swift@master
with:
swift-version: '5.2.2'
- name: Try to build products with debug mode.
run: |
swift build --configuration debug -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }}
if [ $? != 0 ]; then
echo "Failed to build products with debug mode."
rm -rf $(cd .build/debug && pwd -P)
fi
continue-on-error: true
- name: Test with debug mode.
run: swift test --configuration debug -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }}
- name: Try to build products with release mode.
run: |
swift build --configuration release -Xswiftc -enable-testing -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }}
if [ $? != 0 ]; then
echo "Failed to build products with release mode."
rm -rf $(cd .build/release && pwd -P)
fi
continue-on-error: true
- name: Test with release mode.
run: swift test --configuration release -Xswiftc -enable-testing -Xswiftc -swift-version -Xswiftc ${{ matrix.swift-compat-ver }}

2
.gitignore vendored
View File

@ -1,6 +1,6 @@
.DS_Store
.build/
.build
build/
y-build/

View File

@ -1,28 +0,0 @@
branches:
except:
- /^\d+\.\d+\.\d+(-\S*)?$/
os:
- linux
- osx
language: generic
sudo: required
osx_image: xcode10.2
dist: xenial
env:
- SWIFT_BUILD_OPTION="-Xswiftc -swift-version -Xswiftc 4"
- SWIFT_BUILD_OPTION="-Xswiftc -swift-version -Xswiftc 4.2"
- SWIFT_BUILD_OPTION="-Xswiftc -swift-version -Xswiftc 5"
before_install:
- |
if [ $(uname) = "Linux" ]; then
export SWIFT_ARCHIVE_URL="https://swift.org/builds/swift-5.0-release/ubuntu1604/swift-5.0-RELEASE/swift-5.0-RELEASE-ubuntu16.04.tar.gz"
curl ${SWIFT_ARCHIVE_URL} -o ../swift.tar.gz
mkdir ../swift
tar xzf ../swift.tar.gz -C ../swift --strip-components 2
export PATH="$(dirname $(pwd))/swift/bin:$PATH"
fi
script:
- swift build ${SWIFT_BUILD_OPTION}
- swift build --configuration release ${SWIFT_BUILD_OPTION}
- swift test ${SWIFT_BUILD_OPTION}