ci: Update to deno 2 #391
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: CI | |
on: | |
push: | |
paths: | |
- "assets/**" | |
- "src/**" | |
- "tests/**" | |
- "dev/**" | |
- ".github/workflows/*" | |
- "deno.lock" | |
workflow_dispatch: | |
env: | |
denoVersion: "v2.0.0" | |
DENO_DIR: deno | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | |
uses: dhardtke/prandium/.github/actions/setup@main | |
with: | |
denoVersion: ${{ env.denoVersion }} | |
cacheVersion: ${{ secrets.CACHE_VERSION }} | |
denoDir: ${{ env.DENO_DIR }} | |
- name: Format | |
run: deno task fmt:check | |
- name: Lint | |
run: deno task lint | |
test: | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- name: Setup | |
uses: dhardtke/prandium/.github/actions/setup@main | |
with: | |
denoVersion: ${{ env.denoVersion }} | |
cacheVersion: ${{ secrets.CACHE_VERSION }} | |
denoDir: ${{ env.DENO_DIR }} | |
- name: Run tests | |
run: deno task test:coverage -- `find src/ -name '*.ts' | xargs echo` tests/ | |
- name: Generate lcov | |
run: deno task coverage | |
- name: Upload coverage | |
uses: codecov/codecov-action@v3 | |
with: | |
files: out/coverage.lcov | |
token: ${{ secrets.CODECOV_TOKEN }} | |
fail_ci_if_error: true | |
verbose: true | |
build: | |
needs: [ lint, test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | |
uses: dhardtke/prandium/.github/actions/setup@main | |
with: | |
denoVersion: ${{ env.denoVersion }} | |
cacheVersion: ${{ secrets.CACHE_VERSION }} | |
denoDir: ${{ env.DENO_DIR }} | |
- name: Setup build tools | |
run: | | |
sudo apt-get install -y brotli gzip nodejs | |
npm install -g esbuild @parcel/css-cli sass | |
echo sass version | |
sass --version | |
echo esbuild version | |
esbuild --version | |
# echo parcel-css version | |
# parcel-css --version | |
echo gzip version | |
gzip --version | |
echo brotli version | |
brotli --version | |
- name: Build | |
run: deno task build | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: prandium | |
path: out/ | |
release: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Clone repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
persist-credentials: false | |
- name: Download artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: prandium | |
path: out/ | |
- name: Remove non-minified files | |
run: | | |
cd out/ | |
rm server.js | |
cd ../assets/ | |
rm index.css* index.js | |
- name: Create release zip | |
run: | | |
cd out/ | |
zip -r prandium-${{github.ref_name}}.zip * ../docs/* ../README.md ../LICENSE | |
- name: Build Changelog | |
id: github_release | |
uses: mikepenz/release-changelog-builder-action@v1 | |
with: | |
configuration: .github/changelog-config.json | |
commitMode: true | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create GitHub Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: prandium-${{github.ref_name}}.zip | |
body: ${{steps.github_release.outputs.changelog}} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |