-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #368 from wakatime/feature/integration-tests
Add integration tests
- Loading branch information
Showing
11 changed files
with
538 additions
and
141 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,179 @@ | ||
name: "Unit Tests" | ||
name: "Tests" | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- "develop" | ||
- "master" | ||
on: push | ||
|
||
env: | ||
GO_VERSION: "1.16" | ||
TEST_VERSION: "v0.0.1-test" | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
name: Unit tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
- | ||
name: "Unit tests" | ||
run: make test | ||
- | ||
- | ||
name: "Linter" | ||
run: make lint | ||
- | ||
name: "Send coverage" | ||
uses: shogo82148/actions-goveralls@v1 | ||
with: | ||
path-to-profile: coverage.out | ||
|
||
|
||
test-integration: | ||
name: Integration tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
name: "Build binary" | ||
env: | ||
VERSION: ${{ env.TEST_VERSION }} | ||
run: make build-linux-amd64 | ||
- | ||
name: "Integration tests" | ||
run: make test-integration | ||
|
||
|
||
test-windows: | ||
name: Test Windows | ||
name: Unit tests windows | ||
runs-on: windows-latest | ||
steps: | ||
- | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
- | ||
name: "Unit tests" | ||
run: make test | ||
- | ||
name: "Linter" | ||
run: make lint | ||
|
||
test-integration-windows: | ||
name: Integration tests windows | ||
runs-on: windows-latest | ||
steps: | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
name: "Build binary" | ||
env: | ||
VERSION: ${{ env.TEST_VERSION }} | ||
run: make build-windows-amd64 | ||
- | ||
name: "Integration tests" | ||
run: make test-integration | ||
|
||
test-macos: | ||
name: Unit tests macos | ||
runs-on: macos-latest | ||
steps: | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
name: "Unit tests" | ||
run: make test | ||
|
||
test-integration-macos: | ||
name: Integration tests macos | ||
runs-on: macos-latest | ||
steps: | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
- | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
- | ||
name: "Pull dependencies" | ||
run: go mod vendor | ||
- | ||
name: "Build binary" | ||
env: | ||
VERSION: ${{ env.TEST_VERSION }} | ||
run: make build-darwin-amd64 | ||
- | ||
name: "Integration tests" | ||
run: make test-integration | ||
|
||
release: | ||
name: Release | ||
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop' }} | ||
runs-on: ubuntu-latest | ||
needs: [test, test-integration, test-windows, test-integration-windows, test-macos, test-integration-macos] | ||
steps: | ||
- | ||
name: "Checkout" | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: "Calculate semver tag" | ||
id: semver-tag | ||
uses: wakatime/[email protected] | ||
with: | ||
prerelease_id: "alpha" | ||
- | ||
name: Changelog | ||
uses: gandarez/[email protected] | ||
id: changelog | ||
with: | ||
current_tag: ${{ github.sha }} | ||
previous_tag: ${{ steps.semver-tag.outputs.ancestor_tag }} | ||
exclude: | | ||
^Merge pull request .* | ||
- | ||
name: "Create release" | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.semver-tag.outputs.semver_tag }} | ||
tag_name: ${{ steps.semver-tag.outputs.semver_tag }} | ||
body: ${{ steps.changelog.outputs.changelog }} | ||
prerelease: ${{ steps.semver-tag.outputs.is_prerelease }} | ||
env: | ||
# PAT is mandatory here to trigger new workflows | ||
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow | ||
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.