[524] migrate garmin authentication to oauth #185
Workflow file for this run
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
name: PR Check | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: [ master, v4-wip ] | |
jobs: | |
build-and-test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
dotnet: [ '6.0'] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK ${{ matrix.dotnet }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: Clean | |
run: dotnet clean --configuration Debug && dotnet nuget locals all --clear | |
- name: Restore | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Debug | |
- name: Test | |
run: dotnet test | |
compile-distro-console: | |
name: Compile Distro | |
runs-on: 'windows-latest' | |
needs: build-and-test | |
strategy: | |
max-parallel: 1 | |
matrix: | |
dotnet: [ '6.0' ] | |
os: [ 'win10-x64' ] | |
python-version: [ 3.9.6 ] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup .NET Core SDK ${{ matrix.dotnet }} | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: ${{ matrix.dotnet }} | |
- name: Clean | |
run: dotnet clean ${{ github.workspace }}/src/PelotonToGarminConsole/PelotonToGarminConsole.csproj --configuration Release && dotnet nuget locals all --clear | |
- name: Restore | |
run: dotnet restore ${{ github.workspace }}/src/PelotonToGarminConsole/PelotonToGarminConsole.csproj | |
- name: Prepare env | |
run: | | |
echo "BUILD_VERSION=$Env:GITHUB_RUN_NUMBER-$Env:GITHUB_RUN_ID" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
echo "RUNNER_TOOL_CACHE=$Env:RUNNER_TOOL_CACHE" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Publish ${{matrix.os}} | |
run: dotnet publish ${{ github.workspace }}/src/PelotonToGarminConsole/PelotonToGarminConsole.csproj --no-restore -c Release -r ${{ matrix.os }} -o ${{ github.workspace }}/dist/${{ matrix.os }} --version-suffix ${{ env.BUILD_VERSION }} --self-contained true | |
- name: Copy Config to Distro | |
run: cp ${{ github.workspace }}/configuration.example.json ${{ github.workspace }}/dist/${{ matrix.os }}/configuration.local.json | |
# Package all-in-one python and add to distro | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r ${{ github.workspace }}/python/requirements.txt | |
pip install pyinstaller | |
- name: Package Python - Windows | |
if: ${{ matrix.os == 'win10-x64' }} | |
working-directory: ${{ github.workspace }}/python | |
run: | | |
pyinstaller -n upload --distpath ${{ github.workspace }}/dist/${{ matrix.os }}/python/ --console --clean --onefile --noconfirm --add-data "${{ env.RUNNER_TOOL_CACHE }}/python/3.9.6/x64/lib/site-packages/cloudscraper;./cloudscraper" ${{ github.workspace }}/python/upload.py | |
# Create Build Artifact | |
- name: Upload Artifact ${{ matrix.os }}_${{ env.BUILD_VERSION }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.os }}_${{ env.BUILD_VERSION }} | |
path: ${{ github.workspace }}/dist/${{ matrix.os }} | |
create_docker_images: | |
name: Publish Docker Images - PR | |
runs-on: ubuntu-latest | |
needs: build-and-test | |
strategy: | |
matrix: | |
dockerfile: ['Dockerfile.console', 'Dockerfile.api', 'Dockerfile.webui'] | |
include: | |
- dockerfile: 'Dockerfile.console' | |
tag: 'pr-validator-console-A' | |
- dockerfile: 'Dockerfile.api' | |
tag: 'pr-validator-api-A' | |
- dockerfile: 'Dockerfile.webui' | |
tag: 'pr-validator-webui-A' | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GH_PACKAGE_SECRET }} | |
- name: Prepare env | |
run: | | |
echo "BUILD_VERSION=${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ID}" >> $GITHUB_ENV | |
- name: Build & Push to Package Repositories | |
id: docker_build | |
uses: docker/build-push-action@v3 | |
with: | |
push: true | |
file: ./docker/${{ matrix.dockerfile }} | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
build-args: VERSION=${{ env.BUILD_VERSION }} | |
tags: | | |
${{ secrets.DOCKER_USERNAME }}/peloton-to-garmin:${{ matrix.tag }} | |
ghcr.io/${{ github.repository_owner }}/peloton-to-garmin:${{ matrix.tag }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} |