|
85 | 85 | runs-on: ubuntu-latest |
86 | 86 | arch: x64 |
87 | 87 | hadron-platform: linux |
88 | | - test-command-prefix: sudo --user compass |
| 88 | + pre-checkout-command: | |
| 89 | + # Install dependencies |
| 90 | + dnf install -y sudo gcc gcc-c++ make git nss dbus xorg-x11-server-Xvfb |
| 91 | + # Add a non-admin sudoer user and switch to it |
| 92 | + adduser compass |
| 93 | + echo "compass ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
| 94 | + # Use a shell which switch to the non-root compass user first |
| 95 | + shell: bash --command "su --login compass" --errexit {0} |
89 | 96 | container: |
90 | 97 | image: rockylinux:9 |
91 | 98 | volumes: |
@@ -133,24 +140,25 @@ jobs: |
133 | 140 |
|
134 | 141 | runs-on: ${{ matrix.runs-on }} |
135 | 142 | container: ${{ matrix.container }} |
| 143 | + defaults: |
| 144 | + run: |
| 145 | + shell: ${{ matrix.shell }} |
136 | 146 | env: |
137 | 147 | DEBUG: compass:smoketests:* |
138 | 148 | steps: |
| 149 | + - name: Run pre-checkout command |
| 150 | + if: matrix.pre-checkout-command |
| 151 | + run: ${{ matrix.pre-checkout-command }} |
| 152 | + # Use bash shell for pre-checkout command as it might setup a user which is needed for subsequent steps |
| 153 | + shell: bash |
| 154 | + |
139 | 155 | - name: Checkout |
140 | 156 | uses: actions/checkout@v2 |
141 | 157 | - name: Setup Node.js |
142 | 158 | uses: actions/setup-node@v4 |
143 | 159 | with: |
144 | 160 | node-version: 20 |
145 | 161 | cache: "npm" |
146 | | - - name: Configure Rocky linux |
147 | | - if: matrix.container.image == 'rockylinux:9' |
148 | | - run: | |
149 | | - # Install dependencies |
150 | | - dnf install -y sudo gcc gcc-c++ make git nss dbus xorg-x11-server-Xvfb |
151 | | - # Add a non-admin sudoer user |
152 | | - adduser compass |
153 | | - echo "compass ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers |
154 | 162 |
|
155 | 163 | - name: Cache downloads |
156 | 164 | uses: actions/cache@v4 |
@@ -195,4 +203,4 @@ jobs: |
195 | 203 | # Exposing token to prevent update server from being rate limited |
196 | 204 | GITHUB_TOKEN: ${{ github.token }} |
197 | 205 | working-directory: packages/compass-smoke-tests |
198 | | - run: ${{ matrix.test-command-prefix }} npm start -- --package ${{ matrix.package }} --tests ${{ matrix.test }} |
| 206 | + run: npm start -- --package ${{ matrix.package }} --tests ${{ matrix.test }} |
0 commit comments