-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Be less aggressive about Docker and docs builds
Only trigger the Docker build workflow for ticket branches and tags. Only trigger docs builds for ticket branches and the main branch, and ignore commits that don't touch the documentation. This should cut back on the useless Docker images and docuemntation versions we push from dependency updates from dependabot and neophile. We'd like to preserve the behavior of only triggering Docker builds if the tests pass, but unfortunately there isn't any way to do that and also use different criteria for running the Docker workflow without some very complicated machinations involving the REST API or complex conditionals. Live with spurious builds with failing tests for now at least.
- Loading branch information
Showing
3 changed files
with
87 additions
and
67 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Docker | ||
|
||
"on": | ||
push: | ||
branches: | ||
- "tickets/**" | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Define the Docker tag | ||
id: vars | ||
run: echo ::set-output name=tag::$(echo ${GITHUB_REF} | sed -E 's,refs/(heads|tags)/,,' | sed -E 's,/,-,g') | ||
|
||
- name: Print the tag | ||
id: print | ||
run: echo ${{steps.vars.outputs.tag}} | ||
|
||
- name: Log into Docker Hub | ||
run: echo ${{ secrets.DOCKER_TOKEN }} | docker login --username ${{ secrets.DOCKER_USERNAME }} --password-stdin | ||
|
||
- name: Pull previous images | ||
run: | | ||
docker pull lsstsqre/gafaelfawr:deps-${{steps.vars.outputs.tag}} || true | ||
docker pull lsstsqre/gafaelfawr:${{steps.vars.outputs.tag}} || true | ||
- name: Build the dependencies Docker image | ||
run: | | ||
docker build --target dependencies-image \ | ||
--cache-from=lsstsqre/gafaelfawr:deps-${{steps.vars.outputs.tag}} \ | ||
--tag lsstsqre/gafaelfawr:deps-${{steps.vars.outputs.tag}} . | ||
- name: Build the runtime Docker image | ||
run: | | ||
docker build --target runtime-image \ | ||
--cache-from=lsstsqre/gafaelfawr:${{steps.vars.outputs.tag}} \ | ||
--tag lsstsqre/gafaelfawr:${{steps.vars.outputs.tag}} . | ||
- name: Push Docker images | ||
run: | | ||
docker push lsstsqre/gafaelfawr:deps-${{steps.vars.outputs.tag}} | ||
docker push lsstsqre/gafaelfawr:${{steps.vars.outputs.tag}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Docs | ||
|
||
"on": | ||
push: | ||
branches: | ||
- main | ||
- master | ||
- "tickets/**" | ||
paths: | ||
- "docs/**" | ||
- "src/**.py" | ||
|
||
jobs: | ||
docs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install tox and LTD Conveyor | ||
run: pip install tox ltd-conveyor | ||
|
||
- name: Install graphviz and ImageMagick | ||
run: sudo apt-get install graphviz imagemagick | ||
|
||
- name: Run tox | ||
run: tox -e docs | ||
|
||
- name: Upload to LSST the Docs | ||
env: | ||
LTD_USERNAME: ${{ secrets.LTD_USERNAME }} | ||
LTD_PASSWORD: ${{ secrets.LTD_PASSWORD }} | ||
run: ltd upload --product gafaelfawr --gh --dir docs/_build/html |