|
| 1 | +name: Annocheck |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + paths-ignore: |
| 6 | + - 'doc/**' |
| 7 | + - '**/man' |
| 8 | + - '**.md' |
| 9 | + - '**.rdoc' |
| 10 | + - '**/.document' |
| 11 | + pull_request: |
| 12 | + paths-ignore: |
| 13 | + - 'doc/**' |
| 14 | + - '**/man' |
| 15 | + - '**.rdoc' |
| 16 | + - '**/.document' |
| 17 | + merge_group: |
| 18 | + paths-ignore: |
| 19 | + - 'doc/**' |
| 20 | + - '**/man' |
| 21 | + - '**.rdoc' |
| 22 | + - '**/.document' |
| 23 | + |
| 24 | +concurrency: |
| 25 | + group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }} |
| 26 | + cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }} |
| 27 | + |
| 28 | +# GitHub actions does not support YAML anchors. This creative use of |
| 29 | +# environment variables (plus the "echo $GITHUB_ENV" hack) is to reroute that |
| 30 | +# restriction. |
| 31 | +env: |
| 32 | + default_cc: clang-15 |
| 33 | + append_cc: '' |
| 34 | + |
| 35 | + # -O1 is faster than -O3 in our tests... Majority of time are consumed trying |
| 36 | + # to optimize binaries. Also GitHub Actions run on relatively modern CPUs |
| 37 | + # compared to, say, GCC 4 or Clang 3. We don't specify `-march=native` |
| 38 | + # because compilers tend not understand what the CPU is. |
| 39 | + optflags: '-O1' |
| 40 | + |
| 41 | + # -g0 disables backtraces when SEGV. Do not set that. |
| 42 | + debugflags: '-ggdb3' |
| 43 | + |
| 44 | + default_configure: >- |
| 45 | + --enable-debug-env |
| 46 | + --disable-install-doc |
| 47 | + --with-ext=-test-/cxxanyargs,+ |
| 48 | + append_configure: >- |
| 49 | + --without-valgrind |
| 50 | + --without-jemalloc |
| 51 | + --without-gmp |
| 52 | +
|
| 53 | + CONFIGURE_TTY: never |
| 54 | + GITPULLOPTIONS: --no-tags origin ${{github.ref}} |
| 55 | + RUBY_DEBUG: ci rgengc |
| 56 | + RUBY_TESTOPTS: >- |
| 57 | + -q |
| 58 | + --color=always |
| 59 | + --tty=no |
| 60 | +
|
| 61 | +permissions: |
| 62 | + contents: read |
| 63 | + |
| 64 | +jobs: |
| 65 | + compile: |
| 66 | + strategy: |
| 67 | + fail-fast: false |
| 68 | + matrix: |
| 69 | + env: |
| 70 | + - {} |
| 71 | + entry: |
| 72 | + - name: 'gcc-11 annocheck' |
| 73 | + container: gcc-11 |
| 74 | + env: |
| 75 | + # Minimal flags to pass the check. |
| 76 | + default_cc: 'gcc-11 -fcf-protection -Wa,--generate-missing-build-notes=yes' |
| 77 | + optflags: '-O2' |
| 78 | + LDFLAGS: '-Wl,-z,now' |
| 79 | + # FIXME: Drop skipping options |
| 80 | + # https://bugs.ruby-lang.org/issues/18061 |
| 81 | + # https://sourceware.org/annobin/annobin.html/Test-pie.html |
| 82 | + TEST_ANNOCHECK_OPTS: "--skip-pie --skip-gaps" |
| 83 | + check: true |
| 84 | + |
| 85 | + name: ${{ matrix.entry.name }} |
| 86 | + runs-on: ubuntu-latest |
| 87 | + container: |
| 88 | + image: ghcr.io/ruby/ruby-ci-image:${{ matrix.entry.container || matrix.entry.env.default_cc || 'clang-15' }} |
| 89 | + options: --user root |
| 90 | + if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }} |
| 91 | + env: ${{ matrix.entry.env || matrix.env }} |
| 92 | + steps: |
| 93 | + - run: id |
| 94 | + working-directory: |
| 95 | + - run: mkdir build |
| 96 | + working-directory: |
| 97 | + - name: setenv |
| 98 | + run: | |
| 99 | + echo "GNUMAKEFLAGS=-sj$((1 + $(nproc --all)))" >> $GITHUB_ENV |
| 100 | + - uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 |
| 101 | + with: |
| 102 | + path: src |
| 103 | + - uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1 |
| 104 | + with: |
| 105 | + path: src/.downloaded-cache |
| 106 | + key: downloaded-cache |
| 107 | + - name: autogen |
| 108 | + run: | |
| 109 | + if [ ! -f ./autogen.sh ]; then |
| 110 | + ls -la |
| 111 | + fi |
| 112 | + ./autogen.sh |
| 113 | + working-directory: src |
| 114 | + - name: Run configure |
| 115 | + run: > |
| 116 | + ../src/configure -C ${default_configure} ${append_configure} |
| 117 | + --${{ |
| 118 | + matrix.entry.crosshost && 'host' || 'with-gcc' |
| 119 | + }}=${{ |
| 120 | + matrix.entry.crosshost || '"${default_cc}${append_cc:+ $append_cc}"' |
| 121 | + }} |
| 122 | + --${{ matrix.entry.shared || 'enable' }}-shared |
| 123 | + - run: make extract-extlibs |
| 124 | + - run: make incs |
| 125 | + - run: make showflags |
| 126 | + - run: make |
| 127 | + - run: make leaked-globals |
| 128 | + - run: make test |
| 129 | + - run: make install |
| 130 | + if: ${{ matrix.entry.check }} |
| 131 | + - run: make test-tool |
| 132 | + if: ${{ matrix.entry.check }} |
| 133 | + ### test-all doesn't work: https://github.com/ruby/ruby/actions/runs/4340112185/jobs/7578344307 |
| 134 | + # - run: make test-all TESTS='-- ruby -ext-' |
| 135 | + # if: ${{ matrix.entry.check }} |
| 136 | + ### test-spec doesn't work: https://github.com/ruby/ruby/actions/runs/4340193212/jobs/7578505652 |
| 137 | + # - run: make test-spec |
| 138 | + # env: |
| 139 | + # CHECK_LEAKS: true |
| 140 | + # if: ${{ matrix.entry.check }} |
| 141 | + - run: make test-annocheck |
| 142 | + if: ${{ matrix.entry.check && endsWith(matrix.entry.name, 'annocheck') }} |
| 143 | + |
| 144 | + - uses: ruby/action-slack@0bd85c72233cdbb6a0fe01d37aaeff1d21b5fce1 # v3.2.1 |
| 145 | + with: |
| 146 | + payload: | |
| 147 | + { |
| 148 | + "ci": "GitHub Actions", |
| 149 | + "env": "${{ github.workflow }} / ${{ matrix.entry.name }}", |
| 150 | + "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}", |
| 151 | + "commit": "${{ github.sha }}", |
| 152 | + "branch": "${{ github.ref_name }}" |
| 153 | + } |
| 154 | + env: |
| 155 | + SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot |
| 156 | + if: ${{ failure() && github.event_name == 'push' }} |
| 157 | + |
| 158 | +defaults: |
| 159 | + run: |
| 160 | + working-directory: build |
0 commit comments