2020-11-13 14:32:18 -05:00
|
|
|
name: Docker
|
|
|
|
|
2020-11-27 04:38:38 -05:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2024-02-28 10:15:28 -05:00
|
|
|
- "master"
|
2020-11-27 04:38:38 -05:00
|
|
|
pull_request:
|
2024-02-22 11:14:41 -05:00
|
|
|
branches:
|
2024-02-28 10:15:28 -05:00
|
|
|
- "master"
|
2020-11-13 14:32:18 -05:00
|
|
|
|
2024-01-31 02:03:25 -05:00
|
|
|
concurrency:
|
|
|
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
|
|
|
|
cancel-in-progress: true
|
|
|
|
|
2020-11-13 14:32:18 -05:00
|
|
|
jobs:
|
2024-02-27 11:39:11 -05:00
|
|
|
setup_matrix:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
matrix_config: ${{ steps.set_matrix.outputs.matrix_config }}
|
|
|
|
steps:
|
|
|
|
- id: set_matrix
|
|
|
|
run: |
|
|
|
|
MATRIX_CONFIG=$(if [ "${{ github.event_name }}" == "pull_request" ]; then echo '["ci"]'; else echo '["dev", "lean", "py310", "websocket", "dockerize"]'; fi)
|
|
|
|
echo "matrix_config=${MATRIX_CONFIG}" >> $GITHUB_OUTPUT
|
|
|
|
echo $GITHUB_OUTPUT
|
|
|
|
|
2023-04-14 11:23:00 -04:00
|
|
|
docker-build:
|
2021-02-06 19:25:46 -05:00
|
|
|
name: docker-build
|
2024-02-27 11:39:11 -05:00
|
|
|
needs: setup_matrix
|
2020-11-13 14:32:18 -05:00
|
|
|
runs-on: ubuntu-latest
|
2024-01-23 16:44:07 -05:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2024-02-27 11:39:11 -05:00
|
|
|
build_preset: ${{fromJson(needs.setup_matrix.outputs.matrix_config)}}
|
2024-01-23 16:44:07 -05:00
|
|
|
fail-fast: false
|
2020-11-13 14:32:18 -05:00
|
|
|
steps:
|
2021-01-24 02:10:16 -05:00
|
|
|
- name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )"
|
2024-01-23 16:44:07 -05:00
|
|
|
uses: actions/checkout@v4
|
2021-01-24 02:10:16 -05:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
2024-01-23 16:44:07 -05:00
|
|
|
|
2023-09-25 16:08:21 -04:00
|
|
|
- name: Set up QEMU
|
2024-01-23 16:44:07 -05:00
|
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
|
2023-09-25 16:08:21 -04:00
|
|
|
- name: Set up Docker Buildx
|
2024-01-23 16:44:07 -05:00
|
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
|
|
|
|
- name: Build Docker Image
|
|
|
|
shell: bash
|
2020-11-13 14:32:18 -05:00
|
|
|
env:
|
|
|
|
DOCKERHUB_USER: ${{ secrets.DOCKERHUB_USER }}
|
|
|
|
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
run: |
|
2024-01-31 02:03:25 -05:00
|
|
|
pip install click
|
2024-02-28 09:10:06 -05:00
|
|
|
if [ "${{ github.event_name }}" = "push" ]; then
|
|
|
|
./scripts/build_docker.py \
|
|
|
|
${{ matrix.build_preset }} \
|
|
|
|
${{ github.event_name }} \
|
|
|
|
--build_context_ref "$RELEASE" $FORCE_LATEST \
|
|
|
|
--platform "linux/arm64" \
|
|
|
|
--platform "linux/amd64"
|
|
|
|
elif [ "${{ github.event_name }}" = "pull_request" ]; then
|
|
|
|
./scripts/build_docker.py \
|
|
|
|
${{ matrix.build_preset }} \
|
|
|
|
${{ github.event_name }} \
|
|
|
|
--build_context_ref "$RELEASE" $FORCE_LATEST \
|
|
|
|
--platform "linux/amd64"
|
|
|
|
fi
|