Setup pipeline #2
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: Test and build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag for docker image' | |
required: true | |
env: | |
IMAGE_NAME: openfga-operator | |
IMAGE_TAG: ${{ inputs.tag || github.run_id }} | |
GITHUB_REGISTRY: ghcr.io | |
jobs: | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.22' | |
- name: Updating docker compose | |
run: | | |
sudo curl -SL https://github.com/docker/compose/releases/download/v2.26.1/docker-compose-linux-x86_64 -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Start OpenFGA | |
run: docker-compose -f hosting/docker-compose.yaml up --wait | |
- name: Run tests | |
working-directory: ./operator | |
run: make test | |
build: | |
permissions: | |
contents: read | |
packages: write | |
runs-on: ubuntu-22.04 | |
needs: | |
- test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GITHUB_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '^1.22' | |
- name: Build and push Docker image | |
working-directory: ./operator | |
run: make docker-build docker-push IMG=${{ env.GITHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} |