aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/bit32-multi-arch-tests.yml
blob: aff29dbbb7bd1041a63d2a504f8f39142babf156 (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
name: bit32-multi-arch-tests
on:
  push:
    branches: ["master"]
  pull_request:
jobs:
  bit32-test:
    runs-on: ubuntu-latest
    name: bit32 tests on ${{ matrix.luaVersion }} ${{ matrix.arch }}
    strategy:
      fail-fast: false
      matrix:
        luaVersion: ["5.1.5", "5.4.1"]
        luaRocksVersion: ["3.3.1"]
        arch: ["armv7", "aarch64"]
    steps:
      - uses: actions/checkout@v2
      - uses: actions/cache@v2
        id: lua-cache
        with:
          path: .install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}
          key: lua-on-linux-${{ matrix.arch }}-${{ matrix.luaVersion }}
      - uses: uraimo/run-on-arch-action@v2
        with:
          arch: ${{ matrix.arch }}
          distro: ubuntu_rolling
          githubToken: ${{ github.token }}
          setup: |
            mkdir -p ".install/${{ matrix.arch }}"
          install: |
            apt-get update -q -y
            apt-get install -q -y curl unzip build-essential libreadline-dev libncurses-dev clang
            rm -rf /var/lib/apt/lists/*
          run: |
            v() {
              echo -n -e "\033[36m" >&2
              echo -n "# $*" >&2
              echo -e "\033[0m" >&2
              "$@"
            }
            export CC=clang
            if [ "${{ steps.lua-cache.outputs.cache-hit }}" != true ]; then
              (set -o pipefail; cd ".install/${{ matrix.arch }}" && v curl --fail --silent --location "http://www.lua.org/ftp/lua-${{ matrix.luaVersion }}.tar.gz" | tar xzpf -)
              (cd ".install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}" && v make linux)
            fi
            (cd ".install/${{ matrix.arch }}/lua-${{ matrix.luaVersion }}" && v make install)
            (set -o pipefail; cd .install && v curl --fail --silent --location "http://luarocks.org/releases/luarocks-${{ matrix.luaRocksVersion }}.tar.gz" | tar xzpf -)
            (cd ".install/luarocks-${{ matrix.luaRocksVersion }}" && v ./configure && v make bootstrap)
            eval "$(luarocks path)"
            v luarocks make rockspecs/bit32-scm-1.rockspec
            v lua tests/test-bit32.lua