From c9aa9d3d637c2280e39f623d75f38a53578fa7db Mon Sep 17 00:00:00 2001 From: andrew-polk Date: Fri, 6 May 2022 11:42:18 -0500 Subject: [PATCH 1/7] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 8fe13dc..4492d47 100644 --- a/README.md +++ b/README.md @@ -35,3 +35,4 @@ Github action practice repository for Language Technology conference 2022 - https://github.com/sillsdev/Mercurial4Chorus/blob/master/.github/workflows/nuget-ci-cd.yml (builds Nuget package and publishes to Nuget using Secrets) - https://github.com/sillsdev/SpeechAnalyzer/blob/master/.github/workflows/msbuild.yml - https://github.com/sillsdev/SpeechAnalyzer/blob/master/.github/workflows/parse-langtags.yml + From 5995bdbe8ad5daa3434c98d2f7030b39f45fc774 Mon Sep 17 00:00:00 2001 From: andrew-polk Date: Fri, 6 May 2022 11:51:55 -0500 Subject: [PATCH 2/7] Create andrew-polk.yml --- .github/workflows/andrew-polk.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/andrew-polk.yml diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml new file mode 100644 index 0000000..6152f74 --- /dev/null +++ b/.github/workflows/andrew-polk.yml @@ -0,0 +1,31 @@ +# This is your hello Github Actions file + +name: Andrew + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events but only for the main branch + pull_request: + branches: [ main ] + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v3 + + # Run a single command using the runners shell + - name: Github json + run: echo '${{ toJSON(github) }}' +# Below you can see how a second job named test could be added that runs on windows and has its own steps +# test: +# runs-on: windows-latest +# +# steps: + From fd82466ede7100688c977467e49c50d9c39a3a74 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 9 May 2022 16:44:53 -0700 Subject: [PATCH 3/7] dotnet build --- .github/workflows/andrew-polk.yml | 10 +++++----- README.md | 6 ++++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml index 6152f74..a56cc10 100644 --- a/.github/workflows/andrew-polk.yml +++ b/.github/workflows/andrew-polk.yml @@ -6,7 +6,7 @@ name: Andrew on: # Triggers the workflow on push or pull request events but only for the main branch pull_request: - branches: [ main ] + branches: [main] # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -21,11 +21,11 @@ jobs: - uses: actions/checkout@v3 # Run a single command using the runners shell - - name: Github json - run: echo '${{ toJSON(github) }}' + - name: dotnet build + run: dotnet build TestReactProject # Below you can see how a second job named test could be added that runs on windows and has its own steps # test: # runs-on: windows-latest -# +# # steps: - + diff --git a/README.md b/README.md index 4492d47..5d4229a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ # gha-practice + Github action practice repository for Language Technology conference 2022 ## Setup + 1. Get Added as a contributor to this repository 1. Create a branch named after your github user (or anything you like that noone else is likely to use) 2. Do not look at the grading.yml until after the session if you can help it. @@ -12,6 +14,7 @@ Github action practice repository for Language Technology conference 2022 7. Observe how the action interacts with your PR ## Next steps - Pick from these choices, make it work, repeat + - Add a new step that runs dotnet build - Run unit tests - Add a new job @@ -19,7 +22,7 @@ Github action practice repository for Language Technology conference 2022 - Set an output variable from one step and use it in another https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idoutputs - Make your action get cancelled if you push while it is still running https://docs.github.com/en/actions/using-jobs/using-concurrency - Add a matrix and use it (build platform is an obvious use) https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs -- Publish artifacts from your GHA build +- Publish artifacts from your GHA build - Add conditions to a step https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution - Read the docs for basic understanding: https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions - Find an interesting Action on the marketplace and use it https://github.com/marketplace?type=actions @@ -35,4 +38,3 @@ Github action practice repository for Language Technology conference 2022 - https://github.com/sillsdev/Mercurial4Chorus/blob/master/.github/workflows/nuget-ci-cd.yml (builds Nuget package and publishes to Nuget using Secrets) - https://github.com/sillsdev/SpeechAnalyzer/blob/master/.github/workflows/msbuild.yml - https://github.com/sillsdev/SpeechAnalyzer/blob/master/.github/workflows/parse-langtags.yml - From 03af6d861c4a57c75c3ff0bf675f52ed7e40e5d7 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 9 May 2022 16:52:55 -0700 Subject: [PATCH 4/7] dotnet test --- .github/workflows/andrew-polk.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml index a56cc10..c04adf7 100644 --- a/.github/workflows/andrew-polk.yml +++ b/.github/workflows/andrew-polk.yml @@ -20,9 +20,10 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v3 - # Run a single command using the runners shell - - name: dotnet build + - name: Build run: dotnet build TestReactProject + - name: Test + run: dotnet test TestReactProject # Below you can see how a second job named test could be added that runs on windows and has its own steps # test: # runs-on: windows-latest From 7f4995b6b2e8e6d6244f0ffe5ba2162675086ec5 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 9 May 2022 16:56:19 -0700 Subject: [PATCH 5/7] environment variables --- .github/workflows/andrew-polk.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml index c04adf7..28e990e 100644 --- a/.github/workflows/andrew-polk.yml +++ b/.github/workflows/andrew-polk.yml @@ -24,6 +24,12 @@ jobs: run: dotnet build TestReactProject - name: Test run: dotnet test TestReactProject + + - name: Set Env Var + env: + My_Var: ABC + - name: Read Env Var + run: echo "$My_Var" # Below you can see how a second job named test could be added that runs on windows and has its own steps # test: # runs-on: windows-latest From 575e18e994a331780f996462edb54fd43c20606a Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 9 May 2022 17:01:32 -0700 Subject: [PATCH 6/7] set and read values --- .github/workflows/andrew-polk.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml index 28e990e..de8727a 100644 --- a/.github/workflows/andrew-polk.yml +++ b/.github/workflows/andrew-polk.yml @@ -30,6 +30,12 @@ jobs: My_Var: ABC - name: Read Env Var run: echo "$My_Var" + + - name: Set Value + run: echo '::set-output name=MY_COLOR::green' + id: color-setter + - name: Read Value + run: echo "my color is ${{ steps.color-setter.outputs.MY_COLOR }}" # Below you can see how a second job named test could be added that runs on windows and has its own steps # test: # runs-on: windows-latest From 7c63ae62fb1909aa22e04a12571a6cb46e1f43f3 Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Mon, 9 May 2022 17:06:40 -0700 Subject: [PATCH 7/7] fix action --- .github/workflows/andrew-polk.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/andrew-polk.yml b/.github/workflows/andrew-polk.yml index de8727a..57c12b4 100644 --- a/.github/workflows/andrew-polk.yml +++ b/.github/workflows/andrew-polk.yml @@ -26,6 +26,7 @@ jobs: run: dotnet test TestReactProject - name: Set Env Var + run: echo "setting env var" env: My_Var: ABC - name: Read Env Var