Skip to content

ci: upgrade actions #738

ci: upgrade actions

ci: upgrade actions #738

Workflow file for this run

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: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- 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: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v3
- 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: 8
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: 8
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 jdeploy@4.0.22
npm install
jdeploy install
- name: Test crowdin command
run: crowdin -V