Skip to content

Merge pull request #125 from greymistcube/refactor/remove-incomplete-… #318

Merge pull request #125 from greymistcube/refactor/remove-incomplete-…

Merge pull request #125 from greymistcube/refactor/remove-incomplete-… #318

Workflow file for this run

name: build
on:
push: []
pull_request: []
jobs:
build_and_test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- run: dotnet build
- run: dotnet test
- run: LANG=ar_SA.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- run: LANG=he_IL.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- run: LANG=fr_FR.UTF8 LANGUAGE="$LANG" LC_ALL="$LANG" dotnet test
- name: benchmarks
run: |
export BENCODEX_BENCHMARKS_DATA_DIR="$(mktemp -d)"
tar xvfJ \
Bencodex.Benchmarks/bencodex-data.tar.xz \
-C "$BENCODEX_BENCHMARKS_DATA_DIR"
dotnet run -c Release -p Bencodex.Benchmarks
env:
BENCODEX_BENCHMARKS_SIMPLE: true
deploy:
needs: build_and_test
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '6.0.x'
- name: bulid
run: |
timestamp="$(jq -r \
".head_commit.timestamp // .pull_request.head.repo.pushed_at" \
"$GITHUB_EVENT_PATH" \
)"
if [[ "$timestamp" = "null" || "$timestamp" = "" ]]; then
{
echo "Failed to get the head commit's timestamp:"
echo
cat "$GITHUB_EVENT_PATH"
} > /dev/stderr
exit 1
fi
timestamp=$(date --date="$timestamp" +%Y%m%d%H%M%S)
commit_hash="$(jq -r \
"(.head_commit.id // .pull_request.head.sha)[:8]" \
"$GITHUB_EVENT_PATH" \
)"
dotnet_args="-c Release -p:NoPackageAnalysis=true"
if [[ "$GITHUB_REF_TYPE" != tag ]]; then
project_suffix="dev.$timestamp+$commit_hash"
dotnet_args="$dotnet_args --version-suffix $project_suffix"
fi
dotnet build $dotnet_args
dotnet pack $dotnet_args
- name: push
if: github.event_name != 'pull_request'
run: |
if [[ "$NUGET_API_KEY" != "" ]]; then
dotnet nuget push ./Bencodex/bin/Release/Bencodex.*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json
dotnet nuget push ./Bencodex.Json/bin/Release/Bencodex.Json.*.nupkg \
--api-key "$NUGET_API_KEY" \
--source https://api.nuget.org/v3/index.json
fi
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}