Update ci-and-push.yml #62
Workflow file for this run
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: Run CI then push to Docker Hub | |
on: | |
push: | |
tags: | |
- '*' | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test: | |
name: Run CI tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@main | |
- name: Setup the UID env var | |
run: echo "CRAWL_UID=$(id -u)" >> $GITHUB_ENV | |
- name: Check the Docker Compose config | |
run: docker-compose config | |
- name: Build the containers | |
run: docker-compose build | |
- name: Set up output folders so that permissions are correct | |
run: | | |
mkdir -p ./target/integration-test-volumes/output | |
mkdir -p ./target/integration-test-volumes/scratch | |
mkdir -p ./target/integration-test-volumes/state | |
mkdir -p ./target/integration-test-volumes/wren | |
mkdir -p /tmp/webrender | |
chmod -R a+w ./target/integration-test-volumes | |
- name: Spin up the crawler | |
run: docker-compose up -d heritrix | |
- name: Show what is running | |
run: docker ps | |
# - name: Run integration tests | |
# run: docker-compose run robot | |
- name: Show what Heritrix logged, even if the tests failed | |
if: ${{ always() }} | |
run: docker-compose logs heritrix | |
- name: Show what WebRender logged, even if the tests failed | |
if: ${{ always() }} | |
run: docker-compose logs webrender | |
- name: Show what Warcprox logged, even if the tests failed | |
if: ${{ always() }} | |
run: docker-compose logs warcprox | |
# Make integration test results available, even if the tests failed | |
- uses: actions/upload-artifact@main | |
if: ${{ always() }} | |
with: | |
name: robot-ci-results | |
path: integration-test/results/ | |
# if-no-files-found: error | |
push_to_registries: | |
needs: test | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: 1.0.0 # Optional fallback tag to use when no tag can be found | |
- name: Set up Docker metadata | |
id: meta | |
uses: docker/metadata-action@v3 | |
with: | |
images: ukwa/heritrix | |
# generate Docker tags based on the following events/attributes | |
tags: | | |
type=raw,value=${{ steps.previoustag.outputs.tag }} | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
- name: Log in to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | |
- name: Push to Docker Hub | |
uses: docker/build-push-action@v2 | |
with: | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |