Skip to content

Commit

Permalink
update ci to use the diff filter
Browse files Browse the repository at this point in the history
  • Loading branch information
colearendt committed May 19, 2022
1 parent 828ec22 commit 3bd808b
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 20 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/build-content.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,32 @@ on:
- dev
pull_request:

name: build/push RStudio Content Images
name: build/push (content)
jobs:

matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- id: set-matrix
run: |
MATRIX=$(jq -Mcr < content/matrix.json)
echo "::set-output name=matrix::$MATRIX"
MATRIX_DIFF_FILTER=$(echo "$MATRIX" | ./get-diffs.py -i -t origin/main)
echo "Filtered Diff Matrix: $MATRIX_DIFF_FILTER"
echo "::set-output name=matrix::$MATRIX_DIFF_FILTER"
build:
runs-on: ubuntu-latest
needs: matrix
name: r${{ matrix.config.r }} py${{ matrix.config.py }} ${{ matrix.config.os }} ${{ github.ref }}
needs: matrix

strategy:
fail-fast: false
Expand All @@ -31,7 +39,15 @@ jobs:

steps:
- name: Check Out Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# setup python
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
cache: 'pip'
- run: pip install -r requirements.txt

- name: Set up Docker Buildx
id: buildx
Expand Down
44 changes: 34 additions & 10 deletions .github/workflows/build-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,54 @@ on:
branches:
- main
- dev
- dev-rspm
pull_request:

name: build/test/push (latest)
jobs:

matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- id: set-matrix
run: |
# filter the matrix configuration
MATRIX=$(jq -Mcr < matrix-latest.json)
echo "Raw Matrix: $MATRIX"
MATRIX_DIFF_FILTER=$(echo "$MATRIX" | ./get-diffs.py -i -t origin/main)
echo "Filtered Diff Matrix: $MATRIX_DIFF_FILTER"
echo "::set-output name=matrix::$MATRIX_DIFF_FILTER"
build:
runs-on: ubuntu-latest
name: build-${{ matrix.config.tag_prefix}}${{ matrix.config.product}}
needs: matrix

strategy:
fail-fast: false
matrix:
config:
- {product: 'rstudio-workbench', dir: 'workbench', os: 'bionic/amd64', prefix: RSW, version: 'latest'}
- {product: 'rstudio-connect', dir: 'connect', prefix: RSC, version: 'latest'}
- {product: 'rstudio-connect-content-init', dir: 'connect-content-init', prefix: RSC, version: 'latest'}
- {product: 'rstudio-package-manager', dir: 'package-manager', prefix: RSPM, version: 'latest'}
- {product: 'r-session-complete', tag_prefix: 'bionic-', dir: 'r-session-complete/bionic', os: 'bionic/amd64', prefix: RSW, version: 'latest'}
- {product: 'r-session-complete', tag_prefix: 'centos7-', dir: 'r-session-complete/centos7', os: 'centos7/x86_64', prefix: RSW, version: 'latest'}
- {product: 'rstudio-workbench-for-microsoft-azure-ml', dir: 'helper/workbench-for-microsoft-azure-ml', os: 'bionic/amd64', prefix: RSW, version: 'latest'}
config: ${{ fromJson(needs.matrix.outputs.matrix) }}

steps:
- name: Check Out Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# setup python
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
cache: 'pip'
- run: pip install -r requirements.txt

- name: Set up Docker Buildx
id: buildx
Expand Down Expand Up @@ -117,7 +141,7 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.BUILD_PAT }}

- name: Push image(s) to Docker Hub
- name: Push image(s)
if: ${{ github.ref == 'refs/heads/main' }}
run: |
docker push rstudio/${{ matrix.config.product }}:${{ matrix.config.tag_prefix }}${{ matrix.config.version }}
Expand Down
18 changes: 16 additions & 2 deletions .github/workflows/build-preview-webhook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- id: set-matrix
run: |
# filter the matrix configuration
Expand All @@ -43,7 +49,15 @@ jobs:

steps:
- name: Check Out Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# setup python
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
cache: 'pip'
- run: pip install -r requirements.txt

- name: Set up Docker Buildx
id: buildx
Expand Down
22 changes: 19 additions & 3 deletions .github/workflows/build-preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,13 @@ jobs:
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
- id: set-matrix
run: |
# filter the matrix configuration
Expand All @@ -28,7 +34,9 @@ jobs:
# NOTE: blank which input here means that every product is selected
MATRIX_FILTER=$(echo "$MATRIX" | jq -Mcr 'map(select((.product | startswith("${{ github.event.inputs.which }}"))or("all"=="${{ github.event.inputs.which }}")))')
echo "Filtered Matrix: $MATRIX_FILTER"
echo "::set-output name=matrix::$MATRIX_FILTER"
MATRIX_DIFF_FILTER=$(echo "$MATRIX_FILTER" | ./get-diffs.py -i -t origin/main)
echo "Filtered Diff Matrix: $MATRIX_DIFF_FILTER"
echo "::set-output name=matrix::$MATRIX_DIFF_FILTER"
build:
runs-on: ubuntu-latest
Expand All @@ -42,7 +50,15 @@ jobs:

steps:
- name: Check Out Repo
uses: actions/checkout@v2
uses: actions/checkout@v3

# setup python
- uses: actions/setup-python@v3
with:
python-version: '3.9'
architecture: 'x64'
cache: 'pip'
- run: pip install -r requirements.txt

- name: Set up Docker Buildx
id: buildx
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
requests

0 comments on commit 3bd808b

Please sign in to comment.