diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..a91e7ed --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 }} diff --git a/.gitignore b/.gitignore index 5cd1097..e0e5082 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .DS_Store -.build/ +.build build/ y-build/ diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c72197f..0000000 --- a/.travis.yml +++ /dev/null @@ -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}