GitHub Action Workflows
I set up GitHub Action for my Static Site Generator (SSG). Actions themselves are individual jobs that can be combined together in a workflow to create a complex pipeline that handles our needs in the development life cycle. These workflow files can then be configured in YAML and triggered to run on specific events such as each time someone pushes code to the main branch.
yaml file means that it is triggered every time a push or a pull request is made to the
mainbranch. I then have the jobs keyword which state the name of all the different jobs I would like to run. In this case I start off by stating build_and_test. The first thing I then declare is in what OS environment this job should run: ubuntu-latest.
Under steps a sequence of steps is declared.
actions/checkout@v2: I give my job access to the code in my repository
actions/setup-java@v2: set up a Java environment that the job can run in. I also use the with keyword to tell setup-java to use a specific version of the JDK, which in this case is JDK-11.
mvn package -DskipTest: install all dependencies and skiptests
mvn com.coveo:fmt-maven-plugin-format:fmt: Run Formatter ( I need to configure the plugin in
pom.xmlto run this
mvn testRun all the tests
name: Maven CI/CD
branches: [ main ]
branches: [ main ]
- uses: actions/checkout@v2
- name: Set up JDK 11
- name: Install dependencies
run: mvn package -DskipTests
- name: Build with Maven
run: mvn --batch-mode --update-snapshots verify
- name: Run Formatter
run: mvn com.coveo:fmt-maven-plugin:format
- name: Test
run: mvn test
Add Test to partner Repo
I pick Minsu Kim‘s repo to write some more unit tests on his/ her project. Though the project is written in C#, I still want to give it a try because I’m curious if C#’s testing methods are similar to java.
I created 04 unit tests to test an interface and one class
After testing successfully in my local machine, I made a pull request
My 04 tests pass his/her CI/CD and then got merged into her/his project.