diff --git a/.github/workflows/rake.yml b/.github/workflows/rake.yml new file mode 100644 index 0000000..bd5188f --- /dev/null +++ b/.github/workflows/rake.yml @@ -0,0 +1,49 @@ +name: rake + +on: + push: + branches: [ master, main ] + tags: [ v* ] + pull_request: + +permissions: + contents: write + +jobs: + rake-alpine: + name: Test on Ruby ${{ matrix.ruby.version }} ${{ matrix.os }}-${{ matrix.env.CC }} + runs-on: ubuntu-latest + env: ${{ matrix.env }} + container: + image: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: + - alpine:3.18 + - alpine:3.16 + env: + - CC: gcc + CXX: g++ + - CC: clang + CXX: clang++ + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Ruby + run: | + apk --no-cache --upgrade add build-base cmake git bash \ + autoconf make binutils-dev pkgconfig tar ruby-dev clang + + - name: Install Bundler + run: | + gem install bundler + bundle install + + - run: bundle exec rake + + rake: + needs: rake-alpine + uses: fontist/support/.github/workflows/rake.yml@main diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..c4c53ff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,21 @@ +name: release + +on: + workflow_dispatch: + inputs: + next_version: + description: | + Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc). + Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version + required: true + default: 'skip' + repository_dispatch: + types: [ do-release ] + +jobs: + release: + uses: fontist/support/.github/workflows/release.yml@main + with: + next_version: ${{ github.event.inputs.next_version }} + secrets: + rubygems-api-key: ${{ secrets.FONTIST_CI_RUBYGEMS_API_KEY }} diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml deleted file mode 100644 index bfeaae5..0000000 --- a/.github/workflows/test-and-release.yml +++ /dev/null @@ -1,73 +0,0 @@ -name: test-and-release - -on: - push: - branches: [ master ] -# tags: [ 'v*' ] - pull_request: - workflow_dispatch: - -concurrency: - group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}' - cancel-in-progress: true - -jobs: - test: - strategy: - fail-fast: false - matrix: - os: [ubuntu, macos, windows] - # It seems that Ruby 2.4 or this gem has a bug related to this gem. - ruby: ['2.5', '2.6', '2.7', '3.0', '3.1', '3.2', head] - runs-on: ${{ matrix.os }}-latest - continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} - steps: - - uses: actions/checkout@v3 - - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - run: gem update bundler - - run: bundle install - - run: bundle exec rake build_local - - run: bundle exec rake spec - - - test-container: - name: Ruby with ${{ matrix.env.CC }} compiler on ${{ matrix.os }} - container: - image: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ 'alpine:3.18', 'alpine:3.16' ] - env: - - {CC: gcc, CXX: g++} - - {CC: clang, CXX: clang++} - runs-on: ubuntu-latest - env: ${{ matrix.env }} - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Install Ruby - run: | - apk --no-cache --upgrade add build-base cmake git bash \ - autoconf make binutils-dev pkgconfig tar ruby-dev clang - - - run: gem install bundler - - run: bundle install - - run: bundle exec rake build_local - - run: bundle exec rake spec - - release: - name: Release gem - needs: [test, test-container] - runs-on: ubuntu-latest - if: contains(github.ref, 'refs/tags/v') - steps: - - uses: actions/checkout@v3 - - - uses: cadwallion/publish-rubygems-action@master - env: - RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}} diff --git a/Rakefile b/Rakefile index 39aa28b..165fbe7 100644 --- a/Rakefile +++ b/Rakefile @@ -77,3 +77,5 @@ task :copy_binary do FileUtils.cp(src, dest) if (File.exist?(src)) end end + +task default: %i[build_local spec] \ No newline at end of file