Merge pull request #27 from endlessm/python-3.11 #33
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: Azafea Metrics Proxy Tests | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
build: | |
name: Build Docker Image | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build Docker Image | |
run: docker build --tag amp . | |
- name: Save Docker Image | |
run: docker save amp > docker-image.tar | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: image | |
path: docker-image.tar | |
tests: | |
name: Integration Tests | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Docker Image | |
uses: actions/download-artifact@v2 | |
with: | |
name: image | |
- name: Load Docker Image | |
run: docker load < docker-image.tar | |
- name: Install Docker Images | |
run: docker run -d --name=redis --network=host redis:5-alpine --requirepass 'CHANGE ME!!' | |
- name: Run Tests | |
run: docker run --rm --network=host --entrypoint="" amp pipenv run test-all | |
- name: Remove Docker Images | |
run: docker rm -f redis | |
lint: | |
name: Lint and Type Checking | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Get Docker Image | |
uses: actions/download-artifact@v2 | |
with: | |
name: image | |
- name: Load Docker Image | |
run: docker load < docker-image.tar | |
- name: Lint | |
run: docker run --rm --entrypoint="" amp pipenv run lint | |
- name: Type Checking | |
run: docker run --rm --entrypoint="" amp pipenv run type-check | |
push: | |
name: Upload the Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
# We only want to publish a new image when the master branch changes, not | |
# for PRs and only if tests finish successfully. | |
needs: tests | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@v1 | |
with: | |
username: '${{ secrets.DOCKERHUB_USERNAME }}' | |
password: '${{ secrets.DOCKERHUB_TOKEN }}' | |
- name: Get Docker Image | |
uses: actions/download-artifact@v2 | |
with: | |
name: image | |
- name: Load Docker Image | |
run: docker load < docker-image.tar | |
- name: Upload the image | |
run: | | |
docker tag amp endlessm/azafea-metrics-proxy:latest | |
docker push endlessm/azafea-metrics-proxy:latest |