Build #989
This file contains 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: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
config: | |
runs-on: self-hosted | |
outputs: | |
matrix-packer: ${{ steps.set-matrix.outputs.matrix-packer }} | |
matrix-windows: ${{ steps.set-matrix.outputs.matrix-windows }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Node 16.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: "16.x" | |
- name: Fetch master branch | |
run: | | |
git fetch origin master:master | |
git fetch origin "$GITHUB_REF" | |
if: "${{ success() && github.ref != 'refs/heads/master' }}" | |
- name: Install | |
run: npm ci | |
- name: Lint | |
run: npm run lint | |
- id: set-matrix | |
name: Identify diff | |
# Build diff on push (except master) | |
run: | | |
build_arg="" && [[ "$GITHUB_EVENT_NAME" =~ "push" && ! "$GITHUB_REF" =~ .*/master ]] && build_arg="--diff"; | |
node ./.github/render_matrix.js --github ${build_arg} | |
packer: | |
needs: config | |
runs-on: self-hosted | |
timeout-minutes: 120 | |
env: | |
SCOPE: '${{matrix.scope}}' | |
CONFIG: '${{matrix.config}}' | |
H1_TOKEN: '${{secrets.H1_TOKEN}}' | |
RBX_TOKEN: '${{secrets.RBX_TOKEN}}' | |
INFLUXDB_HOST: '${{secrets.INFLUXDB_HOST}}' | |
INFLUXDB_PASSWORD: '${{secrets.INFLUXDB_PASSWORD}}' | |
INFLUXDB_USER: '${{secrets.INFLUXDB_USER}}' | |
REDHAT_SECRET: '${{secrets.REDHAT_SECRET}}' | |
strategy: | |
fail-fast: false | |
max-parallel: 5 | |
matrix: ${{fromJson(needs.config.outputs.matrix-packer)}} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "apply workaround for IP conflict bug (TODO: fix me)" | |
run: sleep $(shuf -i 60-120 -n 1) | |
- name: Save private SSH key | |
run: | | |
echo "$PRIVATE_KEY" | openssl base64 -d > ./resources/secrets/id_rsa; | |
rm ./resources/ssh/id_rsa*; | |
cp ./resources/secrets/* ./resources/ssh/; | |
md5sum ./resources/ssh/* | |
env: | |
PRIVATE_KEY: "${{ secrets.PRIVATE_KEY }}" | |
- name: Build Docker image | |
run: docker build -t recommended-images:${{github.sha}} . | |
- name: Build Platform image | |
id: attempt | |
continue-on-error: true | |
timeout-minutes: 90 | |
run: | | |
publish_arg="" && [[ "${GITHUB_BRANCH##*/}" =~ "master" ]] && publish_arg="--publish" ; | |
docker run --rm -e CI -e H1_TOKEN -e RBX_TOKEN -e SCOPE -e INFLUXDB_HOST -e INFLUXDB_PASSWORD -e INFLUXDB_USER -e REDHAT_SECRET \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
recommended-images:${{github.sha}} \ | |
nodejs buildTestPublish.js --config "$CONFIG" --mode "packer" --cleanup ${publish_arg} | |
env: | |
GITHUB_BRANCH: ${{ github.ref }} | |
- name: Retry build Platform image | |
timeout-minutes: 90 | |
id: retry | |
run: | | |
publish_arg="" && [[ "${GITHUB_BRANCH##*/}" =~ "master" ]] && publish_arg="--publish" ; | |
docker run --rm -e CI -e H1_TOKEN -e RBX_TOKEN -e SCOPE -e INFLUXDB_HOST -e INFLUXDB_PASSWORD -e INFLUXDB_USER -e REDHAT_SECRET \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
recommended-images:${{github.sha}} \ | |
nodejs buildTestPublish.js --config "$CONFIG" --mode "packer" --cleanup ${publish_arg} | |
if: ${{ steps.attempt.outcome == 'failure' }} | |
env: | |
GITHUB_BRANCH: ${{ github.ref }} | |
- name: "Report successfully build (1st build) to InfluxDB" | |
run: ./.github/influx.sh | |
if: "${{ steps.attempt.outcome == 'success' }}" | |
env: | |
INFLUXDB_VALUE: "1" | |
INFLUXDB_ATTEMPT: "1" | |
- name: "Report successfully build (2nd build) to InfluxDB" | |
run: ./.github/influx.sh | |
if: "${{ steps.attempt.outcome == 'failure' && steps.retry.outcome == 'success' }}" | |
env: | |
INFLUXDB_VALUE: "1" | |
INFLUXDB_ATTEMPT: "2" | |
- name: "Report failure build to InfluxDB" | |
run: ./.github/influx.sh | |
if: "${{ failure() }}" | |
env: | |
INFLUXDB_VALUE: "0" | |
INFLUXDB_ATTEMPT: "2" | |
windows: | |
needs: config | |
timeout-minutes: 720 | |
runs-on: self-hosted | |
strategy: | |
fail-fast: false | |
max-parallel: 1 | |
matrix: ${{fromJson(needs.config.outputs.matrix-windows)}} | |
env: | |
SCOPE: '${{matrix.scope}}' | |
CONFIG: '${{matrix.config}}' | |
H1_TOKEN: '${{secrets.H1_TOKEN}}' | |
RBX_TOKEN: '${{secrets.RBX_TOKEN}}' | |
INFLUXDB_HOST: '${{secrets.INFLUXDB_HOST}}' | |
INFLUXDB_PASSWORD: '${{secrets.INFLUXDB_PASSWORD}}' | |
INFLUXDB_USER: '${{secrets.INFLUXDB_USER}}' | |
REDHAT_SECRET: '${{secrets.REDHAT_SECRET}}' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: "apply workaround for IP conflict bug (TODO: fix me)" | |
run: sleep $(shuf -i 60-120 -n 1) | |
- name: Save private SSH key | |
run: echo $PRIVATE_KEY > ./resources/secrets/id_rsa | |
env: | |
PRIVATE_KEY: "${{ secrets.PRIVATE_KEY }}" | |
- name: Build Docker image | |
run: docker build -f Dockerfile.windows -t recommended-images-windows:${{github.sha}} . | |
- name: Build Platform image | |
run: | | |
publish_arg="" && [[ "${GITHUB_BRANCH##*/}" =~ "master" ]] && publish_arg="--publish" ; | |
docker run --rm -e H1_TOKEN -e SCOPE \ | |
-v /var/run/docker.sock:/var/run/docker.sock \ | |
recommended-images-windows:${{github.sha}} \ | |
nodejs buildTestPublish.js --config "$CONFIG" --mode "windows" --cleanup ${publish_arg} | |
env: | |
GITHUB_BRANCH: ${{ github.ref }} |