Skip to content

Commit

Permalink
Update the CI (#52)
Browse files Browse the repository at this point in the history
Use setup-go.
Use toitlang/action-setup.
Update the Toit version.
Update the gold files.
  • Loading branch information
floitsch authored Jul 3, 2024
1 parent 1be02ac commit 0dd4bc4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 47 deletions.
45 changes: 7 additions & 38 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,64 +20,33 @@ jobs:
id: constants
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
echo toit_archive=toit-linux.tar.gz >> $GITHUB_OUTPUT
echo 'toitvm=${{ github.workspace }}/toit/bin/toit.run' >> $GITHUB_OUTPUT
echo 'toitpkg=${{ github.workspace }}/build/toitpkg' >> $GITHUB_OUTPUT
elif [ "$RUNNER_OS" == "macOS" ]; then
echo toit_archive=toit-macos.tar.gz >> $GITHUB_OUTPUT
echo 'toitvm=${{ github.workspace }}/toit/bin/toit.run' >> $GITHUB_OUTPUT
echo 'toitpkg=${{ github.workspace }}/build/toitpkg' >> $GITHUB_OUTPUT
elif [ "$RUNNER_OS" == "Windows" ]; then
echo toit_archive=toit-windows.tar.gz >> $GITHUB_OUTPUT
echo 'toitvm=${{ github.workspace }}\toit\bin\toit.run.exe' >> $GITHUB_OUTPUT
echo 'toitpkg=${{ github.workspace }}\build\toitpkg.exe' >> $GITHUB_OUTPUT
else
echo "UNSUPPORTED RUNNER: $RUNNER_OS"
exit 1
fi
# Use Go 1.20
- name: Switch to Go 1.20
run:
echo "$GOROOT_1_20_X64"/bin >> $GITHUB_PATH

# Get values for cache paths to be used in later steps
- name: Get Go paths
shell: bash
id: go-cache-paths
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
# Cache go build cache, used to speedup go test
- name: Go Build Cache
uses: actions/cache@v3
uses: actions/setup-go@v5
with:
path: ${{ steps.go-cache-paths.outputs.go-build }}
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-build-
go-version: "1.20"

# Cache go mod cache, used to speedup builds
- name: Go Mod Cache
uses: actions/cache@v3
- name: Install Toit
id: toit
uses: toitlang/action-setup@v1
with:
path: ${{ steps.go-cache-paths.outputs.go-mod }}
key: ${{ runner.os }}-go-mod-${{ hashFiles('**/go.sum') }}
restore-keys: ${{ runner.os }}-go-mod-
toit-version: 'v2.0.0-alpha.158'

- name: Go dependencies
shell: bash
run: |
make go_dependencies
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Toit dependencies
id: toit
shell: bash
run: |
curl -O -L https://github.com/toitlang/toit/releases/download/v2.0.0-alpha.95/${{ steps.constants.outputs.toit_archive }}
tar x -f ${{ steps.constants.outputs.toit_archive }}
- name: Build
run: |
make
Expand All @@ -86,6 +55,6 @@ jobs:
- name: test
env:
TOITPKG_PATH: ${{ steps.constants.outputs.toitpkg }}
TOITVM_PATH: ${{ steps.constants.outputs.toitvm }}
TOITVM_PATH: ${{ steps.toit.outputs.toit-sdk-path }}/bin/toit
run: |
make test
2 changes: 1 addition & 1 deletion tests/assets/pkg/Download1/gold/fail.gold
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
::exec:: main.toit:7:7: error: Unresolved identifier: 'say-hello'
::exec:: bar.say-hello
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand Down
4 changes: 2 additions & 2 deletions tests/assets/pkg/GitPackage/gold/git package search.gold
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
::exec:: main.toit:8:7: error: Unresolved identifier: 'say-hello'
::exec:: bar.say-hello
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand Down Expand Up @@ -64,7 +64,7 @@ Info: Package '<GIT_URL>/bar_git@2.0.1' installed with name 'bar'
::exec:: main2.toit:8:7: error: Unresolved identifier: 'say-hello'
::exec:: bar.say-hello
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main2.toit
::analyze:: Exit Code: 1
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/pkg/Install1/gold/install.gold
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
::exec:: main.toit:6:7: error: Unresolved identifier: 'say-hello'
::exec:: pkg.say-hello
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand Down
2 changes: 1 addition & 1 deletion tests/assets/pkg/Install2/gold/test.gold
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
::exec:: main.toit:6:14: error: Unresolved identifier: 'identify'
::exec:: print pkg1.identify
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand Down
4 changes: 2 additions & 2 deletions tests/assets/pkg/Install4/gold/test-0.gold
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
::exec:: main.toit:6:14: error: Unresolved identifier: 'identify'
::exec:: print pkg4.identify
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand All @@ -24,7 +24,7 @@
::exec:: main2.toit:6:14: error: Unresolved identifier: 'identify'
::exec:: print pkg1.identify
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main2.toit
::analyze:: Exit Code: 1
Expand Down
4 changes: 2 additions & 2 deletions tests/assets/pkg/Install4/gold/test-1.gold
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
::exec:: main.toit:6:14: error: Unresolved identifier: 'identify'
::exec:: print pkg4.identify
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main.toit
::analyze:: Exit Code: 1
Expand All @@ -24,7 +24,7 @@
::exec:: main2.toit:6:14: error: Unresolved identifier: 'identify'
::exec:: print pkg1.identify
::exec:: ^~
::exec:: Compilation failed.
::exec:: Compilation failed
::exec::
::analyze:: analyze main2.toit
::analyze:: Exit Code: 1
Expand Down

0 comments on commit 0dd4bc4

Please sign in to comment.