Create a ci for the front

This commit is contained in:
Zoe Roux 2023-01-07 17:28:20 +09:00
parent 6a098b6317
commit 01eae3f680
8 changed files with 164 additions and 15 deletions

View File

@ -1,15 +1,43 @@
name: CodingStyle
name: Coding Style
on: [pull_request, workflow_dispatch]
jobs:
build:
name: "Coding style check"
back:
name: "Lint Back"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Build the app
run: cd back && dotnet build -p:CheckCodingStyle=true -p:TreatWarningsAsErrors=true '-p:SkipTranscoder=true'
front:
name: "Lint Front"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./front
steps:
- uses: actions/checkout@v1
- name: Find yarn cache
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Lint
run: yarn lint

View File

@ -19,7 +19,7 @@ jobs:
- context: ./front
label: front
image: ghcr.io/${{github.repository_owner}}/kyoo_front
name: Docker build ${{matrix.label}}
name: Build ${{matrix.label}}
steps:
- uses: actions/checkout@v2
with:

View File

@ -7,7 +7,7 @@ on:
jobs:
Building:
runs-on: [ubuntu-latest]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: nikeee/docfx-action@v1.0.0

70
.github/workflows/native-build.yml vendored Normal file
View File

@ -0,0 +1,70 @@
name: Native build
on: push
jobs:
update:
name: Expo Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./front
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
- name: Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Build Mobile Release
run: yarn build:mobile --release-channel=build | tee log.txt
- name: Parse Asset URL
id: url
run: |
ASSET_URL=$(grep -eo 'https?://expo\.io/artifacts/[^ ]+' log.txt)
echo The android url is $ASSET_URL
echo "::set-output name=assetUrl::$ASSET_URL"
- name: Download APK Asset
run: wget -O kyoo.apk ${{ steps.url.outputs.assetUrl }}
- uses: actions/upload-artifact@v2
with:
name: kyoo.apk
path: ./front/kyoo.apk
- name: Upload Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./example-${{ env.GITHUB_REF_SLUG }}.apk
asset_name: example-${{ env.GITHUB_REF_SLUG }}.apk
tag: ${{ github.ref }

50
.github/workflows/native-update.yml vendored Normal file
View File

@ -0,0 +1,50 @@
name: Native update
on: push
jobs:
update:
name: Expo Update
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./front
steps:
- name: Check for EXPO_TOKEN
run: |
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
exit 1
fi
- name: Checkout repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: yarn
- name: Setup Expo
uses: expo/expo-github-action@v7
with:
expo-version: latest
eas-version: latest
token: ${{ secrets.EXPO_TOKEN }}
- name: Find yarn cache
id: yarn-cache-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Restore cache
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --immutable
- name: Publish update
run: yarn update

View File

@ -20,17 +20,16 @@ jobs:
repo-token: ${{secrets.GITHUB_TOKEN}}
running-workflow-name: release
allowed-conclusions: success,skipped,cancelled,neutral
# - name: Public the abstractions to nuget
# id: publish_nuget
# uses: rohith/publish-nuget@v2
# with:
# PROJECT_FILE_PATH: Kyoo.Abstractions/Kyoo.Abstractions.csproj
# PACKAGE_NAME: Kyoo.Abstractions
# VERSION_REGEX: ^\s*<PackageVersion>(.*)<\/PackageVersion>\s*$
# NUGET_KEY: ${{secrets.NUGET_API_KEY}}
# INCLUDE_SYMBOLS: true
- name: Download artifacts
uses: dawidd6/action-download-artifact@v2
with:
commit: ${{env.COMMIT_SHA}}
workflow: native-build.yml
path: ./artifacts
github_token: ${{secrets.GITHUB_TOKEN}}
- name: Create Release
uses: ncipollo/release-action@v1
with:
generateReleaseNotes: true
artifacts: ./artifacts/**/*
token: ${{secrets.GITHUB_TOKEN}}

View File

@ -8,7 +8,8 @@
"ios": "expo start --ios",
"web": "expo start --web",
"build": "eas build --profile production --platform android",
"build:dev": "eas build --profile development --platform android"
"build:dev": "eas build --profile development --platform android",
"update": "eas update --auto"
},
"dependencies": {
"@expo-google-fonts/poppins": "^0.2.2",

View File

@ -8,6 +8,7 @@
"build:web": "yarn workspace web build",
"build:mobile": "yarn workspace mobile build",
"build:mobile:dev": "yarn workspace mobile build:dev",
"update": "yarn workspace mobile update",
"lint": "eslint ."
},
"workspaces": [