ci: dynamic runs-on values for oss/ent (#17775)

so in enterprise we can use Vault for secrets,
without merge conflicts from oss->ent.

also:
* use hashicorp/setup-golang
* setup-js for self-hosted runners
  they don't come with yarn, nor chrome,
  and might not always match node version.
This commit is contained in:
Daniel Bennett 2023-07-06 12:41:17 -05:00 committed by GitHub
parent 3ca370dd03
commit 4c2cb7b701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 55 additions and 20 deletions

34
.github/actions/setup-js/action.yml vendored Normal file
View file

@ -0,0 +1,34 @@
name: setup-js
description: install node and yarn, and run yarn install
inputs:
node-version:
description: 'node version'
# https://github.com/ember-cli/ember-cli/blob/master/docs/node-support.md
# package.json has ember-cli at version ~3.28.5 currently
default: '16'
runs:
using: composite
steps:
- name: Install yarn
run: |-
# install yarn if not present
yarn --version && exit
# note: can't `npm install -g` on self-hosted runners
npm install yarn --no-package-lock --no-save
cd node_modules/.bin
./yarn --version
echo "$PWD" >> "$GITHUB_PATH"
working-directory: /tmp
shell: bash
# enforce node version (self-hosted default is not necessarily what we want)
# after yarn, so we can use yarn for cache.
- name: Setup node
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
with:
node-version: ${{ inputs.node-version }}
cache: yarn
cache-dependency-path: ui/yarn.lock
- name: Yarn install
run: yarn install --frozen-lockfile
working-directory: ui
shell: bash

View file

@ -31,11 +31,12 @@ jobs:
# Enabling this option increased the number of backport failures. # Enabling this option increased the number of backport failures.
BACKPORT_MERGE_COMMIT: false BACKPORT_MERGE_COMMIT: false
GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
handle-failure: handle-failure:
needs: needs:
- backport - backport
if: always() && needs.backport.result == 'failure' if: always() && needs.backport.result == 'failure'
runs-on: ubuntu-latest runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }}
steps: steps:
- name: Send slack notification on failure - name: Send slack notification on failure
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0 uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # v1.23.0

View file

@ -231,7 +231,7 @@ jobs:
build-darwin: build-darwin:
needs: [get-go-version, get-product-version] needs: [get-go-version, get-product-version]
runs-on: macos-latest runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "macos"]') || 'macos-latest' }}
strategy: strategy:
matrix: matrix:
goos: [darwin] goos: [darwin]

View file

@ -20,7 +20,7 @@ on:
jobs: jobs:
checks: checks:
runs-on: ubuntu-22.04 runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-22.04' }}
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

View file

@ -23,7 +23,7 @@ env:
jobs: jobs:
prepare-release: prepare-release:
runs-on: ubuntu-20.04 runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-20.04' }}
outputs: outputs:
build-ref: ${{ steps.commit-change-push.outputs.build-ref }} build-ref: ${{ steps.commit-change-push.outputs.build-ref }}
steps: steps:

View file

@ -45,9 +45,11 @@ env:
VAULT_VERSION: 1.12.2 VAULT_VERSION: 1.12.2
NOMAD_SLOW_TEST: 0 NOMAD_SLOW_TEST: 0
NOMAD_TEST_LOG_LEVEL: OFF NOMAD_TEST_LOG_LEVEL: OFF
jobs: jobs:
# this caches dependencies for subsequent jobs, including private deps in enterprise
mods: mods:
runs-on: ubuntu-22.04 runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-22.04' }}
timeout-minutes: 10 timeout-minutes: 10
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

View file

@ -36,11 +36,10 @@ on:
jobs: jobs:
test-e2e: test-e2e:
runs-on: ubuntu-latest runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }}
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Setup go - uses: hashicorp/setup-golang@v1
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
- run: make deps - run: make deps
- run: make integration-test - run: make integration-test
- run: make e2e-test - run: make e2e-test

View file

@ -46,8 +46,7 @@ jobs:
nonce: ${{ steps.nonce.outputs.nonce }} nonce: ${{ steps.nonce.outputs.nonce }}
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install - uses: ./.github/actions/setup-js
run: yarn install --frozen-lockfile
- name: lint:js - name: lint:js
run: yarn run lint:js run: yarn run lint:js
- name: lint:hbs - name: lint:hbs
@ -59,7 +58,7 @@ jobs:
tests: tests:
needs: needs:
- pre-test - pre-test
runs-on: ubuntu-latest runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }}
timeout-minutes: 30 timeout-minutes: 30
continue-on-error: true continue-on-error: true
defaults: defaults:
@ -71,26 +70,26 @@ jobs:
split: [4] split: [4]
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install - uses: ./.github/actions/setup-js
run: yarn install --frozen-lockfile - uses: browser-actions/setup-chrome@c485fa3bab6be59dce18dbc18ef6ab7cbc8ff5f1 # v1.2.0
- name: ember exam - name: ember exam
env: env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.pre-test.outputs.nonce }} PERCY_PARALLEL_NONCE: ${{ needs.pre-test.outputs.nonce }}
run: yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }} run: yarn exam:parallel --split=${{ matrix.split }} --partition=${{ matrix.partition }}
finalize: finalize:
runs-on: ubuntu-latest needs:
- pre-test
- tests
runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "linux"]') || 'ubuntu-latest' }}
timeout-minutes: 30 timeout-minutes: 30
defaults: defaults:
run: run:
working-directory: ui working-directory: ui
needs:
- pre-test
- tests
steps: steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: yarn install - uses: ./.github/actions/setup-js
run: yarn install --frozen-lockfile
- name: finalize - name: finalize
env: env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

View file

@ -43,7 +43,7 @@ env:
VAULT_VERSION: 1.4.1 VAULT_VERSION: 1.4.1
jobs: jobs:
test-windows: test-windows:
runs-on: "windows-2019-16core" runs-on: ${{ endsWith(github.repository, '-enterprise') && fromJSON('["self-hosted", "ondemand", "windows", "type=c5.2xlarge"]') || 'windows-2019-16core' }}
env: env:
GOTESTSUM_PATH: c:\tmp\test-reports GOTESTSUM_PATH: c:\tmp\test-reports
steps: steps: