Docker-based CI #588
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: Docker-based CI | |
on: | |
push: | |
branches: | |
- master # forall push/merge in master | |
- v1 # forall push/merge in v1 | |
pull_request: | |
branches: | |
- "**" # forall submitted Pull Requests | |
schedule: | |
# test master every day at 16:00 UTC | |
# cf. https://crontab.guru/ | |
- cron: '0 16 * * *' | |
jobs: | |
# ###################################################################### | |
# This job illustrates the fact that docker-coq-action is "coq-agnostic" | |
# and can be used with any Docker image. | |
# | |
# The two fields that are required to address this use case are: | |
# https://github.com/coq-community/docker-coq-action#custom_image | |
# https://github.com/coq-community/docker-coq-action#custom_script | |
# ###################################################################### | |
python-demo: | |
name: custom_image / python:3 | |
runs-on: ubuntu-latest | |
steps: | |
################################################################ | |
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block | |
# # if you copy this demo workflow elsewhere! | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'erikmd/poc-github-ci' | |
ref: 'master' | |
- uses: actions/checkout@v4 | |
with: | |
path: 'docker-coq-action' | |
- uses: './docker-coq-action' | |
# End GHA_TEST_ENV | |
################## | |
# - uses: actions/checkout@v4 | |
# - uses: coq-community/docker-coq-action@v1 | |
with: | |
custom_image: 'python:3' | |
custom_script: | | |
python --version | |
startGroup "Install dependencies" | |
pip install --no-cache-dir --upgrade pip | |
pip install --no-cache-dir -r requirements.txt | |
endGroup | |
startGroup "Run tests" | |
pytest *.py | |
endGroup | |
# in case there is a permission mismatch issue at GHA cleanup time, | |
# see https://github.com/coq-community/docker-coq-action#permissions | |
# ###################################################################### | |
# This job illustrates how to run a docker command before the entrypoint | |
# ###################################################################### | |
entrypoint-demo: | |
name: entrypoint / custom_image / python:3 | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: docker.io | |
IMAGE_NAME: python | |
IMAGE_TAG: 3 | |
steps: | |
################################################################ | |
# Begin GHA_TEST_ENV # You should remove this GHA_TEST_ENV block | |
# # if you copy this demo workflow elsewhere! | |
- uses: actions/checkout@v4 | |
with: | |
path: 'docker-coq-action' | |
- uses: './docker-coq-action' | |
# End GHA_TEST_ENV | |
################## | |
# - uses: actions/checkout@v4 | |
# - uses: coq-community/docker-coq-action@v1 | |
with: | |
entrypoint: /bin/sh | |
# see also https://github.com/coq-community/docker-coq-action/issues/80#issuecomment-1321272915 | |
# args: -c "/bin/echo \"${{ secrets.GITHUB_TOKEN }}\" | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin && exec /app/entrypoint.sh \"$@\"" sh | |
args: -c "docker pull ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} && exec /app/entrypoint.sh \"$@\"" sh | |
custom_image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} | |
custom_script: | | |
python --version |