summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: afbea098a6d74a9d430988e3a0c4ada7133bcc07 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: CI
on: [pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        ruby-version: [2.7.2, 2.6.6, 2.5.8, 2.4.10, 3.0.0, 'head']
    steps:
      - uses: actions/checkout@v1

      - name: Set up Ruby ${{ matrix.ruby-version }}
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: ${{ matrix.ruby-version }}
      - name: Set up Python ${{ matrix.python-version }}
        uses: actions/setup-python@v2
        with:
          python-version: 2.7

      - name: Cache bundler
        uses: actions/cache@v1
        id: bundler-cache
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v2-${{ hashFiles('**/Gemfile') }}-${{ hashFiles('**/net-ssh.gemspec') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v2-

      - name: Bundle install
        run: |
          gem install bundler
          bundle config set path 'vendor/bundle'
          bundle config set --local path 'vendor/bundle'
          bundle install --jobs 4 --retry 3 --path vendor/bundle
          BUNDLE_GEMFILE=./Gemfile.noed25519 bundle install --jobs 4 --retry 3 --path vendor/bundle
        env:
          BUNDLE_PATH: vendor/bundle
      
      - name: Ansible install
        run: |
          python -m pip install --upgrade pip
          pip install ansible urllib3 pyOpenSSL ndg-httpsclient pyasn1
          ansible-galaxy install rvm.ruby
          pwd
          uname -a
          export
          who am i
          ansible-playbook ./test/integration/playbook.yml -i "localhost," --become -c local -e 'no_rvm=true' -e 'myuser=runner' -e 'mygroup=runner' -e 'homedir=/home/runner'
      - name: Run Tests
        run: bundle exec rake test
        env:
          NET_SSH_RUN_INTEGRATION_TESTS: 1
      - name: Run Tests (without ed25519)
        run: bundle exec rake test
        env:
          BUNDLE_GEMFILE: ./Gemfile.noed25519
          NET_SSH_RUN_INTEGRATION_TESTS: 1
      - name: Run test helper test
        run: bundle exec rake test_test
      - name: Rubocop
        run: bundle exec rubocop