aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: f0e7a81bc75c9b355b71e74ea0bb7b0088fe9e1c (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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
name: "Build"

concurrency:
  # for PR's cancel the running task, if another commit is pushed
  group: ${{ github.workflow }} ${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

on:
  # build on PR and push-to-main. This works for short-lived branches, and saves
  # CPU cycles on duplicated tests.
  # For long-lived branches that diverge, you'll want to run on all pushes, not
  # just on push-to-main.
  pull_request: {}
  push:
    branches:
      - master

jobs:
  test:
    strategy:
      fail-fast: false
      matrix:
        os: ['ubuntu-20.04', 'macos-13']
        luaVersion:
          - "5.1"
          - "5.2"
          - "5.3"
          - "5.4"
          - "luajit"
          - "luajit-openresty"
        include:
          - os: "macos-latest"
            luaVersion: "5.4"
          # On Windows builds:
          # 'hishamhm/gh-actions-lua' will build the PuC Rio Lua versions using
          # MSVC, and the LuaJIT version using MinGW/gcc. By running against
          # both below, we test both toolchains.
          - os: "windows-latest"
            toolchain: "msvc"
            luaVersion: "5.1"
          - os: "windows-latest"
            toolchain: "msvc"
            luaVersion: "5.2"
          - os: "windows-latest"
            toolchain: "msvc"
            luaVersion: "5.3"
          - os: "windows-latest"
            toolchain: "msvc"
            luaVersion: "5.4"
          - os: "windows-latest"
            toolchain: "mingw"  # unused, other than for display in the UI
            luaVersion: "luajit"

    runs-on: ${{ matrix.os }}

    steps:
      - name: Checkout
        uses: actions/checkout@master

      - name: Setup MSVC
        # the 'hishamhm/gh-actions-lua' step requires msvc to build PuC Rio Lua
        # versions on Windows (LuaJIT will be build using MinGW/gcc).
        if: ${{ matrix.toolchain == 'msvc' }}
        uses: ilammy/msvc-dev-cmd@v1

      # - name: install Dependencies analyzer
      #   # action step used for troubleshooting if Windows dll's build
      #   # incorrectly
      #   run: "
      #     $version = \"1.11.1\"\n
      #     echo \"Installing Dependencies version: $version\"\n
      #     $url = 'https://github.com/lucasg/Dependencies/releases/download/v'
      #         + $version + '/Dependencies_x64_Release.zip'\n
      #     $dest = Join-Path -Path $PWD -ChildPath \".dependencies\"\n

      #     # Download and extract Dependencies\n
      #     New-Item -ItemType Directory -Path \"$dest\"\n
      #     Invoke-WebRequest -Uri $url -OutFile \"$dest\\dependencies.zip\"\n
      #     Expand-Archive -Path \"$dest\\dependencies.zip\" -DestinationPath
      #         \"$dest\"\n
      #     Remove-Item -Path \"$dest\\dependencies.zip\"\n
      #     # dir \"$dest\"\n

      #     # Add Dependencies to PATH\n
      #     $env:PATH += \";$dest\"\n
      #     echo $env:PATH\n

      #     # Verify Dependencies Installation\n
      #     dir \"$dest\\*.exe\"\n
      #     dir \".\\.dependencies\Dependencies.exe\"\n
      #     .\\.dependencies\\Dependencies.exe -help\n

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

      - uses: hishamhm/gh-actions-luarocks@master
        with:
          luarocksVersion: "3.11.0"

      - name: install
        run: |
          luarocks make

      - name: test dependencies
        run: |
          luarocks install busted

      - name: test
        run: |
          busted --exclude-tags=manual --Xoutput "--color"

  freebsd:
    runs-on: ubuntu-latest
    name: Run tests on FreeBSD
    steps:
      - uses: actions/checkout@v4

      - name: Run tests inside FreeBSD VM
        uses: vmactions/freebsd-vm@v1
        with:
          usesh: true
          prepare: |
            pkg install -y lua54-luarocks
          run: |
            LUA_VERSION=5.4 luarocks54 make
            luarocks54 install busted
            busted --exclude-tags=manual --Xoutput "--color"

  openbsd:
    runs-on: ubuntu-latest
    name: Run tests on OpenBSD
    steps:
      - uses: actions/checkout@v4

      - name: Run tests inside OpenBSD VM
        uses: vmactions/openbsd-vm@v1
        with:
          usesh: true
          prepare: |
            pkg_add luarocks-lua54
          run: |
            LUA_VERSION=5.4 luarocks-5.4 make
            luarocks-5.4 install busted
            busted --exclude-tags=manual --Xoutput "--color"