refactor workflows to allow migration from ecr to ghcr and onto gihthub hosted runner #69
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 tests | |
on: | |
pull_request: | |
branches: | |
- main | |
permissions: {} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
LOGS_BUCKET_NAME: moj-analytics-s3-logs | |
permissions: | |
actions: read | |
attestations: write | |
contents: write | |
id-token: write | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Install Docker Compose | |
id: docker-compose | |
shell: bash | |
env: | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/v2.21.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
docker-compose --version | |
- name: Build image | |
run: make build | |
env: | |
NETWORK: host | |
IMAGE_TAG: ${{ github.sha }} | |
- name: Run Python tests (docker-compose) | |
run: make clean && make test | |
env: | |
NETWORK: default | |
IMAGE_TAG: ${{ github.sha }} | |
- name: Log in to GitHub Container Registry | |
id: ghcr_login | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push | |
run: | | |
docker push ghcr.io/${{ github.repository }}:${{ github.sha }} |