Skip to content

DEV: add gitpod actions #48108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Base Docker Image

# schedule the base docker build on any change of the environment file in the main branch, or
# at least once monthly, to catch ubuntu security updates
on:
push:
branches:
- main
paths:
- 'environment.yml'
schedule:
- cron: "0 0 1 * *" # monthly

jobs:
build:
name: Build base Docker image
runs-on: ubuntu-latest
environment: pandas-dev
if: "github.repository_owner == 'pandas-dev' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Lint Docker
uses: brpaz/hadolint-action@v2
with:
dockerfile: ./tools/gitpod/Dockerfile
- name: Get refs
shell: bash
run: |
export raw_branch=${GITHUB_REF#refs/heads/}
echo "::set-output name=branch::${raw_branch//\//-}"
echo "::set-output name=date::$(date +'%Y%m%d')"
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
id: getrefs
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: "."
file: "./tools/gitpod/Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
pandas/pandas-dev:${{ steps.getrefs.outputs.date }}-${{ steps.getrefs.outputs.branch}}-${{ steps.getrefs.outputs.sha8 }}, pandas/pandas-dev:latest
- name: Image digest
# Return details of the image build: sha and shell
run: echo ${{ steps.docker_build.outputs.digest }}
57 changes: 57 additions & 0 deletions .github/workflows/gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Build Gitpod Docker image

on:
push:
branches:
- main
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- main
- cron: "0 0 * * *" # nightly

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to nightly builds to reduce load on CI, but keep freshness reasonable.


jobs:
build:
name: Build Gitpod Docker image
runs-on: ubuntu-latest
environment: pandas-dev
if: "github.repository_owner == 'pandas-dev' && !contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.head_commit.message, '[skip github]')"
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Lint Docker
uses: brpaz/hadolint-action@v2
with:
dockerfile: ./tools/gitpod/gitpod.Dockerfile
- name: Get refs
shell: bash
run: |
export raw_branch=${GITHUB_REF#refs/heads/}
echo "::set-output name=branch::${raw_branch//\//-}"
echo "::set-output name=date::$(date +'%Y%m%d')"
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"
id: getrefs
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: ${{ runner.os }}-buildx-
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
id: docker_build
uses: docker/build-push-action@v3
with:
context: "."
file: "./tools/gitpod/gitpod.Dockerfile"
push: ${{ github.event_name != 'pull_request' }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: |
pandas/pandas-gitpod:${{ steps.getrefs.outputs.date }}-${{ steps.getrefs.outputs.branch}}-${{ steps.getrefs.outputs.sha8 }}, pandas/pandas-gitpod:latest
- name: Image digest
# Return details of the image build: sha and shell
run: echo ${{ steps.docker_build.outputs.digest }}