added missing dependencies and test fix #120
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Scheduly | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
test-all: | |
name: Run test | |
runs-on: ubuntu-20.04 | |
env: | |
SLACK_TOKEN_TEST: ${{ secrets.SLACK_TOKEN_TEST }} | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Replace Slack OAuth Token | |
run: | | |
sed -i "s/slack.oauth.token=.*/slack.oauth.token=${{ secrets.SLACK_TOKEN }}/" src/main/resources/application.properties | |
- name: Run mvn v | |
run: mvn -v | |
- name: Run java v | |
run: java -version | |
- name: Run unitary test | |
run: mvn -B -Dtest=*UnitaryTest test | |
- name: Run integration test | |
run: mvn -B -Dtest=*IntegrationTest test | |
publish_in_github_packages: | |
name: Publish github artifact | |
runs-on: ubuntu-20.04 | |
needs: [test-all] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Replace Slack OAuth Token | |
run: | | |
sed -i "s/slack.oauth.token=.*/slack.oauth.token=${{ secrets.SLACK_TOKEN_USER }}/" src/main/resources/application.properties | |
- name: Publish package | |
run: mvn --batch-mode deploy -Dmaven.test.skip=true | |
env: | |
GITHUB_TOKEN: ${{ secrets.PACKAGE_PASSWORD }} | |
- name: Upload jar for next job | |
uses: actions/upload-artifact@v3 | |
with: | |
name: target | |
path: target | |
retention-days: 1 | |
publish_in_dockerhub: | |
name: Publish in DockerHub | |
runs-on: ubuntu-20.04 | |
outputs: | |
tag: ${{ steps.project.outputs.tag }} | |
needs: [publish_in_github_packages] | |
env: | |
IMAGE_NAME: scheduly | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Download jar from previous job | |
uses: actions/download-artifact@v3 | |
with: | |
name: target | |
path: target | |
- name: Read Git Commit ID | |
run: | | |
echo ls | |
GIT_COMMIT_ID=$(cat target/classes/git.properties | grep "git.commit.id.abbrev" | cut -d'=' -f2) | |
echo "Git Commit ID Abbreviated: $GIT_COMMIT_ID" | |
echo "::set-output name=tag::$GIT_COMMIT_ID" | |
id: project | |
- name: Build image | |
run: docker build -t $IMAGE_NAME . | |
- name: Login to DockerHub | |
run: docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" -p "${{ secrets.DOCKERHUB_TOKEN }}" | |
- name: Push image to DockerHub | |
run: | | |
docker tag $IMAGE_NAME ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:${{ steps.project.outputs.tag }} | |
docker push ${{ secrets.DOCKERHUB_USERNAME }}/$IMAGE_NAME:${{ steps.project.outputs.tag }} | |
- name: Login to GitHub Docker Registry | |
run: echo "${{ secrets.PACKAGE_PASSWORD }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Push image to GitHub Container Registry | |
run: | | |
IMAGE_VERSION=${{ steps.project.outputs.tag }} | |
IMAGE_USER=molynx | |
docker tag $IMAGE_NAME ghcr.io/$IMAGE_USER/$IMAGE_NAME:$IMAGE_VERSION | |
docker push ghcr.io/$IMAGE_USER/$IMAGE_NAME:$IMAGE_VERSION | |
deploy_in_okteto: | |
name: Deploy in Okteto | |
runs-on: ubuntu-20.04 | |
needs: [publish_in_dockerhub] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Update schedule.yml | |
run: | | |
echo "Scheduly image version: ${{ needs.publish_in_dockerhub.outputs.tag }}" | |
sed -i 's|image: molynx/scheduly:2.0.0-SNAPSHOT|image: molynx/scheduly:${{ needs.publish_in_dockerhub.outputs.tag }}|' k8s/scheduly.yml | |
- uses: okteto/context@latest | |
with: | |
token: ${{ secrets.OKTETO_TOKEN }} | |
- name: "Activate Namespace" | |
uses: okteto/namespace@latest | |
with: | |
namespace: molynx | |
- name: "Deploy mongo" | |
uses: okteto/apply@latest | |
with: | |
namespace: molynx | |
manifest: ./k8s/mongodb.yml | |
- name: "Deploy application" | |
uses: okteto/apply@latest | |
with: | |
namespace: molynx | |
manifest: ./k8s/scheduly.yml | |
test-rest-e2e: | |
name: Run rest e2e test | |
runs-on: ubuntu-20.04 | |
env: | |
SLACK_TOKEN_TEST: ${{ secrets.SLACK_TOKEN_TEST }} | |
needs: [deploy_in_okteto] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Replace Slack OAuth Token | |
run: | | |
sed -i "s/slack.oauth.token=.*/slack.oauth.token=${{ secrets.SLACK_TOKEN }}/" src/main/resources/application.properties | |
- name: Run mvn v | |
run: mvn -v | |
- name: Run java v | |
run: java -version | |
- name: Run Rest E2E test | |
run: mvn -B -Dtest=*RestControllerE2ETest test | |
test-web-e2e: | |
name: Run web e2e test | |
runs-on: ubuntu-20.04 | |
env: | |
SLACK_TOKEN_TEST: ${{ secrets.SLACK_TOKEN_TEST }} | |
needs: [test-rest-e2e] | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v2 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'adopt' | |
java-version: '17' | |
- name: Replace Slack OAuth Token | |
run: | | |
sed -i "s/slack.oauth.token=.*/slack.oauth.token=${{ secrets.SLACK_TOKEN }}/" src/main/resources/application.properties | |
- name: Run mvn v | |
run: mvn -v | |
- name: Run java v | |
run: java -version | |
- name: Install Google Chrome | |
run: | | |
chmod +x ./scripts/installFirefox.sh | |
./scripts/installFirefox.sh | |
- name: Run Rest E2E test | |
run: mvn -B -Dtest=*WebControllerE2ETest test |