diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 0a56c583..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,108 +0,0 @@ -version: 2.1 -jobs: - frontend: - docker: - - image: cimg/node:18.14 - steps: - - checkout - - restore_cache: - key: oneko-npm-dependencies-{{ checksum "frontend/package.json" }} - - run: - name: Installing dependencies - working_directory: ./frontend - command: npm ci - - save_cache: - key: oneko-npm-dependencies-{{ checksum "frontend/package.json" }} - paths: - - ./frontend/node_modules - - run: - name: Building the frontend - working_directory: ./frontend - command: npm run build - - save_cache: - key: oneko-frontend-{{ .Environment.CIRCLE_SHA1 }} - paths: - - ./frontend/dist/ - - backend: - docker: - - image: cimg/openjdk:17.0 - steps: - - checkout - - restore_cache: - key: oneko-maven-dependencies-{{ checksum "pom.xml" }} - - restore_cache: - key: oneko-frontend-{{ .Environment.CIRCLE_SHA1 }} - - run: mvn dependency:go-offline - - save_cache: - key: oneko-maven-dependencies-{{ checksum "pom.xml" }} - paths: ~/.m2 - - run: mvn package - - store_test_results: - path: target/surefire-reports - - run: mkdir ./circle-artifacts && cp ./target/o-neko*.jar ./circle-artifacts/ - - save_cache: - key: oneko-artifacts-{{ .Environment.CIRCLE_SHA1 }} - paths: ./circle-artifacts/ - - store_artifacts: - path: ./circle-artifacts/ - - dockerize_dev: - docker: - - image: docker:20 - steps: - - checkout - - setup_remote_docker - - restore_cache: - key: oneko-artifacts-{{ .Environment.CIRCLE_SHA1 }} - - run: cp /home/circleci/project/circle-artifacts/*-layered.jar . - - run: docker build --build-arg JAR_FILE=$(find . -type f -name '*-layered.jar') -t subshellgmbh/o-neko:latest-dev . - - run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - run: docker push subshellgmbh/o-neko:latest-dev - - release: - docker: - - image: docker:20 - steps: - - checkout - - setup_remote_docker - - restore_cache: - key: oneko-artifacts-{{ .Environment.CIRCLE_SHA1 }} - - run: cp /home/circleci/project/circle-artifacts/*-layered.jar . - - run: docker build --build-arg JAR_FILE=$(find . -type f -name '*-layered.jar') -t subshellgmbh/o-neko:latest . - - run: docker build --build-arg JAR_FILE=$(find . -type f -name '*-layered.jar') -t subshellgmbh/o-neko:$CIRCLE_TAG . - - run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin - - run: docker push subshellgmbh/o-neko:$CIRCLE_TAG - - run: docker push subshellgmbh/o-neko:latest - -workflows: - version: 2 - build: - jobs: - - frontend: - filters: - tags: - only: /.*/ - - backend: - requires: - - frontend - filters: - tags: - only: /.*/ - - dockerize_dev: - requires: - - backend - filters: - branches: - only: master - tags: - only: /.*/ - - release: - requires: - - backend - filters: - branches: - ignore: /.*/ - # only act on version tags - tags: - only: /^[0-9]+(\.[0-9]+)*$/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..f0437aae --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,96 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + frontend: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18.14' + cache: 'npm' + cache-dependency-path: frontend/package-lock.json + + - name: Install dependencies + working-directory: ./frontend + run: npm ci + + - name: Build frontend + working-directory: ./frontend + run: npm run build + + - name: Upload frontend dist + uses: actions/upload-artifact@v4 + with: + name: frontend-dist + path: frontend/dist/ + + backend: + needs: frontend + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: '17' + distribution: 'temurin' + cache: 'maven' + + - name: Download frontend dist + uses: actions/download-artifact@v4 + with: + name: frontend-dist + path: frontend/dist/ + + - name: Build with Maven + run: mvn package + + - name: Upload JAR artifacts + uses: actions/upload-artifact@v4 + with: + name: backend-artifacts + path: target/o-neko*-layered.jar + + containerize-main: + needs: backend + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download backend artifacts + uses: actions/download-artifact@v4 + with: + name: backend-artifacts + path: . + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: subshellgmbh/o-neko:latest-dev + build-args: | + JAR_FILE=$(ls *-layered.jar) + diff --git a/README.md b/README.md index 170ce849..a5002684 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ![O-Neko Logo](oneko.svg) # O-Neko -[![CircleCI](https://circleci.com/gh/subshell/o-neko/tree/master.svg?style=svg)](https://circleci.com/gh/subshell/o-neko/tree/master) +[![Build](https://github.com/subshell/o-neko/actions/workflows/build.yml/badge.svg)](https://github.com/subshell/o-neko/actions/workflows/build.yml) [![Docker Image Version (latest semver)](https://img.shields.io/docker/v/subshellgmbh/o-neko?color=2496ED&label=subshellgmbh%2Fo-neko&logo=docker&logoColor=white&sort=semver)](https://hub.docker.com/r/subshellgmbh/o-neko/tags) O-Neko lets everyone preview and try out new features of your software by creating on-demand test environments for feature branches. O-Neko is Kubernetes-native and allows for flexible project configurations via Helm charts. Make sure developers, testers, project managers, product owners and clients are on the same page! Preview and test _before_ you merge!