CI #100
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: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
schedule: | |
- cron: "0 1 * * 0" | |
jobs: | |
setup: | |
name: Setup | |
runs-on: ubuntu-latest | |
outputs: | |
owner: ${{ steps.setup_image.outputs.owner }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup image | |
id: setup_image | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ] | |
then | |
GH_BRANCH=$GITHUB_BASE_REF | |
else | |
GH_BRANCH=${GITHUB_REF##*/} | |
fi | |
echo "::set-output name=owner::ghcr.io/b-it-bots/docker" | |
# split jobs to avoid using large storage capacity (limited by gh) | |
build-gpu-notebook: | |
name: Build gpu-notebook image | |
needs: setup | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Install sphinx dependencies | |
run: | | |
sudo pip3 install --upgrade pip | |
- name: Build image | |
id: build_image | |
run: | | |
OWNER=${{ needs.setup.outputs.owner }} | |
bash build_and_publish.sh --registry ghcr.io --publish "" --image gpu-notebook | |
- name: Docker image list | |
run: docker images | |
build-domestic: | |
name: Build domestic image | |
needs: setup | |
runs-on: ubuntu-latest | |
if: github.event_name == 'pull_request' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Install sphinx dependencies | |
run: | | |
sudo pip3 install --upgrade pip | |
- name: Build image | |
id: build_image | |
run: | | |
OWNER=${{ needs.setup.outputs.owner }} | |
bash build_and_publish.sh --registry ghcr.io --publish "" --image domestic | |
- name: Docker image list | |
run: docker images | |
publish-gpu-notebook: | |
name: Build and publish gpu-notebook | |
needs: setup | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Build and deploy image | |
id: build_and_deploy_image | |
run: | | |
OWNER=${{ needs.setup.outputs.owner }} | |
bash build_and_publish.sh --registry ghcr.io --publish "all" --image gpu-notebook | |
- name: Docker image list | |
run: docker images | |
publish-domestic: | |
name: Build and publish domestic | |
needs: setup | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_TOKEN }} | |
- name: Build and deploy image | |
id: build_and_deploy_image | |
run: | | |
OWNER=${{ needs.setup.outputs.owner }} | |
bash build_and_publish.sh --registry ghcr.io --publish "all" --image domestic | |
- name: Docker image list | |
run: docker images |