From a10a00c55b05ef903aa1707ce4dbbf8b76fd1ff0 Mon Sep 17 00:00:00 2001 From: Adam Kolodziejczyk Date: Fri, 16 Apr 2021 14:42:33 +0200 Subject: [PATCH 1/3] gh actions work in progress --- .../github-actions.yaml | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows_work_in_progress/github-actions.yaml diff --git a/.github/workflows_work_in_progress/github-actions.yaml b/.github/workflows_work_in_progress/github-actions.yaml new file mode 100644 index 00000000..6bf802da --- /dev/null +++ b/.github/workflows_work_in_progress/github-actions.yaml @@ -0,0 +1,47 @@ +on: [push, pull_request] +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - + name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - + name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - + name: build with maven & generate reports + run: mvn clean verify jacoco:report coveralls:report + - + name: build docker images for server and agent + if: contains(github.ref, "master") && github.event_name != 'pull_request' + run: mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml + - + name: push to docker registry + if: contains(github.ref, "master") && github.event_name != 'pull_request' + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: hltech/judge-d + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: push to heroku registry + if: contains(github.ref, "master") && github.event_name != 'pull_request' + uses: akhileshns/heroku-deploy@v3.12.12 + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: "YOUR APP's NAME" + heroku_email: "YOUR EMAIL" + + + + + From 4b21d7fd0f6c920b67ddfc49182be657f0f59ecf Mon Sep 17 00:00:00 2001 From: wlodarcp Date: Fri, 21 May 2021 11:45:59 +0200 Subject: [PATCH 2/3] Updated test containers version to 1.15.3 --- judge-d-server/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/judge-d-server/pom.xml b/judge-d-server/pom.xml index 6c49ca85..2f5b98ea 100644 --- a/judge-d-server/pom.xml +++ b/judge-d-server/pom.xml @@ -172,7 +172,7 @@ org.testcontainers postgresql - 1.14.3 + 1.15.3 test From 225808383ebeaa8af3621d888a8d1bc4a723591b Mon Sep 17 00:00:00 2001 From: wlodarcp Date: Fri, 21 May 2021 11:46:40 +0200 Subject: [PATCH 3/3] Removed travis.yml and enabled github actions build workflow --- .github/workflows/java.yaml | 78 +++++++++++++++++++ .../github-actions.yaml | 47 ----------- .travis.yml | 47 ----------- 3 files changed, 78 insertions(+), 94 deletions(-) create mode 100644 .github/workflows/java.yaml delete mode 100644 .github/workflows_work_in_progress/github-actions.yaml delete mode 100644 .travis.yml diff --git a/.github/workflows/java.yaml b/.github/workflows/java.yaml new file mode 100644 index 00000000..54600cef --- /dev/null +++ b/.github/workflows/java.yaml @@ -0,0 +1,78 @@ +on: [push, pull_request] + +jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Pull postgress docker image for functional tests + run: docker pull postgres:9.6.12 + - name: Build with maven & generate reports + env: + COVERALLS_REPO_KEY: ${{ secrets.COVERALLS_REPO_KEY }} + run: mvn clean verify jacoco:report coveralls:report + - name: Cache build files + uses: actions/cache@v2 + id: cache-build + with: + path: ./* + key: ${{ github.sha }} + release: + name: Release + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Retrieve files from cache + uses: actions/cache@v2 + id: cache-build + with: + path: ./* + key: ${{ github.sha }} + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Build judge-d-server docker image + run: mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml + - name: Push judge-d docker image to DockerHub + run: docker push hltech/judge-d + - name: Push to heroku registry + run: | + docker login -u _ -p $HEROKU_API_KEY registry.heroku.com + docker tag hltech/judge-d registry.heroku.com/judge-d/web + docker push registry.heroku.com/judge-d/web + env: + HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}} + - name: Release judge-d on Heroku + run: | + heroku container:login + heroku container:release web -a $HEROKU_APP_NAME + env: + HEROKU_API_KEY: ${{secrets.HEROKU_API_KEY}} + HEROKU_APP_NAME : "judge-d" + - name: Build docker image for agent + run: mvn validate docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml + - name: Publish judge-d-agent docker image to DockerHub + run: docker push hltech/judge-d-agent diff --git a/.github/workflows_work_in_progress/github-actions.yaml b/.github/workflows_work_in_progress/github-actions.yaml deleted file mode 100644 index 6bf802da..00000000 --- a/.github/workflows_work_in_progress/github-actions.yaml +++ /dev/null @@ -1,47 +0,0 @@ -on: [push, pull_request] -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'adopt' - - - name: Cache Maven packages - uses: actions/cache@v2 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: build with maven & generate reports - run: mvn clean verify jacoco:report coveralls:report - - - name: build docker images for server and agent - if: contains(github.ref, "master") && github.event_name != 'pull_request' - run: mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml - - - name: push to docker registry - if: contains(github.ref, "master") && github.event_name != 'pull_request' - uses: elgohr/Publish-Docker-Github-Action@master - with: - name: hltech/judge-d - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: push to heroku registry - if: contains(github.ref, "master") && github.event_name != 'pull_request' - uses: akhileshns/heroku-deploy@v3.12.12 - with: - heroku_api_key: ${{secrets.HEROKU_API_KEY}} - heroku_app_name: "YOUR APP's NAME" - heroku_email: "YOUR EMAIL" - - - - - diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f136ffc4..00000000 --- a/.travis.yml +++ /dev/null @@ -1,47 +0,0 @@ -language: java -sudo: true -jdk: - - openjdk11 - -cache: - directories: - - $HOME/.m2 - -services: - - docker - -before_install: - - echo "$DOCKER_PASSWORD_NEW" | docker login -u "$DOCKER_USERNAME_NEW" --password-stdin - - docker pull postgres:9.6.12 - - -jobs: - include: - - stage: build with maven & generate reports - script: - - mvn clean verify jacoco:report coveralls:report - - stage: build docker images for server and agent - if: NOT branch = master OR type IN (pull_request) - script: - - mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml - - mvn validate docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml - - stage: build & publish docker image for server - if: branch = master AND NOT type IN (pull_request) - script: - - mvn validate docker:build@build-docker -P docker-app -f ./judge-d-server/pom.xml - - echo "Pushing to docker registry" - - echo "$DOCKER_PASSWORD_NEW" | docker login -u "$DOCKER_USERNAME_NEW" --password-stdin - - docker push hltech/judge-d - - echo "Pushing to heroku registry" - - docker login -u _ -p "$HEROKU_API_KEY" registry.heroku.com - - docker tag hltech/judge-d registry.heroku.com/judge-d/web - - docker push registry.heroku.com/judge-d/web - - stage: release app in heroku - if: branch = master AND NOT type IN (pull_request) - script: - - heroku container:release web -a judge-d - - stage: build & publish docker image for agent - if: branch = master AND NOT type IN (pull_request) - script: - - mvn validate docker:build@build-docker -P docker-app -f ./judge-d-agent/pom.xml - - echo "$DOCKER_PASSWORD_NEW" | docker login -u "$DOCKER_USERNAME_NEW" --password-stdin - - docker push hltech/judge-d-agent