From 5420de5a34756192ef59ae40dc23cec5d819307f Mon Sep 17 00:00:00 2001 From: Ambrose Bonnaire-Sergeant Date: Wed, 20 Dec 2023 14:58:32 -0600 Subject: [PATCH] add build --- .github/workflows/build.yml | 91 +++++++++++++++++++++++++++++++++++++ .travis.yml | 10 ---- project.clj | 18 +++++++- 3 files changed, 108 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d22b7a56 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,91 @@ +--- +name: Run tests + +on: + push: + branches: [master, "1.1.x"] + pull_request: + branches: [master, "1.1.x"] + +env: + ACTIONS_CACHE_VERSION: 0 + +jobs: + test: + strategy: + matrix: + jdk: [8, 11, 17, 21] + + name: Java ${{ matrix.jdk }} + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup Java ${{ matrix.jdk }} + uses: actions/setup-java@v3.11.0 + with: + distribution: temurin + java-version: ${{ matrix.jdk }} + - name: Maven Cache + id: maven-cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + ~/.gitlibs + key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }} + restore-keys: | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}- + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}- + - name: Setup Clojure + uses: DeLaGuardo/setup-clojure@master + with: + lein: latest + - name: Run tests + run: lein do clean, all midje, all check + deploy: + concurrency: deploy + needs: test + if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/1.1.x') }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Maven Cache + id: maven-cache + uses: actions/cache@v3 + with: + path: | + ~/.m2/repository + ~/.gitlibs + key: m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}-${{ matrix.jdk }} + restore-keys: | + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}-${{ hashFiles('project.clj') }}- + m2-cache-${{ env.ACTIONS_CACHE_VERSION }}- + - name: Prepare java + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: '11' + - name: deploy + env: + CLOJARS_USER: ${{ secrets.CLOJARS_USER }} + CLOJARS_TOKEN: ${{ secrets.CLOJARS_TOKEN }} + COMMIT_MSG: ${{ github.event.head_commit.message }} + run: | + if [[ "$COMMIT_MSG" == "Release :major" ]]; then + lein release :major + elif [[ "$COMMIT_MSG" == "Release :minor" ]]; then + lein release :minor + elif [[ "$COMMIT_MSG" == "Release :patch" ]]; then + lein release :patch + elif [[ "$COMMIT_MSG" == "Release :alpha" ]]; then + lein release :alpha + elif [[ "$COMMIT_MSG" == "Release :beta" ]]; then + lein release :beta + elif [[ "$COMMIT_MSG" == "Release :rc" ]]; then + lein release :rc + else + lein deploy snapshot + fi diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 245e4177..00000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -sudo: false -language: clojure -lein: 2.9.1 -script: lein do clean, all midje, all check -jdk: - - openjdk8 - - openjdk11 -cache: - directories: - - $HOME/.m2 diff --git a/project.clj b/project.clj index 75fd0431..881abd6b 100644 --- a/project.clj +++ b/project.clj @@ -70,7 +70,23 @@ :target "gh-pages/doc" :src-uri "http://github.com/metosin/compojure-api/blob/master/" :src-uri-prefix "#L"} - :deploy-repositories [["releases" :clojars]] + :deploy-repositories [["snapshot" {:url "https://clojars.org/repo" + :username [:gpg :env/clojars_user] + :password [:gpg :env/clojars_token] + :sign-releases false}] + ["releases" {:url "https://clojars.org/repo" + :username [:gpg :env/clojars_user] + :password [:gpg :env/clojars_token] + :sign-releases false}]] + :release-tasks [["clean"] + ["vcs" "assert-committed"] + ["change" "version" "leiningen.release/bump-version" "release"] + ["vcs" "commit"] + ["vcs" "tag" "--no-sign"] + ["deploy" "release"] + ["change" "version" "leiningen.release/bump-version"] + ["vcs" "commit"] + ["vcs" "push"]] :aliases {"all" ["with-profile" "dev:dev,async"] "start-thingie" ["run"] "aot-uberjar" ["with-profile" "uberjar" "do" "clean," "ring" "uberjar"]