workflow: only deploy if tests pass

main
daniel-michel 2023-11-17 15:25:41 +01:00
parent 74260ea1b8
commit 549f1ac827
3 changed files with 53 additions and 38 deletions

View File

@ -7,6 +7,24 @@ on:
workflow_dispatch:
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.x'
- name: Get dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Run tests
run: flutter test
build-linux:
name: Build for Linux
runs-on: ubuntu-latest
@ -53,13 +71,9 @@ jobs:
build/app/outputs/flutter-apk/app-release.apk
build/app/outputs/bundle/release/app-release.aab
build-and-publish-web:
name: Build and Publish for Web
build-web:
name: Build for Web
runs-on: ubuntu-latest
permissions:
contents: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
@ -69,8 +83,35 @@ jobs:
- run: flutter config --enable-web
- run: flutter pub get
- run: flutter build web --base-href "/release_schedule/"
- name: Publish to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
- name: Archive Web Artifact
uses: actions/upload-artifact@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/web
name: web-build
path: build/web
deploy-web:
name: Deploy Web to GitHub Pages
concurrency:
group: "pages"
cancel-in-progress: false
needs:
- test
- build-web
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
with:
artifact_name: web-build

View File

@ -1,26 +0,0 @@
name: Test
on:
push:
branches:
- main
workflow_dispatch:
jobs:
tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
flutter-version: '3.x'
- name: Get dependencies
run: flutter pub get
- name: Analyze
run: flutter analyze
- name: Run tests
run: flutter test

View File

@ -4,7 +4,7 @@ A small app using the Wikidata API to show upcoming movies.
You can try out the live web version at [daniel-michel.github.io/release_schedule](https://daniel-michel.github.io/release_schedule).
Android and Linux builds can be found in the latest [build run](https://github.com/daniel-michel/release_schedule/actions/workflows/build.yml).
Android, Linux and Web builds can be found in the latest [CI run](https://github.com/daniel-michel/release_schedule/actions/workflows/ci.yml).
Currently, only a simple list of upcoming movies is shown:
@ -35,6 +35,6 @@ LIMIT $limit
```
Where `$limit` is the maximum number of movies that are retrieved and `$date` the starting date from which movies are retrieved.
`$limit` is currently set to 100 and `$date` one week before the current one.
However, because there are multiple publication dates for most movies, the retrieved movies just need to have one publication date that is on or after `$date` for the movie to be included in the result. The `minReleaseDate` is not necessarily the release date displayed in the App, therefore some movies in the App might show up as having been released a long time ago.
However, because there are multiple publication dates for most movies, the retrieved movies just need to have one publication date that is on or after `$date` for the movie to be included in the result. The `minReleaseDate` is not necessarily the release date displayed in the app, therefore some movies in the app might show up as having been released a long time ago.
To get additional information about the movies and all release dates (in case some are before `$date` and some after) the API endpoint "https://www.wikidata.org/w/api.php?action=wbgetentities" is used.