aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/test.yml
blob: 88e3c946dc0bb9643610db13a8cba8e1aeafac5f (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
name: test

on:
  push:
    branches: master
  pull_request:
    branches: '*'
  workflow_dispatch:
    branches: '*'

jobs:
  ##############################################################################
  ShellLint:
    runs-on: "ubuntu-latest"

    steps:
    - uses: actions/checkout@master

    - name: Prep
      run: |
        sudo apt-get install -y shellcheck

    - name: Shellcheck
      run: |
        shellcheck ./configure

  ##############################################################################
  TestMatrix:
    strategy:
      matrix:
        lua-version: ["5.4"]
        os: ["ubuntu-latest", "macos-latest"]
    runs-on: ${{ matrix.os }}

    steps:
    - uses: actions/checkout@master

    - uses: leafo/gh-actions-lua@master
      with:
        luaVersion: ${{ matrix.lua-version }}

    - uses: leafo/gh-actions-luarocks@v4.0.0

    - name: 'Setup macOS deps'
      if: ${{ contains(matrix.os, 'macos') }}
      run: brew install openssl

    - name: Prep
      run: |
        luarocks install busted
        luarocks install cluacov
        luarocks install busted-htest

    - name: Compile
      run: |
        luarocks install tl --dev --branch next
        eval $(luarocks path)
        ./compile.sh

    - name: Unit Test
      run: |
        eval $(luarocks path)
        busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci"
        busted -o htest --exclude-tags=git,integration --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci,env=full"

    - name: Integration Test
      run: |
        eval $(luarocks path)
        busted -o htest --exclude-tags=ssh,gpg,git,unit,quick --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci"
        busted -o htest --exclude-tags=ssh,gpg,git,unit,quick --verbose -Xhelper "lua_dir=$(luarocks config variables.LUA_DIR),ci,env=full"

    - name: Coverage
      run: |
        eval $(luarocks path)
        luacov -c testrun/luacov.config
        curl -Os https://uploader.codecov.io/latest/$([ `uname -s` = "Linux" ] && echo "linux" || echo "macos")/codecov
        chmod +x codecov
        ( cd testrun/ && ../codecov )
        grep "Summary" -B1 -A1000 testrun/luacov.report.out

  ##############################################################################
  SmokeTest:
    runs-on: "ubuntu-latest"
    steps:
    - uses: actions/checkout@master

    - uses: leafo/gh-actions-lua@v8.0.0
      with:
        luaVersion: "5.4"

    - name: Smoke Test
      run: |
        ./configure
        ./makedist dev $(dirname $(dirname $(which lua)))
        ./smoke_test.sh luarocks-dev.tar.gz

  ##############################################################################
  BinaryBuild:
    runs-on: "ubuntu-latest"
    steps:
    - uses: actions/checkout@master

    - uses: leafo/gh-actions-lua@v8.0.0
      with:
        luaVersion: "5.4"

    - name: Binary Build Smoke Test
      run: |
        ./configure
        ./makedist dev $(dirname $(dirname $(which lua)))
        ./smoke_test.sh luarocks-dev.tar.gz binary