ci: update nix channel #104
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: Wambo Web Angular Build | |
# Triggers the workflow on push or pull request events for any branch in a repository. | |
on: [ push, pull_request, merge_group ] | |
jobs: | |
# Tests that "ng serve" / "npm start" works. | |
ng_serve: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 18.x | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install NPM Dependencies | |
run: npm ci | |
- name: Test `ng serve` | |
# Takes usually only 12 seconds but to prevent a flaky CI, I use a timeout of 60 secs | |
run: timeout 60 npm run start_ci | grep -q "Compiled successfully" | |
# Builds the web-app using NPM. | |
build_npm: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 18.x | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install NPM Dependencies | |
run: npm ci | |
- name: Run Unit-Tests | |
run: npm test | |
- name: Build Angular UI | |
run: npm run build_prod | |
- name: Upload Web-App | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-app | |
path: dist | |
# Builds the Docker image of the web app. | |
build_dockerimage: | |
runs-on: ubuntu-latest | |
needs: build_npm | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Web-App from Previous Stage | |
uses: actions/download-artifact@v3 | |
with: | |
name: web-app | |
- name: Move artifacts to expected directory | |
run: mkdir dist && mv wambo-web dist | |
- name: Build Docker Image | |
run: docker build -t phip1611/wambo-web . | |
# Builds the web-app as Nix flake. | |
build_nix: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: cachix/install-nix-action@v23 | |
with: | |
# This channel is only required to invoke "nix-shell". | |
# Everything inside that nix-shell will use a pinned version of | |
# nixpkgs. | |
nix_path: nixpkgs=channel:nixos-23.11 | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- run: nix build . | |
- run: test -f ./result/share/wambo-web/index.html | |
codestyle: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: | |
- 18.x | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install NPM Dependencies | |
run: npm ci | |
- name: Run ES Lint | |
run: npm run lint |