Skip to content

Commit

Permalink
Switch to tools.deps (#16749)
Browse files Browse the repository at this point in the history
  • Loading branch information
camsaul authored Jul 31, 2021
1 parent 39e8760 commit 0eef225
Show file tree
Hide file tree
Showing 144 changed files with 1,975 additions and 2,240 deletions.
185 changes: 91 additions & 94 deletions .circleci/config.yml

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion .dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
(let-404)
(macros/case 0)
(match 1)
(c/step 1)
(mbql.match/match 1)
(mt/test-drivers 1)
(mt/query 1)
Expand All @@ -39,11 +40,12 @@
(qp.streaming/streaming-response 1)
(prop/for-all 1)
(tools.macro/macrolet '(1 (:defn))))))
(cider-clojure-cli-aliases . "dev:drivers:drivers-dev:ee:ee-dev:build:user")
(clojure-indent-style . always-align)
;; if you're using clj-refactor (highly recommended!)
(cljr-favor-prefix-notation . nil)
;; prefer keeping source width about ~118, GitHub seems to cut off stuff at either 119 or 120 and
;; it's nicer to look at code in GH when you don't have to scroll back and forth
(fill-column . 118)
(clojure-docstring-fill-column . 118)
(cider-preferred-build-tool . lein))))
(cider-preferred-build-tool . clojure-cli))))
21 changes: 18 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
.babel_cache/*
.babel_cache
docs/*
OSX/*
target/*
.circleci
.cpcache
.devcontainer
.github
.husky
.lsp
.shadow-cljs
.github
.git
.vscode
hooks/*
test/*
test_config/*
test_modules/*
test_resources/*
node_modules

**node_modules
**metabase.jar

*.db

.dockerignore
Dockerfile
.dockerignore
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
### Tests

- [ ] Run the frontend and Cypress end-to-end tests with `yarn lint && yarn test`)
- [ ] If there are changes to the backend codebase, run the backend tests with `lein test && lein lint`
- [ ] If there are changes to the backend codebase, run the backend tests with `clojure -X:dev:test`
- [ ] Sign the [Contributor License Agreement](https://docs.google.com/a/metabase.com/forms/d/1oV38o7b9ONFSwuzwmERRMi9SYrhYeOrkbmNaq9pOJ_E/viewform)
(unless it's a tiny documentation change).
38 changes: 27 additions & 11 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.clj'
- '**.clj*'
- '**.edn'
- '**.java'
- '**/metabase-plugin.yaml'
Expand All @@ -35,12 +31,22 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-eastwood-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci eastwood
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-eastwood-${{ hashFiles('**/deps.edn') }}
- name: Compile Java & AOT Sources
run: |
source ./bin/prep.sh && prep_deps
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:eastwood
name: Run Eastwood linter

be-linter-namespace-decls:
runs-on: ubuntu-20.04
Expand All @@ -51,9 +57,19 @@ jobs:
uses: actions/setup-java@v1
with:
java-version: 11
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-namespace-decls-${{ hashFiles('**/project.clj') }}
- run: lein with-profile +ci check-namespace-decls
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-namespace-decls-${{ hashFiles('**/deps.edn') }}
- name: Compile Java & AOT Sources
run: |
source ./bin/prep.sh && prep_deps
- run: clojure -X:dev:ee:ee-dev:drivers:drivers-dev:namespace-checker
name: Check ns forms
6 changes: 0 additions & 6 deletions .github/workflows/frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
- 'fix**'
- 'ci**'
tags:
- '**'
paths:
- 'frontend/**'
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.clj'
- '**.clj*'
- '**.js'
- '**.jsx'
- '.github/workflows/**'
Expand Down Expand Up @@ -38,8 +34,8 @@ jobs:

- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- run: ./bin/i18n/update-translation-template
name: Check i18n tags/make sure template can be built
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/percy-issue-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ jobs:
echo "yarn `yarn --version`"
java -version
echo "Clojure `clojure -e "(println (clojure-version))"`"
lein --version
- name: Get yarn cache
uses: actions/cache@v2
Expand All @@ -76,7 +75,6 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}-${{ hashFiles('**/deps.edn') }}

- run: yarn install --frozen-lockfile --prefer-offline
- run: lein with-profile +include-all-drivers,+cloverage,+junit,+${{ matrix.edition }} deps
- run: ./bin/build

- name: Mark with the commit hash
Expand Down
10 changes: 4 additions & 6 deletions .github/workflows/percy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,14 @@ jobs:
java-version: 8
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- name: Check versions
run: |
echo "Node.js `node --version`"
echo "yarn `yarn --version`"
java -version
echo "Clojure `clojure -e "(println (clojure-version))"`"
lein --version
- name: Get yarn cache
uses: actions/cache@v2
Expand All @@ -57,7 +56,6 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}-${{ hashFiles('**/deps.edn') }}

- run: yarn install --frozen-lockfile --prefer-offline
- run: lein with-profile +include-all-drivers,+cloverage,+junit,+${{ matrix.edition }} deps
- run: ./bin/build

