Port to Devenv #261
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
# 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 | |
- uses: cachix/cachix-action@v14 | |
with: | |
name: devenv | |
- name: Set outputs | |
id: vars | |
run: | | |
echo "sha_short=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT" | |
- name: Install dependencies | |
run: nix develop -c composer install --no-interaction | |
- name: Check code using Nette code checker | |
run: nix develop -c code-checker -d app | |
- name: Lint coding style | |
run: nix develop -c composer run-script cs | |
- name: Run static analysis | |
run: nix develop -c composer run-script phpstan | |
- name: Lint source code | |
run: nix develop -c composer run-script lint | |
- name: Run tests | |
run: | | |
cp .github/workflows/private.neon app/Config/private.neon | |
nix develop -c composer test | |
- name: Build a zipball | |
run: nix develop -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' |