Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrace committed Jan 21, 2025
0 parents commit 28621fc
Show file tree
Hide file tree
Showing 35 changed files with 5,726 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
^renv$
^renv\.lock$
_*.new.png
4 changes: 4 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source("renv/activate.R")

# Install commit-hooks locally
statusWriteCommit <- file.copy(".hooks/pre-commit.R", ".git/hooks/pre-commit", overwrite = TRUE)
34 changes: 34 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Code of Conduct

As contributors and maintainers of this project, we pledge to follow the [Contributor Covenant](https://www.contributor-covenant.org/) in our interactions with others. We value an open and welcoming environment where everyone feels respected and heard.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

- Being respectful and considerate of differing viewpoints.
- Using welcoming and inclusive language.
- Focusing on what is best for the community.
- Showing empathy towards other community members.

Examples of unacceptable behavior include:

- Harassment, trolling, or derogatory comments.
- Personal attacks or insults.
- Any form of discrimination.

## Our Responsibilities

Project maintainers are responsible for clarifying and enforcing our standards of behavior. They have the right and responsibility to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and address any reported issues promptly.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/).
31 changes: 31 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
name: Bug report
about: Tell us about an issue you have found
title: ''
labels: bug
assignees: ''

---

## Description

<!-- Briefly describe the issue you encountered. -->

## Steps to Reproduce

<!--
* Describe the steps to reproduce the bug.
* Include any relevant code snippets or screenshots.
-->

## Expected Behavior

<!-- Describe what you expected to happen instead. -->

## Additional Information

<!-- Include any additional information you can, e.g.
- Operating System
- Browser (if applicable)
- URL you were visiting
-->
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
36 changes: 36 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

## Description

<!-- Briefly describe the feature you'd like to see. -->

## Use case

<!--
Explain the use case or scenario where this feature would be valuable.
Ideally through a user story, e.g.
As a ...
I want ...
So that ...
-->

## Why this is important

<!--
Describe how this issue affects you and others who may use the project.
What would happen if this issue wasn't resolved?
-->

## Additional Context

<!--
Any additional context or information related to the feature request.
Include any alternative approaches you've considered.
-->
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/other_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Other issue
about: Template for any other issues relating to this project
title: ''
labels: ''
assignees: ''

---

## Description

<!-- Briefly describe the issue you'd like to like to raise. -->

## Why this is important

<!--
Describe how this issue affects you and others who may use the project.
What would happen if this issue wasn't resolved?
-->
25 changes: 25 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
## Overview of changes

<!-- Briefly describe the purpose of this pull request. -->

<!-- Add any relevant screenshots or images, including before and after if possible. -->

<!-- If this PR is related to any existing issues, mention them here (e.g., "Resolves #123"). -->

## Why are these changes being made?

<!-- Explicitly state the reason for the pull request -->

## Checklist

<!-- Put 'x' in the checkboxes that you have completed to help your reviewer -->

- [ ] I have tested these changes locally using `shinytest2::test_app()`
- [ ] I have ran `styler::style_dir()`
- [ ] I have ran `lintr::lint_dir()`
- [ ] I have updated the documentation
- [ ] I have added or updated automated tests for these changes

## Reviewer instructions

<!-- Put any specific questions or instructions for reviewers in here -->
18 changes: 18 additions & 0 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Security Policy

## Reporting Security Issues

If you find a security vulnerability, please:

1. Avoid sharing the issue publicly until it is fixed.

2. [Report the vulnerability privately via GitHub](https://github.com/dfe-analytical-services/explore-education-statistics-analytics/security/advisories/new).
<!-- update the link above to relate to the repository it is used in -->

3. Include a description, steps to reproduce, and affected versions.

4. We will acknowledge your report as soon as practicable.

## Supported Versions

Only the latest stable release is actively maintained.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
44 changes: 44 additions & 0 deletions .github/workflows/dashboard-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
on:
push:
branches:
- main

pull_request:

name: Dashboard tests
permissions:
contents: read

jobs:
automatedTests:
runs-on: ubuntu-latest

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Install git2r dependencies
run: sudo apt-get install -y libgit2-dev

- name: Cache renv packages
id: cache-renv
uses: actions/cache@v4
with:
path: screener-renv-cache
key: ${{ runner.os }}-renv-${{ hashFiles('**/renv.lock') }}
restore-keys: |
${{ runner.os }}-renv-
- uses: r-lib/actions/setup-renv@v2

- name: Run tests
shell: Rscript {0}
run: |
shinytest2::test_app("analytics-dashboard")
56 changes: 56 additions & 0 deletions .github/workflows/lintr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '20 3 * * 0'

name: lintr

permissions:
contents: read

jobs:
lintr:
runs-on: ${{ matrix.config.os }}

name: Run lintr scanning

strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, r: 'release'}

permissions:
contents: read # for checkout to fetch code
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results

steps:
- name: Checkout code
uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: restore renv
uses: r-lib/actions/setup-renv@v2

- name: Install lintr
shell: Rscript {0}
run: |
renv::install("lintr")
- name: Run lintr
run: lintr::sarif_output(lintr::lint_dir("."), "lintr-results.sarif")
shell: Rscript {0}
continue-on-error: true

- name: Upload analysis results to GitHub
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: lintr-results.sarif
wait-for-processing: true
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# {shinytest2}: Ignore new debug snapshots for `$expect_values()`
*_.new.png
41 changes: 41 additions & 0 deletions .hooks/pre-commit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env Rscript
message("\nRunning commit hooks...")

message("\n")

message("1. Checking code styling...\n")
style_output <- eval(styler::style_dir()$changed)
if (any(style_output)) {
message("Warning: Code failed styling checks.
\n`styler::style_dir()` has been run for you.
\nPlease check your files and dashboard still work.
\nThen re-stage and try committing again.")
quit(save = "no", status = 1, runLast = FALSE)
} else {
message("...code styling checks passed")
}

message("\n")
message("\n2. Rebuilding manifest.json...")
if (system.file(package = "git2r") == "") {
renv::install("git2r")
}
if (system.file(package = "rsconnect") != "" & system.file(package = "git2r") != "") {
if (!any(grepl("manifest.json", git2r::status()))) {
rsconnect::writeManifest(paste0(getwd(), "/analytics-dashboard"))
git2r::add(path = "analytics-dashboard/manifest.json")
}
message("...manifest.json rebuilt\n")
} else {
if (system.file(package = "rsconnect") == "") {
message("rsconnect is not installed")
}
if (system.file(package = "git2r") == "") {
message("git2r is not installed")
}
message("...this step has been skipped")
}

message("\n")

# End of hooks
8 changes: 8 additions & 0 deletions .lintr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
linters: linters_with_defaults(
line_length_linter(120),
object_usage_linter = NULL
)
exclusions: list(
"adhoc-scripts/",
"data-updates/events-data.R"
)
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 DfE Analytical Services

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 28621fc

Please sign in to comment.