Skip to content

Nix: Port to Devenv #256

Nix: Port to Devenv

Nix: Port to Devenv #256

Workflow file for this run

# This file lints the code, runs tests, builds a package and then deploys it.
# The following secrets need to be set:
# - “CLOUDSMITH_API_KEY” for pushing built package to Cloudsmith
name: CI
on:
pull_request:
push:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v25
- name: Set outputs
id: vars
run: |
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"
- name: Install dependencies
run: nix shell -c composer install --no-interaction
- name: Check code using Nette code checker
run: nix shell -c code-checker -d app
- name: Lint coding style
run: nix shell -c composer run-script cs
- name: Run static analysis
run: nix shell -c composer run-script phpstan
- name: Lint source code
run: nix shell -c composer run-script lint
- name: Run tests
run: |
cp .github/workflows/private.neon app/Config/private.neon
nix shell -c composer test
- name: Build a zipball
run: nix shell -c npm run dist "entries-${{ steps.vars.outputs.sha_short }}.zip"
- name: Upload the zipball to GitHub
uses: actions/upload-artifact@v4
with:
name: entries-${{ steps.vars.outputs.sha_short }}.zip
if-no-files-found: error
path: entries-${{ steps.vars.outputs.sha_short }}.zip
- name: Upload the zipball to Cloudsmith
uses: cloudsmith-io/[email protected]
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
with:
api-key: ${{ secrets.CLOUDSMITH_API_KEY }}
command: "push"
format: "raw"
owner: "entries-for-rogaining"
repo: "entries"
file: entries-${{ steps.vars.outputs.sha_short }}.zip
name: entries.zip
version: ${{ steps.vars.outputs.sha_short }}
extra: '--tags version:latest'