Show the built version #302
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: [push, pull_request] | |
| jobs: | |
| ruby-versions: | |
| if: ${{ startsWith(github.repository, 'ruby/') || github.event_name != 'schedule' }} | |
| uses: ruby/actions/.github/workflows/ruby_versions.yml@master | |
| with: | |
| engine: cruby-truffleruby | |
| min_version: 2.6 | |
| build: | |
| needs: ruby-versions | |
| name: build (${{ matrix.ruby }} / ${{ matrix.os }}) | |
| strategy: | |
| matrix: | |
| ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }} | |
| os: [ ubuntu-latest, macos-latest, windows-latest ] | |
| exclude: | |
| - { os: windows-latest, ruby: debug } | |
| - { os: windows-latest, ruby: truffleruby } | |
| - { os: windows-latest, ruby: truffleruby-head } | |
| include: | |
| - { os: windows-latest, ruby: mingw } | |
| - { os: windows-latest, ruby: mswin } | |
| runs-on: ${{ matrix.os || 'ubuntu-latest' }} | |
| steps: | |
| - name: git config | |
| run: | | |
| git config --global core.autocrlf false | |
| git config --global core.eol lf | |
| git config --global advice.detachedHead 0 | |
| - uses: actions/checkout@v4 | |
| - name: Set up Ruby ${{ matrix.ruby }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| rubygems: ${{ matrix.ruby < '2.7' && '3.4.22' || '' }} | |
| bundler-cache: true | |
| - id: platform | |
| run: | | |
| #!ruby | |
| lib = File.expand_path("lib/#{RUBY_VERSION}/#{Gem::Platform.local}") | |
| libs = [ENV["RUBYLIB"], lib].compact.join(File::PATH_SEPARATOR) | |
| File.write(ENV["GITHUB_ENV"], "RUBYLIB=#{libs}\n", mode: "a") | |
| shell: ruby {0} | |
| - name: Version | |
| run: | | |
| ruby -v -retc -e "puts Etc::VERSION if Etc.const_defined?('VERSION')" | |
| - name: Run test | |
| run: rake compile test | |
| - id: fetch | |
| run: | | |
| : Fetch deeper for changelogs | |
| set -x | |
| git fetch --force --no-tags origin 'refs/tags/v*:refs/tags/v*' | |
| tags=($(git tag --list --no-contains HEAD --sort -version:refname)) | |
| git fetch --shallow-exclude=${tags[0]} origin | |
| set +x | |
| shell: bash | |
| if: ${{ matrix.ruby == needs.ruby-versions.outputs.latest }} | |
| - name: Built Version | |
| run: | | |
| ruby -v -retc -e "puts Etc::VERSION if Etc.const_defined?('VERSION')" | |
| - id: build | |
| run: | | |
| rake build | |
| echo "pkg=${GITHUB_REPOSITORY#*/}-${RUNNING_OS%-*}" >> $GITHUB_OUTPUT | |
| env: | |
| RUNNING_OS: ${{matrix.os}} | |
| if: ${{ steps.fetch.outcome == 'success' }} | |
| shell: bash | |
| # Ubuntu 20.04 still has libyaml 0.2.2 | |
| - name: Upload package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| path: pkg/*.gem | |
| name: ${{steps.build.outputs.pkg}} | |
| if: steps.build.outputs.pkg |