Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GH Actions instead of Azure Pipelines and prepare CI to run Unit tests on Windows #512

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 80 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: build-test

on:
push:
branches: [ '*' ]
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'CODE_OF_CONDUCT.md'
- 'CONTRIBUTING.md'
- 'LICENSE'
pull_request:
branches: [ 'cli3' ]

jobs:
build:
runs-on: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- 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@v3
with:
name: artifacts
path: |
build/libs/crowdin-cli-*.jar
build/libs/crowdin_completion

test:
needs: build
strategy:
matrix:
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run Tests
run: ./gradlew test

- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: Test results ${{ matrix.os }}
path: build/test-results/test/*.xml
reporter: java-junit

- name: Generate code coverage report
run: ./gradlew build jacocoTestReport

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
93 changes: 41 additions & 52 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,55 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
name: "CodeQL"

on:
push:
branches: [cli3]
pull_request:
# The branches below must be a subset of the branches above
branches: [cli3]
schedule:
- cron: '0 8 * * 0'
- cron: '0 8 * * 0' # https://crontab.guru/#0_8_*_*_0
workflow_dispatch:

jobs:
analyze:
name: Analyze
codeql:
name: CodeQL Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
# Override automatic language detection by changing the below list
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
language: ['java']
# Learn more...
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
- uses: actions/checkout@v3

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: java

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:java"

#- run: |
# make bootstrap
# make release
static-analysis:
name: Static Analysis
runs-on: ubuntu-latest

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 8
cache: 'gradle'
- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Run static analysis
run: ./gradlew build staticAnalysis -P staticAnalysisMarker

- uses: actions/upload-artifact@v3
with:
name: staticAnalysis
path: |
build/reports/staticAnalysis
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,14 @@ This is a cross-platform and it runs in a terminal on Linux based and macOS oper
[**`Configuration File`**](https://developer.crowdin.com/configuration-file/) |
[**`Wiki`**](https://github.com/crowdin/crowdin-cli/wiki)

[![Build Status](https://dev.azure.com/crowdin/crowdin-cli-3/_apis/build/status/Build%20and%20Test?branchName=cli3)](https://dev.azure.com/crowdin/crowdin-cli-3/_build/latest?definitionId=22&branchName=cli3&cacheSeconds=1000)
[![build-test](https://github.com/crowdin/crowdin-cli/actions/workflows/build-test.yml/badge.svg?branch=cli3)](https://github.com/crowdin/crowdin-cli/actions/workflows/build-test.yml)
[![codecov](https://codecov.io/gh/crowdin/crowdin-cli/branch/cli3/graph/badge.svg)](https://codecov.io/gh/crowdin/crowdin-cli)
[![Docker Pulls](https://img.shields.io/docker/pulls/crowdin/cli?logo=docker&cacheSeconds=2000)](https://hub.docker.com/r/crowdin/cli)
[![npm](https://img.shields.io/npm/dt/@crowdin/cli?logo=npm&cacheSeconds=2000)](https://www.npmjs.com/package/@crowdin/cli)
[![homebrew downloads](https://img.shields.io/homebrew/installs/dy/crowdin?logo=homebrew)](https://formulae.brew.sh/formula/crowdin)
[![GitHub contributors](https://img.shields.io/github/contributors/crowdin/crowdin-cli?cacheSeconds=1000)](https://github.com/crowdin/crowdin-cli/graphs/contributors)
![GitHub](https://img.shields.io/github/license/crowdin/crowdin-cli?cacheSeconds=50000)

![Azure DevOps tests (branch)](https://img.shields.io/azure-devops/tests/crowdin/crowdin-cli-3/22/cli3?cacheSeconds=2000)
[![codecov](https://codecov.io/gh/crowdin/crowdin-cli/branch/cli3/graph/badge.svg)](https://codecov.io/gh/crowdin/crowdin-cli)

</div>

## Table of Contents
Expand Down
75 changes: 0 additions & 75 deletions azure-pipelines.yml

This file was deleted.