Skip to content

Commit 14f8663

Browse files
committed
Update workflows for set-env fix, format
1 parent a48cf7d commit 14f8663

File tree

2 files changed

+126
-128
lines changed

2 files changed

+126
-128
lines changed

.github/workflows/publish-docs.yml

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -7,94 +7,93 @@ on:
77

88
jobs:
99
build:
10-
1110
runs-on: ubuntu-latest
1211
strategy:
1312
matrix:
14-
python-version: [ '3.x' ]
13+
python-version: ["3.x"]
1514
steps:
16-
- uses: actions/checkout@v1
17-
- name: Configure git
18-
run: |
19-
git config --global user.name 'travis-ci'
20-
git config --global user.email 'travis@nowhere.edu'
21-
- name: Set up Python ${{ matrix.python-version }}
22-
uses: actions/setup-python@v1
23-
with:
24-
python-version: ${{ matrix.python-version }}
15+
- uses: actions/checkout@v1
16+
- name: Configure git
17+
run: |
18+
git config --global user.name 'travis-ci'
19+
git config --global user.email 'travis@nowhere.edu'
20+
- name: Set up Python ${{ matrix.python-version }}
21+
uses: actions/setup-python@v1
22+
with:
23+
python-version: ${{ matrix.python-version }}
2524

26-
- name: Get full Python version
27-
id: full-python-version
28-
shell: bash
29-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
25+
- name: Get full Python version
26+
id: full-python-version
27+
shell: bash
28+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
3029

31-
- name: Install poetry
32-
run: |
33-
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
34-
python get-poetry.py -y --version 1.0.10
35-
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
36-
rm get-poetry.py
30+
- name: Install poetry
31+
run: |
32+
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
33+
python get-poetry.py -y --version 1.0.10
34+
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
35+
rm get-poetry.py
3736
38-
- name: Get poetry cache paths from config
39-
run: |
40-
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
41-
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
37+
- name: Get poetry cache paths from config
38+
run: |
39+
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
40+
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
4241
43-
- name: Configure poetry
44-
shell: bash
45-
run: poetry config virtualenvs.in-project true
42+
- name: Configure poetry
43+
shell: bash
44+
run: poetry config virtualenvs.in-project true
4645

47-
- name: Set up cache
48-
uses: actions/cache@v2
49-
id: cache
50-
with:
51-
path: |
52-
.venv
53-
{{ env.poetry_cache_dir }}
54-
{{ env.poetry_virtualenvs_path }}
55-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
46+
- name: Set up cache
47+
uses: actions/cache@v2
48+
id: cache
49+
with:
50+
path: |
51+
.venv
52+
{{ env.poetry_cache_dir }}
53+
{{ env.poetry_virtualenvs_path }}
54+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
5655

57-
- name: Ensure cache is healthy
58-
if: steps.cache.outputs.cache-hit == 'true'
59-
shell: bash
60-
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
56+
- name: Ensure cache is healthy
57+
if: steps.cache.outputs.cache-hit == 'true'
58+
shell: bash
59+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
6160

62-
- name: Upgrade pip
63-
shell: bash
64-
run: poetry run python -m pip install pip -U
61+
- name: Upgrade pip
62+
shell: bash
63+
run: poetry run python -m pip install pip -U
6564

66-
- name: Install dependencies [w/ docs]
67-
run: poetry install --extras "docs lint"
65+
- name: Install dependencies [w/ docs]
66+
run: poetry install --extras "docs lint"
6867

69-
- name: Build documentation
70-
run: |
71-
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
68+
- name: Build documentation
69+
run: |
70+
pushd docs; make SPHINXBUILD='poetry run sphinx-build' html; popd
7271
73-
- name: Push documentation to S3
74-
uses: jakejarvis/s3-sync-action@master
75-
with:
76-
args: --acl public-read --follow-symlinks --delete
77-
env:
78-
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
79-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
80-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
81-
AWS_REGION: 'us-west-1' # optional: defaults to us-east-1
82-
SOURCE_DIR: 'docs/_build/html' # optional: defaults to entire repository
72+
- name: Push documentation to S3
73+
uses: jakejarvis/s3-sync-action@master
74+
with:
75+
args: --acl public-read --follow-symlinks --delete
76+
env:
77+
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
78+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
79+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
80+
AWS_REGION: "us-west-1" # optional: defaults to us-east-1
81+
SOURCE_DIR: "docs/_build/html" # optional: defaults to entire repository
8382

84-
- name: Generate list of changed files for CloudFront to invalidate
85-
run: |
86-
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
87-
for file in $FILES; do
88-
echo $file
89-
# add bare directory to list of updated paths when we see index.html
90-
[[ "$file" == *"/index.html" ]] && echo $file | sed -e 's/\/index.html$/\//'
91-
done | sort | uniq | tr '\n' ' ' > .updated_files
83+
- name: Generate list of changed files for CloudFront to invalidate
84+
run: |
85+
pushd docs/_build/html; FILES=$(find . -name \* -print | grep html | cut -c2- | sort | uniq | tr '\n' ' '); popd
86+
for file in $FILES; do
87+
echo $file
88+
# add bare directory to list of updated paths when we see index.html
89+
[[ "$file" == *"/index.html" ]] && echo $file | sed -e 's/\/index.html$/\//'
90+
done | sort | uniq | tr '\n' ' ' > .updated_files
9291
93-
- name: Invalidate on CloudFront
94-
uses: chetan/invalidate-cloudfront-action@master
95-
env:
96-
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
97-
AWS_REGION: 'us-east-1'
98-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
99-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
100-
PATHS_FROM: .updated_files
92+
- name: Invalidate on CloudFront
93+
uses: chetan/invalidate-cloudfront-action@master
94+
env:
95+
DISTRIBUTION: ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION }}
96+
AWS_REGION: "us-east-1"
97+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
98+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
99+
PATHS_FROM: .updated_files

