CI #286
Workflow file for this run
This file contains 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: CI | |
concurrency: | |
group: "${{github.workflow}}-${{github.ref}}" | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3 | |
push: | |
branches: | |
- master | |
tags: | |
- "*.*.*" | |
pull_request: | |
types: [opened, synchronize] | |
branches: | |
- "*" | |
jobs: | |
# These jobs use Buildx layer caching | |
docker_build: | |
name: build image | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- x86-mingw32 | |
- x64-mingw-ucrt | |
- x64-mingw32 | |
- x86-linux | |
- x86_64-linux | |
- x86_64-darwin | |
- arm64-darwin | |
- arm-linux | |
- aarch64-linux | |
- jruby | |
runs-on: ubuntu-latest | |
env: | |
PLATFORM: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache Docker layers | |
uses: actions/cache@v3 | |
with: | |
path: tmp/build-cache | |
key: ${{ runner.os }}-${{ matrix.platform }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.platform }}-buildx | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: "3.0" | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Build docker image | |
run: | | |
docker buildx create --driver docker-container --use | |
bundle exec rake build:${PLATFORM} RCD_DOCKER_BUILD="docker buildx build --cache-from=type=local,src=tmp/build-cache --cache-to=type=local,dest=tmp/build-cache-new --load" | |
docker images | |
- name: Move build cache and remove outdated layers | |
run: | | |
rm -rf tmp/build-cache | |
mv tmp/build-cache-new tmp/build-cache | |
- name: Basic tests on the generated image | |
env: | |
TEST_PLATFORM: ${{ matrix.platform }} | |
run: | | |
bundle exec rake test | |
- name: Build rcd_test.gem | |
run: | | |
cd test/rcd_test/ | |
bundle install | |
bundle exec rake clean clobber | |
bundle exec rake gem:${PLATFORM} | |
- name: Upload binary gem | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gem-${{ matrix.platform }} | |
path: test/rcd_test/pkg/*-*-*.gem | |
- if: matrix.platform == 'jruby' | |
name: Upload source gem | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gem-ruby | |
path: test/rcd_test/pkg/*-?.?.?.gem | |
- if: contains(matrix.platform, 'x64-mingw') | |
name: Build static rcd_test.gem for windows | |
env: | |
RCD_TEST_CONFIG: "--link-static" | |
run: | | |
gem build rake-compiler-dock.gemspec | |
gem install -l rake-compiler-dock-*.gem | |
cd test/rcd_test/ | |
bundle install | |
bundle exec rake clean clobber | |
bundle exec rake gem:${PLATFORM} | |
- if: contains(matrix.platform, 'x64-mingw') | |
name: Upload static rcd_test.gem | |
uses: actions/upload-artifact@v3 | |
with: | |
name: gem-${{ matrix.platform }}-static | |
path: test/rcd_test/pkg/*-*-*.gem | |
job_test_source: | |
name: source gem | |
needs: docker_build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu | |
ruby: | |
- "3.2" | |
- "3.1" | |
- "3.0" | |
- "2.7" | |
- "2.6" | |
- "2.5" | |
- "2.4" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- name: Download gem-ruby | |
uses: actions/download-artifact@v3 | |
with: | |
name: gem-ruby | |
- name: Install gem-ruby | |
run: gem install --local *.gem --verbose | |
- name: Run tests | |
run: | | |
cd test/rcd_test/ | |
bundle install | |
ruby -rrcd_test -S rake test | |
job_test_native: | |
name: native | |
needs: docker_build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows | |
- macos | |
- ubuntu | |
ruby: | |
- "3.2" | |
- "3.1" | |
- "3.0" | |
- "2.7" | |
- "2.6" | |
- "2.5" | |
- "2.4" | |
include: | |
- os: windows | |
platform: x64-mingw32 | |
- os: macos | |
platform: x86_64-darwin | |
- os: ubuntu | |
platform: x86_64-linux | |
- os: ubuntu | |
ruby: jruby-head | |
platform: jruby | |
- os: windows | |
ruby: "3.1" | |
platform: x64-mingw-ucrt | |
- os: windows | |
ruby: "3.2" | |
platform: x64-mingw-ucrt | |
exclude: | |
- os: windows | |
ruby: "3.1" | |
- os: windows | |
ruby: "3.2" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- run: ruby --version | |
- name: Download gem-${{matrix.platform}} | |
uses: actions/download-artifact@v3 | |
with: | |
name: gem-${{ matrix.platform }} | |
- name: Install gem-${{matrix.platform}} | |
run: gem install --local *.gem --verbose | |
- name: Run tests | |
run: | | |
cd test/rcd_test/ | |
bundle install | |
ruby -rrcd_test -S rake test | |
job_test_native_static: | |
name: native static | |
needs: docker_build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- windows | |
ruby: | |
- "3.2" | |
- "3.1" | |
- "3.0" | |
- "2.7" | |
- "2.6" | |
- "2.5" | |
- "2.4" | |
include: | |
- os: windows | |
platform: x64-mingw32 | |
- os: windows | |
ruby: "3.1" | |
platform: x64-mingw-ucrt | |
- os: windows | |
ruby: "3.2" | |
platform: x64-mingw-ucrt | |
exclude: | |
- os: windows | |
ruby: "3.1" | |
- os: windows | |
ruby: "3.2" | |
runs-on: ${{ matrix.os }}-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ matrix.ruby }} | |
- run: ruby --version | |
- name: Download gem-${{matrix.platform}}-static | |
uses: actions/download-artifact@v3 | |
with: | |
name: gem-${{ matrix.platform }}-static | |
- name: Install gem-${{matrix.platform}}-static | |
run: gem install --local *.gem --verbose | |
- name: Run tests | |
run: | | |
cd test/rcd_test/ | |
bundle install | |
ruby -rrcd_test -S rake test | |
job_test_multiarch: | |
name: multiarch (${{matrix.platform}} on ${{matrix.from_image}}) | |
needs: docker_build | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- from_image: amd64/centos | |
platform: x86_64-linux | |
dockerfile: centos | |
- from_image: navikey/raspbian-bullseye | |
platform: arm-linux | |
dockerfile: debian | |
- from_image: arm64v8/ubuntu | |
platform: aarch64-linux | |
dockerfile: debian | |
- from_image: i386/alpine | |
platform: x86-linux | |
dockerfile: alpine | |
- from_image: arm32v6/alpine | |
platform: arm-linux | |
dockerfile: alpine | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Download gem-${{matrix.platform}} | |
uses: actions/download-artifact@v3 | |
with: | |
name: gem-${{ matrix.platform }} | |
- name: Build image and Run tests | |
run: | | |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | |
docker build --rm --build-arg from_image=${{matrix.from_image}} -t ruby-test -f test/env/Dockerfile.${{matrix.dockerfile}} . | |
docker run --rm -t --network=host -v `pwd`:/build ruby-test |