-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (119 loc) · 3.87 KB
/
build.yml
File metadata and controls
134 lines (119 loc) · 3.87 KB
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
name: Build
on:
pull_request:
branches:
- "*"
push:
branches:
- main
jobs:
build:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ruby-${{ matrix.ruby }}
strategy:
matrix:
os: [ ubuntu-22.04, macos-15 ]
ruby: [ 2.7, 3.0, 3.1, 3.2, 3.3, 3.4, 4.0 ]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: default
bundler-cache: true
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.20.5'
- name: Build Linux
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
BUILD_DIR="tmp"
echo "Creating build directory..."
mkdir $BUILD_DIR
echo "Source directory contents:"
ls -la spec/support/libcobhandemo/
echo "Copying files..."
cp -R spec/support/libcobhandemo/* $BUILD_DIR
echo "Build directory contents after copy:"
ls -la $BUILD_DIR
cd tmp
echo "Current directory after cd:"
pwd
echo "Files in current directory:"
ls -la
GOOS=linux GOARCH=amd64 go build -buildmode=c-shared -ldflags='-s -w' -o libcobhandemo-x64.so libcobhandemo.go
- name: Build Darwin
if: matrix.os == 'macos-15'
shell: bash
run: |
BUILD_DIR="tmp"
echo "Creating build directory..."
mkdir $BUILD_DIR
echo "Source directory contents:"
ls -la spec/support/libcobhandemo/
echo "Copying files..."
cp -R spec/support/libcobhandemo/* $BUILD_DIR
echo "Build directory contents after copy:"
ls -la $BUILD_DIR
cd tmp
echo "Current directory after cd:"
pwd
echo "Files in current directory:"
ls -la
GOOS=darwin GOARCH=amd64 go build -buildmode=c-shared -ldflags='-s -w' -o libcobhandemo-x64.dylib libcobhandemo.go
- name: Run specs
run: |
COVERAGE=true bundle exec rspec spec
- name: Run rubocop
run: |
bundle exec rubocop
build_arm64:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} ruby-${{ matrix.ruby }} arm64
strategy:
matrix:
include:
- { os: ubuntu-22.04, ruby: 3.2 }
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Setup Go
uses: actions/setup-go@v2
with:
go-version: '1.20.5'
- name: Install OS dependencies
shell: bash
run: |
sudo apt-get update
sudo apt-get install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu -y
- name: Build Linux ARM64
shell: bash
run: |
BUILD_DIR="tmp"
echo "Creating build directory..."
mkdir $BUILD_DIR
echo "Source directory contents:"
ls -la spec/support/libcobhandemo/
echo "Copying files..."
cp -R spec/support/libcobhandemo/* $BUILD_DIR
echo "Build directory contents after copy:"
ls -la $BUILD_DIR
cd tmp
echo "Current directory after cd:"
pwd
echo "Files in current directory:"
ls -la
CGO_ENABLED=1 GOOS=linux GOARCH=arm64 CC=aarch64-linux-gnu-gcc go build -v -buildmode=c-shared -ldflags='-s -w' -o libcobhandemo-arm64.so libcobhandemo.go
- name: Run specs and rubocop checks
shell: bash
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker run --rm --volume "$(pwd):/cobhan" \
--platform linux/arm64/v8 \
--workdir /cobhan \
ruby:${{matrix.ruby}}-bullseye \
/bin/sh -c "bundle install; bundle exec rspec spec; bundle exec rubocop"