Skip to content

Commit 4f5ff5d

Browse files
authored
Merge pull request #1 from CodelyTV/addLessons
Add lessons course
2 parents 525b0ed + 27a8c5f commit 4f5ff5d

File tree

95 files changed

+3764
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+3764
-0
lines changed

.github/dependabot.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
on:
2+
schedule:
3+
- cron: '0 6 * * 1-5'
4+
5+
name: 🍄 Check dependencies updates
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
scala-steward:
13+
runs-on: ubuntu-22.04
14+
name: Check Scala project dependencies updates with Scala Steward
15+
steps:
16+
- uses: scala-steward-org/scala-steward-action@v2

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-java@v4
18+
with:
19+
distribution: 'zulu'
20+
java-version: '21'
21+
cache: 'sbt'
22+
- name: 👌 Run "pre-push" tasks (compile and style-check)
23+
run: sbt prep
24+
- name: ✅ Run test
25+
run: sbt test
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Update GitHub Dependency Graph
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: scalacenter/sbt-dependency-submission@v3

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.bsp/
2+
target/
3+
boot/
4+
lib_managed/
5+
src_managed/
6+
project/plugins/project/
7+
8+
/docker/spark/data/
9+
/docker/volume/
10+
/docker/spark/apps/

.scalafmt.conf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version = 3.8.2
2+
runner.dialect = scala213
3+
style = default
4+
maxColumn = 120
5+
continuationIndent.callSite = 2
6+
align.preset = more
7+
runner.optimizer.forceConfigStyleMinArgCount = 1
8+
rewrite.rules = [SortImports]
9+
importSelectors = singleLine
10+
project.excludeFilters = ["target/"]
11+
project.git = true # Only format files tracked by git

build.sbt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Settings.settings
2+
3+
libraryDependencies := Dependencies.all
4+
5+
SbtAliases.aliases.flatMap { case (alias, command) =>
6+
addCommandAlias(alias, command)
7+
}
8+
9+
assembly / mainClass := Some(
10+
"com.codely.lesson_04_how_to_deploy_spark.video_01__deploy_application.DeploySparkApp"
11+
)
12+
13+
import sbtassembly.MergeStrategy
14+
assembly / assemblyMergeStrategy := {
15+
case PathList("org", "apache", "spark", "unused", "UnusedStubClass.class") => MergeStrategy.first
16+
case x => (assembly / assemblyMergeStrategy).value(x)
17+
}

conf/.gitkeep

Whitespace-only changes.

doc/hooks/install-hooks.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
cd "$(dirname "$0")/../.."
4+
5+
rm -rf .git/hooks
6+
7+
ln -s ../doc/hooks .git/hooks
8+
sudo chmod -R 777 doc/hooks/*

doc/hooks/pre-push

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
#!/bin/bash
2+
3+
# Checks if locally staged changes are formatted properly ignoring non-staged changes.
4+
# Install it with the `install-hooks.sh` script
5+
# Based on: https://gist.github.com/cvogt/2676ed6c6d1abafa3d6a
6+
7+
PATH=$PATH:/usr/local/bin:/usr/local/sbin
8+
9+
echo ""
10+
echo "Running pre-push hook… (you can omit this with --no-verify, but don't)"
11+
12+
echo "* Moving to the project directory…"
13+
_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
14+
DIR=$( echo $_DIR | sed 's/\/.git\/hooks$//' )
15+
16+
echo "* Stashing non-staged changes so we avoid checking them…"
17+
git diff --quiet
18+
hadNoNonStagedChanges=$?
19+
20+
if ! [ $hadNoNonStagedChanges -eq 0 ]
21+
then
22+
git stash --keep-index -u > /dev/null
23+
fi
24+
25+
echo "* Checking pre push conditions ('prep' SBT task)…"
26+
sbt prep > /dev/null
27+
canPush=$?
28+
29+
if [ $canPush -ne 0 ]
30+
then
31+
echo " [KO] Error :("
32+
fi
33+
34+
echo "* Applying the stash with the non-staged changes…"
35+
if ! [ $hadNoNonStagedChanges -eq 0 ]
36+
then
37+
sleep 1 && git stash pop --index > /dev/null & # sleep because otherwise commit fails when this leads to a merge conflict
38+
fi
39+
40+
# Final result
41+
echo ""
42+
43+
if [ $canPush -eq 0 ]
44+
then
45+
echo "[OK] Your code will be pushed young Padawan"
46+
exit 0
47+
else
48+
echo "[KO] Cancelling push due to test code style error (run 'sbt prep' for more information)"
49+
exit 1
50+
fi

0 commit comments

Comments
 (0)