From 21735ac46c2e4dea4db5bc614e702c12b6deb214 Mon Sep 17 00:00:00 2001 From: Luka Savkov Date: Wed, 11 Sep 2024 19:36:16 +0200 Subject: [PATCH] Set up GitHub Actions for CI --- .github/workflows/push.yml | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/push.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml new file mode 100644 index 0000000..066dae4 --- /dev/null +++ b/.github/workflows/push.yml @@ -0,0 +1,77 @@ +name: Go CI + +on: + push: + branches: + - master + +jobs: + go-ci: + runs-on: ubuntu-latest + + steps: + - name: Check out main repository + uses: actions/checkout@v4 + + - name: Check additional repo + uses: actions/checkout@v4 + with: + repository: 'c12s/gravity' + path: 'gravity' + + - name: Move gravity to parent directory + run: mv gravity ../gravity + + - name: Check additional repo + uses: actions/checkout@v4 + with: + repository: 'c12s/meridian' + path: 'meridian' + + - name: Move meridian to parent directory + run: mv meridian ../meridian + + - name: Check additional repo + uses: actions/checkout@v4 + with: + repository: 'c12s/oort' + path: 'oort' + + - name: Move oort to parent directory + run: mv oort ../oort + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.22.3' + + - name: Update and tidy Go modules + run: go mod tidy + + - name: Install dependencies + run: go mod download + working-directory: ./ + + - name: Build + run: go build -v ./... + working-directory: ./ + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to DockerHub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and Push Docker Image + uses: docker/build-push-action@v6 + with: + context: .. + file: ../magnetar/Dockerfile + push: true + tags: ${{ secrets.DOCKERHUB_USERNAME }}/magnetar:latest