summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 53f0601364d6cee158d3137d092a366704fc1a52 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: CI
on:
  pull_request:
  push: { branches: master }
jobs:
  test:
    runs-on: ubuntu-18.04
    strategy:
      matrix:
        ruby-version: [2.6.6, 2.7.2, 3.0.1, 3.1.1]
    steps:
      - uses: actions/checkout@v3

      - 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: 3.8

      - name: Cache bundler
        uses: actions/cache@v1
        id: bundler-cache
        with:
          path: vendor/bundle
          key: ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-${{ hashFiles('**/Gemfile') }}-${{ hashFiles('**/net-ssh.gemspec') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.ruby-version }}-gem-v3-
      
      - name: Cache pip
        uses: actions/cache@v1
        id: pip-cache
        with:
          path: ~/.cache/pip
          key: ${{ runner.os }}-pip-v1
          restore-keys: |
            ${{ runner.os }}-pip-v1
      - 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: Add to etc/hosts
        run: |
          sudo echo "127.0.0.1  gateway.netssh" | sudo tee -a /etc/hosts
      - name: Check sshd_config
        run: sudo cat '/etc/ssh/sshd_config' || true
      - name: Check sshd_config2
        run: sudo cat /etc/ssh/sshd_config.d/*.conf || true
      - name: Check sshd pid
        run: sudo ps aux | grep sshd
      - 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: Check sshd_config
        run: sudo cat '/etc/ssh/sshd_config' || true
      - name: Check sshd pid
        run: sudo ps aux | grep sshd
      - name: Check sshd_config2
        run: sudo cat /etc/ssh/sshd_config.d/*.conf || true
      - name: Run Tests
        run: bundle exec rake test
        env:
          NET_SSH_RUN_INTEGRATION_TESTS: 1
          CI: 1
      - name: Run Tests (without ed25519)
        run: bundle exec rake test
        env:
          BUNDLE_GEMFILE: ./Gemfile.noed25519
          NET_SSH_RUN_INTEGRATION_TESTS: 1
          CI: 1
      - name: Run test helper test
        run: bundle exec rake test_test