diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 9b7b5df..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,181 +0,0 @@ -version: 2.1 - -executors: - default: - working_directory: ~/repo/maybe - docker: - - image: cimg/base:stable - environment: - TERM: dumb - resource_class: large - -commands: - install-jdk: - description: Install and setup the JDK environmnet - parameters: - major: - description: The JDK major version to use - type: string - default: "20" - version: - description: The JDK full version to use - type: string - default: "20.0.1" - - steps: - - run: - name: Get JDK SHA256 - command: | - mkdir ~/jdk - wget "https://download.oracle.com/java/<>/archive/jdk-<>_linux-x64_bin.tar.gz.sha256" -O ~/jdk/jdk-<>.sha256 - - - restore_cache: - key: v1-<>-{{ checksum "~/jdk/jdk-<>.sha256" }} - - - run: - name: Download JDK - command: | - if [ ! -f ~/jdk/jdk-<>.tar.gz ]; then - wget -nc https://download.oracle.com/java/<>/archive/jdk-<>_linux-x64_bin.tar.gz -O ~/jdk/jdk-<>.tar.gz - fi - - - run: - name: Install JDK - command: | - sudo tar xvf ~/jdk/jdk-<>.tar.gz -C ~/jdk/ - sudo mkdir /opt/jdk-<> - sudo mv ~/jdk/jdk-<>*/* /opt/jdk-<> - echo 'export JAVA_HOME=/opt/jdk-<>' >> $BASH_ENV - echo 'export PATH=$PATH:$JAVA_HOME/bin' >> $BASH_ENV - source $BASH_ENV - - - run: - name: Check Java version - command: | - echo $JAVA_HOME - java --version - - - save_cache: - paths: - - ~/jdk/jdk-<>.tar.gz - key: v1-<>-{{ checksum "~/jdk/jdk-<>.sha256" }} - - install-nodejs: - description: Install NodeJS and Yarn dependencies - - steps: - - run: - name: Install NodeJS - command: | - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash - echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV - echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" --install' >> $BASH_ENV - source $BASH_ENV - - - run: - name: Install yarn - command: npm install -g yarn - - - restore_cache: - keys: - - yarn-v1-{{ checksum "yarn.lock" }} - - - run: - name: Install packages - command: yarn install --immutable - - - save_cache: - paths: - - ~/repos/maybe/.yarn/cache - key: yarn-v1-{{ checksum "yarn.lock" }} - - setup: - description: Setup the environment to run tasks on CI - - steps: - - checkout: - path: ~/repo/maybe - - - run: - name: Provisioning - command: | - sed -i "s/{SIGNING_PASSWORD}/$SIGNING_PASSWORD/g" gradle.properties - sed -i "s/{SONATYPE_USERNAME_TOKEN}/$SONATYPE_USERNAME_TOKEN/g" gradle.properties - sed -i "s/{SONATYPE_PASSWORD_TOKEN}/$SONATYPE_PASSWORD_TOKEN/g" gradle.properties - - - restore_cache: - keys: - - v5-dependencies-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "buildscript-gradle.lockfile" }}-{{ checksum "gradle.lockfile" }} - - - run: - name: Dependencies - command: ./gradlew dependencies - - - save_cache: - paths: - - ~/repo/maybe/.gradle - - ~/.gradle - key: v5-dependencies-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}-{{ checksum "buildscript-gradle.lockfile" }}-{{ checksum "gradle.lockfile" }} - -jobs: - build: - executor: default - - steps: - - install-jdk - - - setup - - - run: - name: Compile - command: ./gradlew compileJava compileTestJava - - - run: - name: SonarLint - command: ./gradlew sonarlintMain sonarlintTest - - - run: - name: Checkstyle - command: ./gradlew checkstyleMain checkstyleTest - - - run: - name: Test - command: ./gradlew test - - - run: - name: Build - command: ./gradlew build - - - run: - name: Coverage - command: ./gradlew jacocoTestReport - - - run: - name: Upload reports - command: bash <(curl -s https://codecov.io/bash) - - publish: - executor: default - - steps: - - install-jdk - - - setup - - - install-nodejs - - - run: - name: Publish to Maven Central - command: yarn release - -workflows: - main: - jobs: - - build - - - publish: - requires: - - build - filters: - branches: - only: release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2f2ed09 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +--- +name: CI + +on: + push: + workflow_call: + +concurrency: + group: ci-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: oracle + java-version: 20 + check-latest: true + cache: gradle + - run: ./gradlew compileJava compileTestJava + - run: ./gradlew checkstyleMain checkstyleTest + - run: ./gradlew sonarlintMain sonarlintTest + - run: ./gradlew test + - run: ./gradlew build + - run: ./gradlew jacocoTestReport + - uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + verbose: true diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index 362af05..f9c3538 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -4,7 +4,6 @@ name: Pages on: workflow_call: workflow_dispatch: - permissions: contents: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..48ba3bd --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +--- +name: Release + +on: + workflow_dispatch: + +concurrency: + group: release + cancel-in-progress: true + +jobs: + build: + uses: ./.github/workflows/ci.yml + + deploy: + runs-on: ubuntu-latest + needs: build + + permissions: + contents: write + issues: write + pull-requests: write + id-token: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v3 + with: + distribution: oracle + java-version: 20 + check-latest: true + cache: gradle + - uses: actions/setup-node@v3 + with: + node-version-file: .nvmrc + cache: yarn + - name: Provision + run: | + sed -i "s/{SIGNING_PASSWORD}/${{ secrets.SIGNING_PASSWORD }}/g" gradle.properties + sed -i "s/{SONATYPE_USERNAME_TOKEN}/${{ secrets.SONATYPE_USERNAME_TOKEN }}/g" gradle.properties + sed -i "s/{SONATYPE_PASSWORD_TOKEN}/${{ secrets.SONATYPE_PASSWORD_TOKEN }}/g" gradle.properties + - run: ./gradlew build + - run: yarn install --immutable + - run: yarn release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + pages: + uses: ./.github/workflows/pages.yml + needs: deploy diff --git a/.releaserc.json b/.releaserc.json index 6872708..e3839c9 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,6 +1,6 @@ { "$schema": "https://json.schemastore.org/semantic-release", - "branches": ["release"], + "branches": ["main"], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", diff --git a/.circleci/codecov.yml b/codecov.yml similarity index 93% rename from .circleci/codecov.yml rename to codecov.yml index 1029ee3..d55ecd4 100644 --- a/.circleci/codecov.yml +++ b/codecov.yml @@ -1,9 +1,9 @@ -codecov: - require_ci_to_pass: true - -coverage: - status: - project: - default: - target: 90.0 - threshold: "0%" +codecov: + require_ci_to_pass: true + +coverage: + status: + project: + default: + target: 90.0 + threshold: "0%"