Skip to content

Commit

Permalink
Changed workflow to install docker compose first
Browse files Browse the repository at this point in the history
  • Loading branch information
Philip Torvund Bennett committed Sep 19, 2024
1 parent 9670687 commit 478417a
Showing 1 changed file with 32 additions and 38 deletions.
70 changes: 32 additions & 38 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,40 @@
# Runs on push to master
name: CI-CD

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
branches: [master]
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install Docker Compose
run: |
# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/v2.20.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
# Create a symbolic link to ensure it's accessible globally
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# Verify Docker Compose installation
docker-compose --version
- name: Build docker stack
run: |
docker network create traefik
docker-compose -f docker-compose.yml -f docker-compose.test.yml up run-tests
docker network create traefik
docker-compose -f docker-compose.yml -f docker-compose.test.yml up run-tests
# This workflow contains a single job called "build"
build-and-deploy:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: test
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

Expand All @@ -38,14 +44,13 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push Docker images
# You may pin to the exact commit or the version.
# uses: docker/build-push-action@0db984c1826869dcd0740ff26ff75ff543238fd9
uses: docker/build-push-action@v2.2.1
with:
tags: # optional
fotogjengen/hilfling-backend:latest
push: true #optional, default is false
tags: fotogjengen/hilfling-backend:latest
push: true

- name: "Package app outside docker"
run: "mvn clean package spring-boot:repackage"

Expand All @@ -59,25 +64,14 @@ jobs:
files: ./target/*

lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ktlint with reviewdog
# You may pin to the exact commit or the version.
# uses: ScaCap/action-ktlint@58b3c386f5160049b0a1d0f986c56e0d0717140a
uses: ScaCap/action-ktlint@1.3
with:
# GITHUB_TOKEN
github_token: ${{ secrets.GITHUB_TOKEN }}
# Report level for reviewdog [info,warning,error]
level: error# optional, default is error
# Reporter of reviewdog command [github-pr-check,github-pr-review].

reporter: github-pr-check # optional, default is github-pr-check
# Fails the current check if any error was found [true/false]

fail_on_error: false # optional, default is false

# Print files relative to the working directory
relative: true # optional, default is true
# Run KtLint with Android Kotlin Style Guide
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run ktlint with reviewdog
uses: ScaCap/action-ktlint@1.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
level: error
reporter: github-pr-check
fail_on_error: false
relative: true

0 comments on commit 478417a

Please sign in to comment.