feat: app commands #1148
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: Build and Test | |
on: | |
push: | |
branches: [ '*' ] | |
paths-ignore: | |
- 'README.md' | |
- 'CHANGELOG.md' | |
- 'CODE_OF_CONDUCT.md' | |
- 'CONTRIBUTING.md' | |
- 'LICENSE' | |
pull_request: | |
branches: [ 'main' ] | |
jobs: | |
build: | |
runs-on: [ ubuntu-latest ] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: 'gradle' | |
- name: Execute Gradle build | |
run: ./gradlew build | |
- name: Build executable jar file | |
run: ./gradlew shadowJar | |
- name: Generate autocomplete script | |
run: | | |
cd build/libs | |
java -cp crowdin-cli-*.jar picocli.AutoComplete com.crowdin.cli.commands.picocli.RootCommand | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: | | |
build/libs/crowdin-cli-*.jar | |
build/libs/crowdin_completion | |
test: | |
needs: build | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, windows-latest] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: 'gradle' | |
- name: Run Tests | |
run: ./gradlew test | |
- name: Test Report | |
uses: dorny/test-reporter@v1 | |
if: ${{ (success() || failure()) && github.ref == 'refs/heads/main' }} | |
with: | |
name: Test results ${{ matrix.os }} | |
path: build/test-results/test/*.xml | |
reporter: java-junit | |
- name: Generate code coverage report | |
if: matrix.os == 'ubuntu-latest' | |
run: ./gradlew build jacocoTestReport | |
- name: Upload coverage to Codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
docs-test: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
cache: 'npm' | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: 'gradle' | |
- name: Install asciidoctor and pandoc | |
run: | | |
sudo apt install -y asciidoctor | |
wget https://github.com/jgm/pandoc/releases/download/3.1.2/pandoc-3.1.2-1-amd64.deb | |
sudo dpkg -i pandoc-3.1.2-1-amd64.deb | |
- name: Generate Docs | |
run: | | |
chmod +x prepare-docs.sh | |
./prepare-docs.sh | |
shell: bash | |
- name: Install dependencies | |
working-directory: website | |
run: npm ci | |
- name: Build Website | |
working-directory: website | |
run: npm run build | |
publish-test: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
cache: 'gradle' | |
- name: Prepare distribution | |
run: | | |
./gradlew shadowJar | |
mkdir dist | |
mv build/libs/crowdin-cli-*.jar dist/crowdin-cli.jar | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install the latest version of the npm CLI | |
run: npm install -g npm@latest | |
- name: Build and install the package | |
run: | | |
sudo npm install --location=global [email protected] | |
npm install | |
jdeploy install | |
- name: Test crowdin command | |
run: crowdin -V | |
build-exe: | |
runs-on: windows-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: artifacts | |
- name: Prepare distribution | |
run: mkdir dist && mv crowdin-cli-*.jar dist/crowdin-cli.jar | |
- name: Compile .ISS to .EXE Installer | |
uses: Minionguyjpro/[email protected] | |
with: | |
path: packages/exe/CrowdinCLIInstaller.iss | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: exe-package | |
path: crowdin.exe |