From 781274d7032a7ed327270cf532e92ab11cb51fae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Mon, 15 Jun 2020 11:01:50 +0200 Subject: [PATCH] Fix tests by installing Swift-SH --- .github/workflows/main.yml | 52 +++++++++++++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 3f545b6..ba4596f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,7 +37,7 @@ jobs: path: anylint-cache key: ${{ runner.os }}-v1-anylint-${{ env.ANYLINT_LATEST_VERSION }}-swift-sh-${{ env.SWIFT_SH_LATEST_VERSION }} - - name: Copy from cache + - name: Copy from Cache if: steps.anylint-cache.outputs.cache-hit run: | sudo cp -f anylint-cache/anylint /usr/local/bin/anylint @@ -59,7 +59,7 @@ jobs: swift build -c release sudo cp -f .build/release/swift-sh /usr/local/bin/swift-sh - - name: Copy to cache + - name: Copy to Cache if: steps.anylint-cache.outputs.cache-hit != 'true' run: | mkdir -p anylint-cache @@ -89,16 +89,62 @@ jobs: steps: - uses: actions/checkout@v2 + - name: Export latest tool versions + run: | + latest_version() { + curl --silent "https://api.github.com/repos/$1/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' + } + echo "::set-env name=ANYLINT_LATEST_VERSION::$( latest_version Flinesoft/AnyLint )" + echo "::set-env name=SWIFT_SH_LATEST_VERSION::$( latest_version mxcl/swift-sh )" + + - name: AnyLint Cache + uses: actions/cache@v1 + id: anylint-cache + with: + path: anylint-cache + key: ${{ runner.os }}-v1-anylint-${{ env.ANYLINT_LATEST_VERSION }}-swift-sh-${{ env.SWIFT_SH_LATEST_VERSION }} + + - name: Copy from Cache + if: steps.anylint-cache.outputs.cache-hit + run: | + sudo cp -f anylint-cache/anylint /usr/local/bin/anylint + sudo cp -f anylint-cache/swift-sh /usr/local/bin/swift-sh + + - name: Install AnyLint + if: steps.anylint-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/Flinesoft/AnyLint.git + cd AnyLint + swift build -c release + sudo cp -f .build/release/anylint /usr/local/bin/anylint + + - name: Install swift-sh + if: steps.anylint-cache.outputs.cache-hit != 'true' + run: | + git clone https://github.com/mxcl/swift-sh.git + cd swift-sh + swift build -c release + sudo cp -f .build/release/swift-sh /usr/local/bin/swift-sh + + - name: Copy to Cache + if: steps.anylint-cache.outputs.cache-hit != 'true' + run: | + mkdir -p anylint-cache + cp -f /usr/local/bin/anylint anylint-cache/anylint + cp -f /usr/local/bin/swift-sh anylint-cache/swift-sh + - name: Run tests run: swift test -v - test-macos: runs-on: macos-latest steps: - uses: actions/checkout@v2 + - name: Install Swift-SH + run: brew install swift-sh + - name: Run tests run: swift test -v --enable-code-coverage