From afa973c67b2258ccd662f7621f6e0c10b1fea28b Mon Sep 17 00:00:00 2001 From: Kunpei Sakai Date: Sun, 18 Apr 2021 02:03:20 +0900 Subject: [PATCH] switch ci from travis to actions --- .travis.sh => .actions.sh | 4 ++-- .github/workflows/test.yml | 38 ++++++++++++++++++++++++++++++++++++++ .travis.yml | 34 ---------------------------------- 3 files changed, 40 insertions(+), 36 deletions(-) rename .travis.sh => .actions.sh (78%) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.travis.sh b/.actions.sh similarity index 78% rename from .travis.sh rename to .actions.sh index 1f755e5b..6543c3aa 100755 --- a/.travis.sh +++ b/.actions.sh @@ -5,14 +5,14 @@ echo "Running sinatra tests..." bundle exec rake echo "Running sinatra-contrib tests..." -export BUILDIR=$TRAVIS_BUILD_DIR/sinatra-contrib +export BUILDIR=$GITHUB_WORKSPACE/sinatra-contrib export BUNDLE_GEMFILE=$BUILDIR/Gemfile cd $BUILDIR bundle install --jobs=3 --retry=3 bundle exec rake echo "Running rack-protection tests..." -export BUILDIR=$TRAVIS_BUILD_DIR/rack-protection +export BUILDIR=$GITHUB_WORKSPACE/rack-protection export BUNDLE_GEMFILE=$BUILDIR/Gemfile cd $BUILDIR bundle install --jobs=3 --retry=3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..727a2496 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,38 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Testing + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + name: Test with Ruby-${{ matrix.ruby }} + runs-on: ubuntu-latest + strategy: + matrix: + # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0' + # TODO: Add jruby if something like allow_failures will be implemented on Actions. + ruby: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', head] + env: + GITHUB_WORKSPACE: ${{ github.workspace }} + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - name: Install dependencies + run: sudo apt-get install -y pandoc nodejs pkg-config libxml2-dev libxslt-dev + - name: Run tests + run: ./.actions.sh + +# TODO(zzak, rkh): Add slack notification. diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9372d66d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,34 +0,0 @@ ---- -language: ruby - -dist: xenial - -before_install: - - gem install bundler - - export CXX="g++-4.8" - -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 - - pandoc -rvm: - - 2.3.8 - - 2.4.10 - - 2.5.8 - - 2.6.6 - - 2.7.1 - - 3.0.0 - - jruby-9.2.16.0 - -script: ./.travis.sh - -matrix: - allow_failures: - - rvm: jruby-9.2.16.0 - -notifications: - slack: - secure: 6E+GuZId5GcVLgiOKZnE9ZAnJTa+K2Fxqb0KfrECtskviylcPF1OmX36+y7xGUS0P0pGNyWQThe0zCBMpszno/KbvUdIs6jXbOImkFMuo65//4YcivK0rVaYh9uh2S1K3ycaDeUPDf0ulc/AwHnxWGR6yBD2N5idTwt1bsULdy0=