.github/workflows/tests.yml

Lines changed: 52 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,71 +4,70 @@ on: [push]
44

55
jobs:
66
build:
7-
87
runs-on: ubuntu-latest
98
strategy:
109
matrix:
11-
python-version: [ '2.7', '3.x' ]
10+
python-version: ["2.7", "3.x"]
1211
steps:
13-
- uses: actions/checkout@v1
14-
- name: Configure git
15-
run: |
16-
git config --global user.name 'travis-ci'
17-
git config --global user.email 'travis@nowhere.edu'
18-
- name: Set up Python ${{ matrix.python-version }}
19-
uses: actions/setup-python@v1
20-
with:
21-
python-version: ${{ matrix.python-version }}
12+
- uses: actions/checkout@v1
13+
- name: Configure git
14+
run: |
15+
git config --global user.name 'travis-ci'
16+
git config --global user.email 'travis@nowhere.edu'
17+
- name: Set up Python ${{ matrix.python-version }}
18+
uses: actions/setup-python@v1
19+
with:
20+
python-version: ${{ matrix.python-version }}
2221

23-
- name: Get full Python version
24-
id: full-python-version
25-
shell: bash
26-
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
22+
- name: Get full Python version
23+
id: full-python-version
24+
shell: bash
25+
run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
2726

28-
- name: Install poetry
29-
run: |
30-
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
31-
python get-poetry.py -y --version 1.0.10
32-
echo "::set-env name=PATH::$HOME/.poetry/bin:$PATH"
33-
rm get-poetry.py
27+
- name: Install poetry
28+
run: |
29+
curl -O -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
30+
python get-poetry.py -y --version 1.0.10
31+
echo "PATH=${HOME}/.poetry/bin:${PATH}" >> $GITHUB_ENV
32+
rm get-poetry.py
3433
35-
- name: Get poetry cache paths from config
36-
run: |
37-
echo ::set-env name=poetry_cache_dir::$(poetry config --list | sed -n 's/.*cache-dir = //p' | sed -e 's/^"//' -e 's/"$//')
38-
echo ::set-env name=poetry_virtualenvs_path::$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^"//' -e 's/"$//')
34+
- name: Get poetry cache paths from config
35+
run: |
36+
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
37+
echo "poetry_virtualenvs_path=$(poetry config --list | sed -n 's/.*virtualenvs.path = .* # //p' | sed -e 's/^\"//' -e 's/\"$//')" >> $GITHUB_ENV
3938
40-
- name: Configure poetry
41-
shell: bash
42-
run: poetry config virtualenvs.in-project true
39+
- name: Configure poetry
40+
shell: bash
41+
run: poetry config virtualenvs.in-project true
4342

44-
- name: Set up cache
45-
uses: actions/cache@v2
46-
id: cache
47-
with:
48-
path: |
49-
.venv
50-
{{ env.poetry_cache_dir }}
51-
{{ env.poetry_virtualenvs_path }}
52-
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
43+
- name: Set up cache
44+
uses: actions/cache@v2
45+
id: cache
46+
with:
47+
path: |
48+
.venv
49+
{{ env.poetry_cache_dir }}
50+
{{ env.poetry_virtualenvs_path }}
51+
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
5352

54-
- name: Ensure cache is healthy
55-
if: steps.cache.outputs.cache-hit == 'true'
56-
shell: bash
57-
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
53+
- name: Ensure cache is healthy
54+
if: steps.cache.outputs.cache-hit == 'true'
55+
shell: bash
56+
run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv
5857

59-
- name: Upgrade pip
60-
shell: bash
61-
run: poetry run python -m pip install pip -U
58+
- name: Upgrade pip
59+
shell: bash
60+
run: poetry run python -m pip install pip -U
6261

63-
- name: Install dependencies
64-
run: poetry install -E "docs test coverage lint format"
62+
- name: Install dependencies
63+
run: poetry install -E "docs test coverage lint format"
6564

66-
- name: Lint with flake8
67-
run: poetry run flake8
65+
- name: Lint with flake8
66+
run: poetry run flake8
6867

69-
- name: Test with pytest
70-
run: poetry run py.test --cov=./ --cov-report=xml
68+
- name: Test with pytest
69+
run: poetry run py.test --cov=./ --cov-report=xml
7170

72-
- uses: codecov/codecov-action@v1
73-
with:
74-
token: ${{ secrets.CODECOV_TOKEN }}
71+
- uses: codecov/codecov-action@v1
72+
with:
73+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)