Skip to content

Commit

Permalink
Fix ci (#17)
Browse files Browse the repository at this point in the history
It appears the default Travis script for sbt was conflicting with the version used in Marathon.
On this occasion, we chose to migrate to Github Actions because it allowed the build to pass, including tests.
Not removing Travis related files since they are tracked upstream and can contain modification reflecting impacting changes in the future.
  • Loading branch information
komuta authored Mar 19, 2020
1 parent e4b090b commit cb63c79
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
name: Release

on:
push:
branches:
- 'criteo/*'
tags:
- '*'

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Fetch all history for all tags and branches
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git fetch --prune --unshallow
./criteo_tag_commit.sh
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build artifact
run: sbt clean universal:packageZipTarball
- name: Identify artifact
id: identify_artifact
run: ./identify_artifact.sh
- name: Run tests
run: sbt test
- name: Publish artifact
uses: actions/upload-artifact@v2-preview
if: success()
with:
name: ${{ steps.identify_artifact.outputs.artifact }}
path: ${{ steps.identify_artifact.outputs.path }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.identify_artifact.outputs.path }}
asset_name: ${{ steps.identify_artifact.outputs.artifact }}
asset_content_type: application/x-gzip
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Test

on:
- pull_request

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# Fetch all history for all tags and branches
- run: |
git fetch --prune --unshallow
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build artifact
run: sbt clean universal:packageZipTarball
- name: Identify artifact
id: identify_artifact
run: ./identify_artifact.sh
- name: Run tests
run: sbt test
- name: Publish artifact
uses: actions/upload-artifact@v2-preview
if: success()
with:
name: ${{ steps.identify_artifact.outputs.artifact }}
path: ${{ steps.identify_artifact.outputs.path }}
2 changes: 1 addition & 1 deletion criteo_tag_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ then
CRITEO_TAG="v$BASE_VERSION-$CRITEO_PATCH"
echo "tagging current commit with $CRITEO_TAG"
git tag $CRITEO_TAG
git remote add github https://${GH_TOKEN}@github.com/criteo-forks/marathon > /dev/null 2>&1
git remote add github https://${GITHUB_TOKEN}@github.com/criteo-forks/marathon
git push --quiet github --tags
updateVersion $CRITEO_TAG
else
Expand Down
9 changes: 9 additions & 0 deletions identify_artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

artifact_path=$(ls -1 target/universal/marathon-*.tgz)
artifact=$(basename "$artifact_path")
artifact_version="$(echo $artifact | sed -E 's/marathon-(.*)\.tgz/\1/')"

echo "::set-output name=path::$artifact_path"
echo "::set-output name=artifact::$artifact"
echo "::set-output name=version::$artifact_version"

0 comments on commit cb63c79

Please sign in to comment.