Add explicit buffer cleanup in specs #62
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |