Skip to content

Commit c981b3b

Browse files
authored
Merge pull request #1186 from consideRatio/pr/ci-refresh
ci: general refresh of github workflows, update gha versions and let dependabot do it, etc.
2 parents b3de499 + 11f2d2d commit c981b3b

File tree

7 files changed

+202
-99
lines changed

7 files changed

+202
-99
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# dependabot.yml reference: https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2+
#
3+
# Notes:
4+
# - Status and logs from dependabot are provided at
5+
# https://github.com/jupyterhub/repo2docker/network/updates.
6+
# - YAML anchors are not supported here or in GitHub Workflows.
7+
#
8+
version: 2
9+
updates:
10+
# Maintain dependencies in our GitHub Workflows
11+
- package-ecosystem: github-actions
12+
directory: "/" # This should be / rather than .github/workflows
13+
schedule:
14+
interval: weekly
15+
time: "05:00"
16+
timezone: "Etc/UTC"

.github/workflows/docker.yml

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
#
14
name: Docker build
25

36
on:
4-
- push
5-
- pull_request
7+
pull_request:
8+
paths-ignore:
9+
- "docs/**"
10+
- "**.md"
11+
- "**.rst"
12+
- ".github/workflows/*"
13+
- "!.github/workflows/docker.yml"
14+
push:
15+
paths-ignore:
16+
- "docs/**"
17+
- "**.md"
18+
- "**.rst"
19+
- ".github/workflows/*"
20+
- "!.github/workflows/docker.yml"
21+
branches-ignore:
22+
- "dependabot/**"
23+
- "pre-commit-ci-update-config"
24+
tags:
25+
- "**"
26+
workflow_dispatch:
627

728
jobs:
829
docker:
9-
runs-on: ubuntu-20.04
30+
runs-on: ubuntu-22.04
1031
steps:
1132
- name: Checkout code
12-
uses: actions/checkout@v2
33+
uses: actions/checkout@v3
1334
with:
1435
fetch-depth: 0
1536

1637
# https://github.com/docker/build-push-action
1738
- name: Build Docker image
18-
uses: docker/build-push-action@v2
39+
uses: docker/build-push-action@v3
1940
with:
2041
context: .
2142
tags: jupyter/repo2docker:pr

.github/workflows/release.yml

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,58 @@
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
3+
#
14
name: Publish
25

36
on:
4-
push:
57
pull_request:
8+
paths-ignore:
9+
- "docs/**"
10+
- "**.md"
11+
- "**.rst"
12+
- ".github/workflows/*"
13+
- "!.github/workflows/release.yml"
14+
push:
15+
paths-ignore:
16+
- "docs/**"
17+
- "**.md"
18+
- "**.rst"
19+
- ".github/workflows/*"
20+
- "!.github/workflows/release.yml"
21+
branches-ignore:
22+
- "dependabot/**"
23+
- "pre-commit-ci-update-config"
24+
tags:
25+
- "**"
26+
workflow_dispatch:
627

728
jobs:
829
build-n-publish:
9-
runs-on: ubuntu-20.04
30+
runs-on: ubuntu-22.04
1031
steps:
11-
- uses: actions/checkout@v2
12-
13-
- name: "Setup Python 3.8"
14-
uses: actions/setup-python@v2
32+
- uses: actions/checkout@v3
33+
- uses: actions/setup-python@v4
1534
with:
16-
python-version: "3.8"
35+
python-version: "3.9"
1736

18-
- name: "Install dependencies"
37+
- name: Install dependencies
1938
run: |
20-
pip install --upgrade setuptools pip
21-
pip install --upgrade -r dev-requirements.txt
39+
pip install -r dev-requirements.txt
2240
pip freeze
2341
24-
- name: "Build distribution archives"
42+
- name: Build distribution archives
2543
run: |
2644
python setup.py sdist bdist_wheel
2745
2846
# This step is only run when a new tag is pushed
2947
# all previous steps always run in order to exercise them
3048
- name: Publish distribution to PyPI
3149
if: startsWith(github.ref, 'refs/tags')
32-
uses: pypa/gh-action-pypi-publish@master
50+
uses: pypa/gh-action-pypi-publish@v1.5.1
3351
with:
3452
password: ${{ secrets.PYPI_PASSWORD }}
3553

3654
publish-docker:
37-
runs-on: ubuntu-20.04
55+
runs-on: ubuntu-22.04
3856
env:
3957
DEFAULT_REGISTRY: quay.io
4058
IMAGE_NAME: jupyterhub/repo2docker
@@ -58,19 +76,18 @@ jobs:
5876
echo "Publishing to $REGISTRY"
5977
6078
# versioneer requires the full git history for non-tags
61-
- uses: actions/checkout@v2
79+
- uses: actions/checkout@v3
6280
with:
6381
fetch-depth: 0
6482

6583
# Setup docker to build for multiple platforms, see:
6684
# https://github.com/docker/build-push-action/tree/v2.4.0#usage
6785
# https://github.com/docker/build-push-action/blob/v2.4.0/docs/advanced/multi-platform.md
68-
6986
- name: Set up QEMU (for docker buildx)
70-
uses: docker/setup-qemu-action@25f0500ff22e406f7191a2a8ba8cda16901ca018
87+
uses: docker/setup-qemu-action@v2
7188

7289
- name: Set up Docker Buildx (for multi-arch builds)
73-
uses: docker/setup-buildx-action@2a4b53665e15ce7d7049afb11ff1f70ff1610609
90+
uses: docker/setup-buildx-action@v2
7491
with:
7592
# Allows pushing to registry on localhost:5000
7693
driver-opts: network=host
@@ -97,7 +114,7 @@ jobs:
97114
echo "TAGS=$TAGS" >> $GITHUB_ENV
98115
99116
- name: Build and push repo2docker
100-
uses: docker/build-push-action@e1b7f96249f2e4c8e4ac1519b9608c0d48944a1f
117+
uses: docker/build-push-action@v3
101118
with:
102119
context: .
103120
platforms: linux/amd64

.github/workflows/test.yml

Lines changed: 75 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,35 @@
1-
# Useful GitHub Actions docs:
1+
# This is a GitHub workflow defining a set of jobs with a set of steps.
2+
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
23
#
3-
# - https://help.github.com/en/actions
4-
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
5-
# - https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow
6-
# - https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions
7-
8-
name: Continuous Integration
4+
name: Test
95

106
on:
11-
push:
127
pull_request:
8+
paths-ignore:
9+
- "docs/**"
10+
- "**.md"
11+
- "**.rst"
12+
- ".github/workflows/*"
13+
- "!.github/workflows/test.yml"
14+
push:
15+
paths-ignore:
16+
- "docs/**"
17+
- "**.md"
18+
- "**.rst"
19+
- ".github/workflows/*"
20+
- "!.github/workflows/test.yml"
21+
branches-ignore:
22+
- "dependabot/**"
23+
- "pre-commit-ci-update-config"
24+
tags:
25+
- "**"
1326
schedule:
14-
# Weekly test so we know if tests break for external reasons
15-
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
27+
# Run weekly test so we know if tests break for external reasons
28+
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#scheduled-events
29+
#
30+
# At 10:36 on Sunday (https://crontab.guru)
1631
- cron: '36 10 * * 0'
32+
workflow_dispatch:
1733

1834
# Global environment variables
1935
env:
@@ -23,51 +39,45 @@ env:
2339
GIT_AUTHOR_NAME: CI User
2440

2541
jobs:
26-
# Job to run linter / autoformat
27-
lint:
28-
runs-on: ubuntu-20.04
29-
steps:
30-
# Action Repo: https://github.com/actions/checkout
31-
- name: "Checkout repo"
32-
uses: actions/checkout@v2
33-
with:
34-
fetch-depth: 0
42+
pre-commit:
43+
runs-on: ubuntu-22.04
3544

36-
# Action Repo: https://github.com/actions/setup-python
37-
- name: "Setup Python"
38-
uses: actions/setup-python@v2
45+
strategy:
46+
fail-fast: false
47+
matrix:
48+
python_version: ["3.9"]
49+
50+
steps:
51+
- uses: actions/checkout@v3
52+
- uses: actions/setup-python@v4
3953
with:
40-
python-version: "3.8"
54+
python-version: "${{ matrix.python_version }}"
4155

