diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..506f4a9 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,80 @@ +name: Test + +on: + push: + branches: + - master + pull_request: + branches: + - master + +env: + CGO_ENABLED: 1 + +jobs: + build: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + arch: + - i386 + - amd64 + go: + - '1.19' + - '1.20' + + steps: + - uses: actions/checkout@v3 + + - name: Setup Go + uses: actions/setup-go@v4.0.0 + with: + go-version: ${{ matrix.go }} + + - name: Install gcc + if: matrix.arch == 'amd64' + run: | + sudo apt update + sudo apt install gcc -y + + - name: Install gcc-multilib + if: matrix.arch == 'i386' + run: | + sudo dpkg --add-architecture i386 + sudo apt update + sudo apt install gcc-multilib -y + + # amd64 + - name: 'Build with ${{ matrix.go }} for amd64' + if: ${{ matrix.arch == 'amd64' }} + run: go build -race -v ./... + + - name: 'Test with ${{ matrix.go }} for amd64' + if: ${{ matrix.arch == 'amd64' }} + run: go test -race -v ./... + + - name: 'Bench with ${{ matrix.go }} for amd64' + if: ${{ matrix.arch == 'amd64' }} + run: go test -bench=. -benchmem -race -v ./... + + # 386 + - name: 'Build with ${{ matrix.go }} for i386' + if: ${{ matrix.arch == 'i386' }} + env: + CGOENABLED: true + GOARCH: 386 + CGO_LDFLAGS: -static + run: | + go test -c -v ./... + + - name: 'Test and Bench with ${{ matrix.go }} on i386' + if: ${{ matrix.arch == 'i386' }} + uses: vxcontrol/run-on-arch-action@0.9.0 + with: + arch: i386 + distro: bullseye + dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly + run: | + find /checkout -name '*.test' -type f -executable -print0 | \ + xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v' \ No newline at end of file diff --git a/go.mod b/go.mod index 5dc8a55..79ff397 100644 --- a/go.mod +++ b/go.mod @@ -2,4 +2,4 @@ module github.com/vxcontrol/luar go 1.13 -require github.com/vxcontrol/golua v1.2.1 +require github.com/vxcontrol/golua v1.3.0 diff --git a/go.sum b/go.sum index 1318171..2686a84 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ -github.com/vxcontrol/golua v1.2.1 h1:vCfL3Z2WTGkgwPPsg3/SAVycOeU9y7iZ3dKtkSLfpYs= -github.com/vxcontrol/golua v1.2.1/go.mod h1:26j63zy6Cb44iDabdQKZp5l6kR1PY+v26nO+T7tZFtE= -github.com/vxcontrol/rmx v1.0.0 h1:tUOStV2fXBm4xrtSjIye4bLHI0ud/IhkvMbaeMyp8ts= -github.com/vxcontrol/rmx v1.0.0/go.mod h1:1styoLiLxmoRJtwR6cjrcrt5LheQcFP+dXcSgr3W8ZQ= +github.com/vxcontrol/golua v1.3.0 h1:kjNNG+oL/bKSpDBMBQwzPgSDDrxoG9xVrNlVKxmWCoI= +github.com/vxcontrol/golua v1.3.0/go.mod h1:IsfilvnfNXs9C5maGYflqqUdX4igeeskG3lhYofqg3Q= +github.com/vxcontrol/rmx v1.1.0 h1:iKkzPj0pkqe/DBS2XkOZn+i8GxbtJiFKEPCqOr8/2wE= +github.com/vxcontrol/rmx v1.1.0/go.mod h1:1styoLiLxmoRJtwR6cjrcrt5LheQcFP+dXcSgr3W8ZQ=