Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test #16

Closed
wants to merge 3 commits into from
Closed

test #16

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 14 additions & 38 deletions .github/workflows/opendata-ci.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,42 @@
name: Open Data CI
on:
push:
branches:
- dev
paths:
- 'src/open-data/**/*.{csv,json}'
pull_request:
branches:
- dev
paths:
- 'src/open-data/**/*.{csv,json}'
- 'src/open-data/**/*.csv'
- 'src/open-data/**/*.json'
jobs:
build:
runs-on: ubuntu-latest
env:
CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} Continuous Integration
CI_COMMIT_MESSAGE: Open Data CI Commit
CI_COMMIT_AUTHOR: ${{ github.event.repository.name }} CI
steps:

# Checkout that works with "push" and "pull_request" trigger event
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.WORKFLOW_GIT_ACCESS_TOKEN }}

# Set environment variables based on the last commit
- name: Set environment variable "commit-message"
run: echo "commit-message=$(git log -1 --pretty=format:'%s')" >> $GITHUB_ENV
- name: Display environment variable "commit-message"
run: echo "commit-message=${{ env.commit-message }}"

- name: Set environment variable "commit-author"
run: echo "commit-author=$(git log -1 --pretty=format:'%an')" >> $GITHUB_ENV
- name: Display environment variable "commit-author"
run: echo "commit-author=${{ env.commit-author }}"

- name: Set environment variable "is-auto-commit"
if: env.commit-message == env.CI_COMMIT_MESSAGE && env.commit-author == env.CI_COMMIT_AUTHOR
run: echo "is-auto-commit=true" >> $GITHUB_ENV
- name: Display environment variable "is-auto-commit"
run: echo "is-auto-commit=${{ env.is-auto-commit }}"

# Build
- name: Build Open Data
if: env.is-auto-commit == false
shell: pwsh
run: |
src/scripts/Build-OpenData.ps1 -PowerShell

# Commit generated and commit files
- name: Display event name
run: echo "github.event_name=${{ github.event_name }}"
- name: Commit build artifacts (dist, devdist, docs, coverage)
# Don't run again on already pushed auto commit. Don't run on pull request events.
if: env.is-auto-commit == false && github.event_name != 'pull_request'
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
- name: Open Data Unit Testing
if: env.is-auto-commit == true
src/scripts/Build-OpenData.ps1 -PowerShell
if (git status --porcelain)
{
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}"
git push
}
- name: Test Open Data
shell: pwsh
run: |
src/scripts/Get-OpenData.ps1 -Test
src/scripts/Build-OpenData.ps1 -Test
3 changes: 2 additions & 1 deletion src/open-data/Regions.csv
Original file line number Diff line number Diff line change
Expand Up @@ -477,4 +477,5 @@ yt,canadacentral,Canada Central
za north,southafricanorth,South Africa North
za west,southafricawest,South Africa West
zanorth,southafricanorth,South Africa North
zawest,southafricawest,South Africa West
zawest,southafricawest,South Africa West
test,test,test
1 change: 1 addition & 0 deletions src/open-data/test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test
1 change: 1 addition & 0 deletions src/powershell/Private/Get-OpenDataRegion.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -484,5 +484,6 @@ function Get-OpenDataRegion
,[PSCustomObject]@{ OriginalValue = 'za west'; RegionId = 'southafricawest'; RegionName = 'South Africa West'; }
,[PSCustomObject]@{ OriginalValue = 'zanorth'; RegionId = 'southafricanorth'; RegionName = 'South Africa North'; }
,[PSCustomObject]@{ OriginalValue = 'zawest'; RegionId = 'southafricawest'; RegionName = 'South Africa West'; }
,[PSCustomObject]@{ OriginalValue = 'test'; RegionId = 'test'; RegionName = 'test'; }
)
}
Loading
Loading