42-
# Action Repo: https://github.com/actions/cache
43-
- name: "Cache pip dependencies"
44-
uses: actions/cache@v2
56+
# There will almost never be a cache hit on the cache key when this job is
57+
# run, as it is the first of all jobs in this workflow. The subsequent
58+
# jobs in this workflow can rely on this cache though.
59+
- name: Save pip's install cache on job completion
60+
uses: actions/cache@v3
4561
with:
4662
path: ~/.cache/pip
47-
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
48-
restore-keys: |
49-
${{ runner.os }}-pip-
63+
key: "${{ github.run_id }}-${{ matrix.python_version }}"
5064

51-
- name: "Install dependencies"
65+
- name: Install dependencies
5266
run: |
53-
pip install --upgrade setuptools pip
54-
pip install --upgrade -r dev-requirements.txt
67+
pip install -r dev-requirements.txt
5568
pip freeze
5669
57-
- name: "Run linter"
58-
run: |
59-
pre-commit run --all-files
70+
- run: pre-commit run --all-files
6071

6172
test:
62-
# Previous job must have successfully completed for this job to execute
63-
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idneeds
64-
needs: lint
65-
runs-on: ubuntu-20.04
66-
# - https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstrategy
73+
needs: pre-commit
74+
runs-on: ubuntu-${{ matrix.ubuntu_version }}
75+
6776
strategy:
68-
fail-fast: false # Do not cancel all jobs if one fails
77+
fail-fast: false
6978
matrix:
70-
python_version: ["3.8"]
79+
ubuntu_version: ["22.04"]
80+
python_version: ["3.9"]
7181
repo_type:
7282
- base
7383
- conda
@@ -80,44 +90,44 @@ jobs:
8090
- unit
8191
- venv
8292
include:
83-
- python_version: "3.6"
93+
# The actions/setup-python action with Python version 3.6 isn't
94+
# possible to use with the ubuntu-22.04 runner, so we use ubuntu-20.04
95+
# for this test where Python 3.6 remain available.
96+
- ubuntu_version: "20.04"
97+
python_version: "3.6"
8498
repo_type: venv
8599

86100
steps:
87-
- name: "Checkout repo"
88-
uses: actions/checkout@v2
89-
90-
- name: "Setup Python"
91-
uses: actions/setup-python@v2
101+
- uses: actions/checkout@v3
102+
- uses: actions/setup-python@v4
92103
with:
93-
python-version: ${{ matrix.python_version }}
104+
python-version: "${{ matrix.python_version }}"
94105

95-
# Action Repo: https://github.com/actions/cache
96-
- name: "Cache pip dependencies"
97-
uses: actions/cache@v2
106+
- name: Restore pip's install cache from previous job
107+
uses: actions/cache@v3
98108
with:
99109
path: ~/.cache/pip
100-
key: ${{ runner.os }}-pip-${{ hashFiles('dev-requirements.txt') }}
101-
restore-keys: |
102-
${{ runner.os }}-pip-
110+
key: "${{ github.run_id }}-${{ matrix.python_version }}"
111+
112+
- name: Install dependencies
113+
run: |
114+
pip install -r dev-requirements.txt
115+
pip freeze
103116
104-
- name: "Install"
117+
- name: Install repo2docker
105118
run: |
106-
pip install --upgrade setuptools pip wheel
107-
pip install --upgrade -r dev-requirements.txt
108119
python setup.py bdist_wheel
109120
pip install dist/*.whl
121+
110122
# add for mercurial tests
111123
pip install mercurial hg-evolve
124+
112125
pip freeze
113126
114-
- name: "Run tests"
127+
- name: Run pytest
115128
run: |
116-
cd tests
117-
pytest --durations 10 --cov repo2docker -v ${{ matrix.repo_type }}
129+
pytest --verbose --color=yes --durations=10 --cov=repo2docker tests/${{ matrix.repo_type }}
118130
119-
- name: "Upload code coverage stats"
131+
- name: Submit codecov report
120132
run: |
121-
pip install codecov
122-
pushd tests && codecov && cat
123-
cat /home/runner/work/repo2docker/repo2docker/tests/coverage.xml
133+
codecov

0 commit comments

Comments
 (0)