- name: Mark with the commit hash
Expand Down Expand Up @@ -89,8 +87,8 @@ jobs:
java-version: 8
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- name: Check versions
run: |
echo "Node.js `node --version`"
Expand Down
18 changes: 8 additions & 10 deletions .github/workflows/uberjar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@ name: Uberjar
on:
push:
branches:
- master
- 'release-**'
tags:
- '**'
paths-ignore:
- 'docs/**'
Expand Down Expand Up @@ -35,15 +32,15 @@ jobs:
java-version: 8
- name: Install Clojure CLI
run: |
curl -O https://download.clojure.org/install/linux-install-1.10.1.708.sh &&
sudo bash ./linux-install-1.10.1.708.sh
curl -O https://download.clojure.org/install/linux-install-1.10.3.933.sh &&
sudo bash ./linux-install-1.10.3.933.sh
- name: Check versions
run: |
echo "Node.js `node --version`"
echo "yarn `yarn --version`"
java -version
echo "Clojure `clojure -e "(println (clojure-version))"`"
lein --version
clojure --help | grep Version
- name: Get yarn cache
uses: actions/cache@v2
Expand All @@ -53,12 +50,13 @@ jobs:
- name: Get M2 cache
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}-${{ hashFiles('**/deps.edn') }}
path: |
~/.m2
~/.gitlibs
key: ${{ runner.os }}-m2-${{ hashFiles('**/deps.edn') }}

- run: yarn install --frozen-lockfile --prefer-offline
- run: lein with-profile +include-all-drivers,+cloverage,+junit,+${{ matrix.edition }} deps
- run: ./bin/build
- run: MB_EDITION=${{ matrix.edition }} ./bin/build

- name: Mark with the commit hash
run: git rev-parse --short HEAD > COMMIT-ID
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ on:
pull_request:
push:
branches:
- master
- 'release**'
- 'feature**'
tags:
- '**'
paths:
- '**.yml'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
/resources/frontend_client/index.html
/resources/frontend_client/public.html
/resources/i18n/*.edn
/resources/license-backend-third-party.txt
/resources/license-frontend-third-party.txt
/resources/namespaces.edn
/resources/sample-dataset.db.trace.db
/resources/version.properties
Expand Down
52 changes: 9 additions & 43 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,31 @@
# STAGE 1.1: builder frontend
###################

FROM metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021 as frontend
FROM metabase/ci:circleci-java-11-clj-1.10.3.929-07-27-2021-node-browsers as frontend

ARG MB_EDITION=oss

WORKDIR /app/source
WORKDIR /home/circleci

COPY . .
COPY --chown=circleci . .
RUN NODE_ENV=production MB_EDITION=$MB_EDITION yarn --frozen-lockfile && yarn build && bin/i18n/build-translation-resources

###################
# STAGE 1.2: backend deps
###################

FROM metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021 as backend

WORKDIR /app/source

# backend dependencies
COPY project.clj .
RUN lein deps :tree

###################
# STAGE 1.3: drivers
###################

FROM metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021 as drivers

ARG MB_EDITION=oss

WORKDIR /app/source

COPY --from=backend /root/.m2/repository/. /root/.m2/repository/.

# add the rest of the source
COPY . .

# build the app
RUN INTERACTIVE=false MB_EDITION=$MB_EDITION sh bin/build-drivers.sh

###################
# STAGE 1.4: main builder
###################

FROM metabase/ci:java-11-lein-2.9.6-clj-1.10.3.822-04-22-2021 as builder
FROM metabase/ci:circleci-java-11-clj-1.10.3.929-07-27-2021-node-browsers as builder

ARG MB_EDITION=oss

WORKDIR /app/source
WORKDIR /home/circleci

# try to reuse caching as much as possible
COPY --from=frontend /root/.m2/repository/. /root/.m2/repository/.
COPY --from=frontend /app/source/. .
COPY --from=backend /root/.m2/repository/. /root/.m2/repository/.
COPY --from=backend /app/source/. .
COPY --from=drivers /root/.m2/repository/. /root/.m2/repository/.
COPY --from=drivers /app/source/. .
COPY --from=frontend /home/circleci/.m2/repository/. /home/circleci/.m2/repository/.
COPY --from=frontend /home/circleci/. .

# build the app
RUN INTERACTIVE=false MB_EDITION=$MB_EDITION bin/build version uberjar
RUN INTERACTIVE=false MB_EDITION=$MB_EDITION bin/build version drivers uberjar

# ###################
# # STAGE 2: runner
Expand All @@ -83,7 +49,7 @@ RUN apk upgrade && apk add --update-cache --no-cache bash ttf-dejavu fontconfig
mkdir -p /plugins && chmod a+rwx /plugins

# add Metabase script and uberjar
COPY --from=builder /app/source/target/uberjar/metabase.jar /app/
COPY --from=builder /home/circleci/target/uberjar/metabase.jar /app/
COPY bin/docker/run_metabase.sh /app/

# expose our default runtime port
Expand Down
Loading

0 comments on commit 0eef225

Please sign in to comment.