Skip to content

Commit

Permalink
Add GitHub actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Release-Candidate committed Apr 25, 2021
1 parent c2e2990 commit 434cbbd
Show file tree
Hide file tree
Showing 15 changed files with 1,170 additions and 57 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@
"commands": [
"altcover.visualizer"
]
},
"paket": {
"version": "5.257.0",
"commands": [
"paket"
]
},
"fake-cli": {
"version": "5.20.4",
"commands": [
"fake"
]
}
}
}
112 changes: 112 additions & 0 deletions .github/workflows/create_packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Roland Csaszar
#
# Project: Tzolkin
# File: create_packages.yml
#
################################################################################

name: Nuget Packages

on:
release:
types: [created]

push:
tags:
- "v*.*.*"

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
package:
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Cache pip
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-Tzolkin-pip-pipenv-${{ hashFiles('Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-Tzolkin-pip-pipenv
- name: Cache pipenv
uses: actions/cache@v2
with:
path: ~/.local/share/virtualenvs
key: ${{ runner.os }}-Tzolkin-pipenv-${{ hashFiles('Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-Tzolkin-pipenv-
- name: Setup pipenv
run: python -m pip install --upgrade pipenv

- name: Setup MkDocs
run: |
cd $GITHUB_WORKSPACE
python -m pipenv install --dev
- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- uses: olegtarasov/get-tag@v2.1
id: tagName
with:
tagRegex: "v(.*)"

- name: Build Package
run: |
cd $GITHUB_WORKSPACE
dotnet fake run ./build.fsx target Packages $GIT_TAG_NAME
- name: Generate Changelog
run: |
cd $GITHUB_WORKSPACE/scripts
./get_changelog.sh > ../first_changelog.md
- name: Release to GitHub
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: Version ${{ env.GIT_TAG_NAME }}
body_path: first_changelog.md
files: ./packages/*.nupkg
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

#- name: Release NuGet to GitHub
# uses: svenstaro/upload-release-action@v2
# if: startsWith(github.ref, 'refs/tags/')
# with:
# release_name: Version ${{ env.GIT_TAG_NAME }}
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# tag: ${{ github.ref }}
# file_glob: false
# asset_name: NuGet Package
# file: ./packages/Tzolkin.nupkg

- name: Upload
run: |
cd $GITHUB_WORKSPACE
dotnet nuget push ./packages/*.nupkg -k ${{ secrets.NUGET_PACKAGE }} -s https://api.nuget.org/v3/index.json
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Nuget Packages
path: ./packages/*
87 changes: 87 additions & 0 deletions .github/workflows/linux_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Roland Csaszar
#
# Project: Tzolkin
# File: linux_test.yml
#
################################################################################

name: Tests Ubuntu 20.04

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
workflow_run:
workflows: ["Nuget Packages"]
types: [completed]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
tests-coverage:
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
run: |
cd $GITHUB_WORKSPACE
dotnet fake run ./build.fsx target TestsCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_SECRET }}
files: ./test_results/coverage.xml
directory: ./coverage/reports/
# flags: unittest
env_vars: OS,PYTHON
name: Linux-Test-Src
fail_ci_if_error: false
path_to_write_report: ./coverage/codecov_report.txt
verbose: true

tests:
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
run: |
cd $GITHUB_WORKSPACE
dotnet fake run ./build.fsx target Tests
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Test Results
path: ./test_results/*.trx
87 changes: 87 additions & 0 deletions .github/workflows/osx_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Roland Csaszar
#
# Project: Tzolkin
# File: osx_test.yml
#
################################################################################

name: Tests Mac OS X latest

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
workflow_run:
workflows: ["Nuget Packages"]
types: [completed]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
tests-coverage:
runs-on: macos-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
run: |
cd $GITHUB_WORKSPACE
dotnet fake run ./build.fsx target TestsCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_SECRET }}
files: ./test_results/coverage.xml
directory: ./coverage/reports/
# flags: unittest
env_vars: OS,PYTHON
name: Linux-Test-Src
fail_ci_if_error: false
path_to_write_report: ./coverage/codecov_report.txt
verbose: true

tests:
runs-on: macos-latest

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
run: |
cd $GITHUB_WORKSPACE
dotnet fake run ./build.fsx target Tests
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Test Results
path: ./test_results/*.trx
86 changes: 86 additions & 0 deletions .github/workflows/windows_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# SPDX-License-Identifier: MIT
# Copyright (C) 2021 Roland Csaszar
#
# Project: Tzolkin
# File: windows_test.yml
#
################################################################################

name: Tests Windows 2019

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [main]
pull_request:
branches: [main]
workflow_run:
workflows: ["Nuget Packages"]
types: [completed]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
tests-coverage:
runs-on: windows-2019

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
shell: cmd
run: |
dotnet fake run .\build.fsx target TestsCoverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
if: ${{ always() }}
with:
token: ${{ secrets.CODECOV_SECRET }}
files: ./test_results/coverage.xml
directory: ./coverage/reports/
# flags: unittest
env_vars: OS,PYTHON
name: Windows-Test-Src
fail_ci_if_error: false
path_to_write_report: ./coverage/codecov_report.txt
verbose: true

tests:
runs-on: windows-2019

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Setup Tools
run: |
dotnet tool restore
dotnet paket restore
- name: Run Tests
run: |
dotnet fake run .\build.fsx target Tests
- uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: Test Results
path: ./test_results/*.trx

0 comments on commit 434cbbd

Please sign in to comment.