Skip to content

Commit

Permalink
Fix ci p11 p12 (#609)
Browse files Browse the repository at this point in the history
* Updated CI to use P12 and P11 only.

* Removed P11 and P9 compatibility packages.

* Updated commit SHA to use updated setup-smalltalk GH action

- newest version uses Node.js v20

* Replaced ExTonelWriter with new ExercismCodeExporter to ensure version specific tonel formats of export.

* Upgrade to v7 of Mocketry package (Pharo v11 and above support)

* Added compatibility package for P12. Moved P12 version dependent methods to this package.

* Added dependency for ExercismTools package for P12.

* Fixed package name for P12 compatibility.

* Fixed ExercismGeneratorTest for P11, P12.

* Fixed class generation on Exercise generator.

* Changed test class generation to fluid syntax.
  • Loading branch information
Bajger authored Feb 16, 2024
1 parent 1f1a47f commit 080feb8
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 355 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
strategy:
fail-fast: false
matrix:
smalltalk: [Pharo64-11, Pharo64-10, Pharo64-9.0]
smalltalk: [Pharo64-12, Pharo64-11]
name: ${{ matrix.smalltalk }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- uses: hpi-swa/setup-smalltalkCI@e5cc24e537e43947b3d458a255ca28b9e914c1a2
- uses: hpi-swa/setup-smalltalkCI@c13cd871b26372e1028c94d5d6af67a8677f1e79
with:
smalltalk-image: ${{ matrix.smalltalk }}
- run: smalltalkci -s ${{ matrix.smalltalk }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

[![Build & Unit tests](https://github.com/exercism/pharo-smalltalk/actions/workflows/ci.yml/badge.svg)](https://github.com/exercism/pharo-smalltalk/actions/workflows/ci.yml)
[![GitHub release](https://img.shields.io/github/release/exercism/pharo-smalltalk.svg)](https://github.com/exercism/pharo-smalltalk/releases/latest)
[![Pharo 12](https://img.shields.io/badge/Pharo-12-informational)](https://get.pharo.org/120+vm)
[![Pharo 11](https://img.shields.io/badge/Pharo-11-informational)](https://get.pharo.org)
[![Pharo 10](https://img.shields.io/badge/Pharo-10-informational)](https://get.pharo.org/100+vm)
[![Pharo 9.0](https://img.shields.io/badge/Pharo-9.0-informational)](https://get.pharo.org/90+vm)



This repository is for the development of [Exercism](http://exercism.io) exercises running in the [Pharo Smalltalk](http://pharo.org) programming environment.
Expand Down
14 changes: 5 additions & 9 deletions dev/src/BaselineOfExercism/BaselineOfExercism.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,11 @@ BaselineOfExercism >> baseline: spec [
group: 'testRunnerTests' with: #('ExercismTestRunnerTests'), self class exerciseGoldenTestPackageNames;
group: 'v3' with: #('ExercismV3')
].
spec for: #'pharo9.x' do: [
spec package: 'ExercismTools' with: [ spec includes: #('ExercismPharo90') ].
spec package: 'ExercismPharo90' ].
spec for: #'pharo11.x' do: [
"ExercismTools must be loaded prior compatibilty package, to overwrite original class definition of ExTonelWriter"
spec package: 'ExercismTools' with: [ spec includes: #('ExercismPharo110') ].
spec package: 'ExercismPharo110' with: [ spec requires: 'ExercismTools' ]
spec for: #'pharo12.x' do: [
"ExercismTools methods will be overwritten by compatibility package for Pharo 12"
spec package: 'ExercismTests' with: [ spec includes: #('ExercismPharo120') ].
spec package: 'ExercismPharo120' with: [ spec requires: #('ExercismTests') ]
]

]

{ #category : #baselines }
Expand Down Expand Up @@ -112,7 +108,7 @@ BaselineOfExercism >> setUpDependencies: spec [

spec
baseline: 'Mocketry'
with: [ spec repository: 'github://dionisiydk/Mocketry:v6.0.x' ].
with: [ spec repository: 'github://dionisiydk/Mocketry:v7.0.x' ].

spec
baseline: 'Ring2'
Expand Down
15 changes: 7 additions & 8 deletions dev/src/ExercismDev/ExercismExerciseGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -211,14 +211,13 @@ ExercismExerciseGenerator >> generateSetupFor: testClass [

{ #category : #generation }
ExercismExerciseGenerator >> generateTestClass [

^ExercismTest
subclass: self testClassName asSymbol
instanceVariableNames: self testVariableName
classVariableNames: ''
poolDictionaries: ''
package: 'ExercismWIP-', (self testNameCamelCased)


^ ExercismTest << self testClassName asSymbol
slots: {self testVariableName asSymbol};
sharedVariables: {};
tag: self testNameCamelCased;
package: 'ExercismWIP';
install
]

{ #category : #generation }
Expand Down
30 changes: 18 additions & 12 deletions dev/src/ExercismDev/ExercismGenerator.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Class {
#name : #ExercismGenerator,
#superclass : #Object,
#instVars : [
'exTonelWriter',
'codeExporter',
'exercismExercise',
'exercisesPath',
'osSubProcess'
Expand Down Expand Up @@ -87,7 +87,7 @@ ExercismGenerator class >> generate [
path ifNotNil: [
self new
exercisesPath: path;
exTonelWriter: (ExTonelWriter on: path);
codeExporter: (ExercismCodeExporter on: path);
generate
]
]
Expand All @@ -106,6 +106,12 @@ ExercismGenerator >> basePathReference [
^ self exercisesPath parent
]

{ #category : #accessing }
ExercismGenerator >> codeExporter: anObject [

codeExporter := anObject
]

{ #category : #helper }
ExercismGenerator >> createTagSnapshotFor: packageOrTag [
| parentSnapshot |
Expand All @@ -119,12 +125,6 @@ ExercismGenerator >> createTagSnapshotFor: packageOrTag [
[ :mc | mc className isNil or: [ mc actualClass category endsWith: packageOrTag name ] ])
]

{ #category : #accessing }
ExercismGenerator >> exTonelWriter: anExTonelWriter [

exTonelWriter := anExTonelWriter
]

{ #category : #accessing }
ExercismGenerator >> exercisesPath [

Expand Down Expand Up @@ -227,13 +227,19 @@ ExercismGenerator >> generateSourceFilesFor: packageOrTag to: filePathString [
exerciseDirectoryRef ensureCreateDirectory.
exerciseDirectoryRef deleteAll.
exTonelWriter
sourceDirectory: (solutionDirectoryRef relativeTo: exampleDirectoryRef) pathString;
codeExporter
directoryReference: solutionDirectoryRef;
writeSnapshot: (self createTagSnapshotFor: packageOrTag).
"move files to root solution directory and remove unnecessary package dir"
((solutionDirectoryRef / packageOrTag name) allChildrenMatching: '*.st') do: [:aFile |
aFile moveTo: solutionDirectoryRef
].
(solutionDirectoryRef / packageOrTag name) delete.
"Remove the package file as its not needed for Exercism"
(solutionDirectoryRef / 'package.st') delete.
"Move the test file down to the exerciseDirectory"
testClasses := packageOrTag classes select: [ :cls | cls superclass = ExercismTest ].
testClasses do: [ :tc |
Expand Down
67 changes: 0 additions & 67 deletions dev/src/ExercismPharo110/ExTonelWriter.class.st

This file was deleted.

1 change: 0 additions & 1 deletion dev/src/ExercismPharo110/package.st

This file was deleted.

103 changes: 103 additions & 0 deletions dev/src/ExercismPharo120/ExercismSubmissionTest.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Extension { #name : #ExercismSubmissionTest }

{ #category : #'*ExercismPharo120' }
ExercismSubmissionTest class >> mockSnapshotSTON [
^ 'MCSnapshot {
#definitions : OrderedCollection [
MCOrganizationDefinition {
#packageName : #''Exercise@DependencyMock'',
#tagNames : [ ]
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ \''Call from class: \'', self class name'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #CMock
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ CMock mockMethod'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #BMock
},
MCMethodDefinition {
#classIsMeta : false,
#source : ''mockMethod ^ BMock mockMethod'',
#category : #''as yet unclassified'',
#selector : #mockMethod,
#className : #AMock
},
MCClassDefinition {
#name : #CMock,
#superclassName : #Object,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
},
MCClassDefinition {
#name : #BMock,
#superclassName : #CMock,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
},
MCClassDefinition {
#name : #AMock,
#superclassName : #BMock,
#variables : OrderedCollection [ ],
#packageName : #''Exercise@DependencyMock'',
#type : #normal,
#comment : '''',
#commentStamp : '''',
#traitComposition : ''{}'',
#classTraitComposition : ''{}''
}
],
#classDefinitionCache : {
#AMock : @12,
#CMock : @8,
#BMock : @10
}
}'
]

{ #category : #'*ExercismPharo120' }
ExercismSubmissionTest class >> prepareMockPackageWithDependentClasses [
" this is used for generating STON representation of MCSnapshot (see class side method), we don't need to create classes during test"
|aClass bClass cClass aPackage|

cClass := Object << #CMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

bClass := (self class environment at: #CMock) << #BMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

aClass := (self class environment at: #BMock) << #AMock
slots: {};
sharedVariables: {};
package: 'Exercise@DependencyMock';
install.

aClass compile: 'mockMethod ^ BMock mockMethod'.
bClass compile: 'mockMethod ^ CMock mockMethod'.
cClass compile: 'mockMethod ^ ''Call from class: '', self class name'.

aPackage := PackageOrganizer default packageNamed: 'Exercise@DependencyMock'.
^ TonelWriter new toSTON: aPackage snapshot.
]
1 change: 1 addition & 0 deletions dev/src/ExercismPharo120/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #ExercismPharo120 }
19 changes: 0 additions & 19 deletions dev/src/ExercismPharo90/StDebugger.extension.st

This file was deleted.

1 change: 0 additions & 1 deletion dev/src/ExercismPharo90/package.st

This file was deleted.

6 changes: 3 additions & 3 deletions dev/src/ExercismTests/ExercismExerciseTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ ExercismExerciseTest >> testSolutionSources [

self assertCollection: sources keys asSet equals: classNames asSet.

(sources at: classNames last) should includeSubstring: 'Tested on:'.
(sources at: classNames first) should includeSubstring: '#name : #', classes first name.
(sources at: classNames allButLast last) should includeSubstring: '#name : #', classes last name.
(sources at: classNames last) includesSubstring: 'Tested on:'.
(sources at: classNames first) includesSubstring: '#name : #', classes first name.
(sources at: classNames allButLast last) includesSubstring: '#name : #', classes last name.
]

{ #category : #tests }
Expand Down
Loading

0 comments on commit 080feb8

Please sign in to comment.